Merge branch 'master' into #1

# Conflicts:
#	importE5EDISales.php
This commit is contained in:
Michał Zieliński
2025-08-27 07:35:09 +02:00
10 changed files with 156 additions and 106 deletions

View File

@@ -62,8 +62,8 @@ function checkEDISales()
$s->number = $number; $s->number = $number;
$s->document_no = $s->formatNumber($number); $s->document_no = $s->formatNumber($number);
$s->edi_file = $order; $s->edi_file = $order;
$s->type = 'sales_order'; $s->type = 'abf8f342-13de-bb9f-7848-687897a3b953';
$s->status = 's60'; $s->status = 's30';
$s->ecmlanguage = 'pl_pl'; $s->ecmlanguage = 'pl_pl';
$a = new Account(); $a = new Account();
$a->retrieve($s->parent_id); $a->retrieve($s->parent_id);
@@ -78,7 +78,7 @@ function checkEDISales()
} }
$s->total_netto = $sum_netto; $s->total_netto = $sum_netto;
if ($s->parent_id == 134 || $s->parent_id == '134') { if ($s->parent_id == 134 || $s->parent_id == '134') { // carrefour
$s->shop_number = null; $s->shop_number = null;
} }

View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-07-24 09:51:22 // created: 2025-08-13 12:56:45
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -82,6 +82,7 @@ $customDoms = array (
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister tablets 6pcs 6,5g', 'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister tablets 6pcs 6,5g',
'31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Liquid', '31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Liquid',
'27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Powder', '27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Powder',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Bottle 30 ml N-34B plastan',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -231,6 +232,9 @@ $customDoms = array (
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Sets', '8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Sets',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Liquid Mixing', '55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Liquid Mixing',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Bisters', '9bc2bafc-0608-7bc7-468b-686a94772424' => 'Bisters',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'Packing Blisters Into Packaging',
'e3e16e03-8e62-624e-f954-689c37059997' => 'Packing Tablets Into Jars',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'Packing into tubes',
), ),
'payment_method_dom' => 'payment_method_dom' =>
array ( array (

View File

@@ -1,5 +1,5 @@
<?php <?php
// created: 2025-07-24 09:51:22 // created: 2025-08-13 12:56:45
$customDoms = array ( $customDoms = array (
'ecmproducts_attribute_dom' => 'ecmproducts_attribute_dom' =>
array ( array (
@@ -82,6 +82,7 @@ $customDoms = array (
'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister, tabletki 6szt. 6,5g', 'c1477582-33b9-529d-bdd2-685250fc18d4' => 'Blister, tabletki 6szt. 6,5g',
'31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Płyn_WOD', '31bf91c9-6176-a27a-9a4e-686f6b2597ee' => 'Płyn_WOD',
'27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Proszek', '27c00505-f6cf-3ef1-3c1d-6880847a5893' => 'Proszek',
'a2ba9b76-8e2e-32c4-e9c8-689c6ac2dbb9' => 'Butelka 30 ml N-34B plastan',
), ),
'ecmproducts_brand_dom' => 'ecmproducts_brand_dom' =>
array ( array (
@@ -231,6 +232,9 @@ $customDoms = array (
'8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Zestawy', '8519dfc8-5eec-0233-7f84-54d1fe00e9fc' => 'Zestawy',
'55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszanie', '55020d96-73d5-7b29-3bab-654f4818e0cd' => 'Mieszanie',
'9bc2bafc-0608-7bc7-468b-686a94772424' => 'Blistrowanie', '9bc2bafc-0608-7bc7-468b-686a94772424' => 'Blistrowanie',
'be37016b-0aa4-678c-9c4a-689c3673af3e' => 'PBDO',
'e3e16e03-8e62-624e-f954-689c37059997' => 'PTDS',
'416a2b50-4979-bc35-c83c-689c8a6640ae' => 'PWT',
), ),
'payment_method_dom' => 'payment_method_dom' =>
array ( array (

View File

@@ -166,6 +166,11 @@ check_form = function(formname) {
$(".loading_panel").css("display", "none"); $(".loading_panel").css("display", "none");
return false; return false;
} }
if (items[index].price_netto == 0) {
alert("Niedopuszczalna, zerowa cena netto.");
$(".loading_panel").css("display", "none");
return false;
}
} }
$("#total_netto").val($("#t_netto").val()); $("#total_netto").val($("#t_netto").val());
$("#total_brutto").val($("#t_brutto").val()); $("#total_brutto").val($("#t_brutto").val());

View File

@@ -57,14 +57,17 @@ function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null)
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
global $app_list_strings; global $app_list_strings;
$query = "SELECT s.id as orderId, s.document_no, s.status, s.parent_name, s.parent_id, s.send_date, s.type, $query = "
SELECT s.id as orderId, s.document_no, s.status, s.parent_name, s.parent_id, s.send_date, s.type,
p.code, p.name, ps.ecmproduct_id, ps.description, p.code, p.name, ps.ecmproduct_id, ps.description,
si.quantity, p.vendor_part_no as kind, p.brand, p.part_no as size, p.shape, si.quantity, p.vendor_part_no as kind, p.brand, p.part_no as size, p.shape,
p.ems_qty_in_stock as stockState, si.id as item_id, s.shipping_address_name, ps.production_date, p.ems_qty_in_stock as stockState, si.id as item_id, s.shipping_address_name, ps.production_date,
ps.quantity as scheduledQuantity, ps.id as id, ps.quantity as scheduledQuantity, ps.id as id,
ps.main_id, ps.main_id,
ps_main.ecmproduct_id as main_product_id, ps_main.ecmproduct_id as main_product_id,
p_main.code as main_product_code p_main.code as main_product_code,
a.id AS action_id,
a.indeks AS action_index
FROM productionScheduler AS ps FROM productionScheduler AS ps
LEFT JOIN ecmsaleitems AS si LEFT JOIN ecmsaleitems AS si
ON ps.ecmsaleitem_id = si.id ON ps.ecmsaleitem_id = si.id
@@ -76,6 +79,20 @@ function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null)
ON ps.main_id = ps_main.id ON ps.main_id = ps_main.id
LEFT JOIN ecmproducts AS p_main LEFT JOIN ecmproducts AS p_main
ON ps_main.ecmproduct_id = p_main.id ON ps_main.ecmproduct_id = p_main.id
LEFT JOIN (
SELECT epa.ecmproduct_id, epa.ecmaction_id
FROM ecmproductactions epa
JOIN (
SELECT ecmproduct_id, MIN(position) AS min_pos
FROM ecmproductactions
GROUP BY ecmproduct_id
) m
ON m.ecmproduct_id = epa.ecmproduct_id
AND m.min_pos = epa.position
) pa_first
ON pa_first.ecmproduct_id = p.id
LEFT JOIN ecmactions a
ON a.id = pa_first.ecmaction_id
WHERE ps.deleted = 0 "; WHERE ps.deleted = 0 ";
if ($dateFrom != null && $dateTo != null) { if ($dateFrom != null && $dateTo != null) {
@@ -88,7 +105,8 @@ function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null)
$query .= " AND ps.id IN ('" . join("','", $ids) . "')"; $query .= " AND ps.id IN ('" . join("','", $ids) . "')";
} }
$query .= "ORDER BY s.delivery_date, s.register_date, s.document_no"; $query .= "GROUP BY ps.id, s.id, si.id, p.id, ps_main.id, p_main.id ";
$query .= "ORDER BY s.delivery_date, s.register_date, s.document_no;";
$rows = $db->query($query); $rows = $db->query($query);
$data = array(); $data = array();
@@ -123,8 +141,10 @@ function loadSchedulers($dateFrom = null, $dateTo = null, $ids = null)
$row['productionDate'] = $r['production_date'] == '0000-00-00' ? '' : $r['production_date']; $row['productionDate'] = $r['production_date'] == '0000-00-00' ? '' : $r['production_date'];
$row['productStockState'] = $r['stockState'] | 0; $row['productStockState'] = $r['stockState'] | 0;
$row['mainProductId'] = $r['main_product_id']; $row['mainProductId'] = $r['main_product_id'];
$row['mainProductCode'] = $r['main_product_code']; $row['mainProductCode'] = strlen($r['main_product_code']) > 20 ? substr($r['main_product_code'], 0, 20) . "..." : $r['main_product_code'];
$row['mainProductFullCode'] = $r['main_product_code'];
$row['action_id'] = $r['action_id'];
$row['action_index'] = $r['action_index'];
$data[] = $row; $data[] = $row;
} }
return $data; return $data;

View File

@@ -151,6 +151,7 @@
<th>Forma</th> <th>Forma</th>
<th>Marka</th> <th>Marka</th>
<th>Data wysyłki</th> <th>Data wysyłki</th>
<th>Czynność</th>
<th>Uwagi</th> <th>Uwagi</th>
</tr> </tr>
</thead> </thead>
@@ -177,7 +178,8 @@
</td> </td>
<td> <td>
<input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text" <input id="production-date-{$ROW.id}" name="production-date-{$ROW.id}" type="text"
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off" maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}"
autocomplete="off"
id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')"> id="production-date-{$ROW.id}" onchange="saveProductionDate('{$ROW.id}')">
<img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif" <img id="production-date-trigger-{$ROW.id}" src="themes/default/images/jscalendar.gif"
style="width: 13px;"> style="width: 13px;">
@@ -200,7 +202,8 @@
onclick="saveQty('{$ROW.id}')" style="display: none;"></div> onclick="saveQty('{$ROW.id}')" style="display: none;"></div>
<div id="qty-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.qty} <div id="qty-{$ROW.id}" style="display: inline; width: 300px;">{$ROW.qty}
</div> </div>
<input id="qtyInput-{$ROW.id}" value="{$ROW.qty}" style="width: 50px; display: none;" type="number"/> <input id="qtyInput-{$ROW.id}" value="{$ROW.qty}" style="width: 50px; display: none;"
type="number"/>
</td> </td>
<td> <td>
{$ROW.productQty} {$ROW.productQty}
@@ -220,7 +223,8 @@
{$ROW.orderStatus} {$ROW.orderStatus}
</td> </td>
<td> <td>
<a target="_blank" href="index.php?module=EcmProducts&action=DetailView&record={$ROW.mainProductId}"> <a target="_blank" href="index.php?module=EcmProducts&action=DetailView&record={$ROW.mainProductId}"
title="{$ROW.mainProductFullCode}">
{$ROW.mainProductCode} {$ROW.mainProductCode}
</a> </a>
</td> </td>
@@ -236,6 +240,11 @@
<td> <td>
{$ROW.orderSendDate} {$ROW.orderSendDate}
</td> </td>
<td>
<a target="_blank" href="index.php?module=EcmActions&action=DetailView&record={$ROW.action_id}">
{$ROW.action_index}
</a>
</td>
<td> <td>
<div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil" <div id="edit-description-{$ROW.id}" class="ui-icon ui-icon-pencil"
onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div> onclick="editDescription('{$ROW.id}')" style="display: inline-block;"></div>

View File

@@ -331,6 +331,7 @@ function drawRawMaterials(data) {
}); });
orders += "</td>"; orders += "</td>";
tr.append(orders); tr.append(orders);
tr.append("<td>" + el.stockAddress + "</td>");
$("#rawMaterialsTable > tbody").append(tr); $("#rawMaterialsTable > tbody").append(tr);
}); });
@@ -492,7 +493,7 @@ function componentsTablePrototype() {
return '<table id="componentsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllComponents" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>Stan</th><th>ZS E5</th><th>Typ</th><th>Status</th><th>Produkt główny</th><th>Odbiorca</th><th>Forma</th><th>Marka</th><th>Data wysyłki</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="componentsTableSum">0</td><td colspan="9"></td></tr></tfoot></table>' return '<table id="componentsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllComponents" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>Stan</th><th>ZS E5</th><th>Typ</th><th>Status</th><th>Produkt główny</th><th>Odbiorca</th><th>Forma</th><th>Marka</th><th>Data wysyłki</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="componentsTableSum">0</td><td colspan="9"></td></tr></tfoot></table>'
} }
function rawMaterialsTablePrototype() { function rawMaterialsTablePrototype() {
return '<table id="rawMaterialsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllRawMaterials" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>JM.</th><th>Stan</th><th>Zamówiono</th><th>Dostawca</th><th>Zamówienie</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="5"></td></tr></tfoot></table>' return '<table id="rawMaterialsTable"><thead><tr><th class="filter-false"><input type="checkbox" id="selectAllRawMaterials" /></th><th>Pozycja</th><th>Indeks</th><th>Nazwa</th><th>Ilość</th><th>JM.</th><th>Stan</th><th>Zamówiono</th><th>Dostawca</th><th>Zamówienie</th><th>Adres magazynowy</th></tr></thead><tbody aria-live="polite" aria-relevant="all"></tbody><tfoot><tr><td colspan=4></td><td id="rawMaterialsTableSum">0</td><td colspan="6"></td></tr></tfoot></table>'
} }
function addToProductionScheduler(orderItemId) { function addToProductionScheduler(orderItemId) {
showLoader("Trwa dodawanie elementu do harmonogramu produkcji..."); showLoader("Trwa dodawanie elementu do harmonogramu produkcji...");

View File

@@ -99,6 +99,8 @@ if (!isset($_GET['ajaxAction'])) {
$row['description'] = strlen($r['description']) > 0 ? substr($r['description'], 0, 30) : ''; $row['description'] = strlen($r['description']) > 0 ? substr($r['description'], 0, 30) : '';
$row['fullDescription'] = $r['description']; $row['fullDescription'] = $r['description'];
$row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']); $row['shippingTo'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']);
$row['shippingToFull'] = $row['shippingTo'];
$row['shippingTo'] = strlen($row['shippingTo']) > 55 ? substr($row['shippingTo'], 0, 55) . "..." : $row['shippingTo'];
$row['productionDate'] = $r['production_date']; $row['productionDate'] = $r['production_date'];
$row['productStockState'] = $r['stockState'] | 0; $row['productStockState'] = $r['stockState'] | 0;
$row['scheduled'] = $r['scheduled']; $row['scheduled'] = $r['scheduled'];
@@ -160,7 +162,6 @@ function findProduct($array, $value)
} }
return -1; return -1;
} }
function getComponents($ids, $dateFrom, $dateTo) function getComponents($ids, $dateFrom, $dateTo)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -235,7 +236,6 @@ function getComponents($ids, $dateFrom, $dateTo)
} }
echo json_encode($componentsData); echo json_encode($componentsData);
} }
function getRawMaterials2($ids, $type) function getRawMaterials2($ids, $type)
{ {
global $app_list_strings; global $app_list_strings;
@@ -287,9 +287,12 @@ function getRawMaterials2($ids, $type)
foreach ($grouppedRawMaterials as $material) { foreach ($grouppedRawMaterials as $material) {
$product = $db->fetchByAssoc($db->query(" $product = $db->fetchByAssoc($db->query("
SELECT p.id, p.code, p.name, p.group_ks, p.unit_id, p.ems_qty_in_stock as stockState SELECT p.id, p.code, p.name, p.group_ks, p.unit_id, p.ems_qty_in_stock as stockState,
GROUP_CONCAT(s.stock_address SEPARATOR ', ') AS stock_addresses
FROM ecmproducts AS p FROM ecmproducts AS p
LEFT JOIN ecmproducts_stock_addresses s ON p.id = s.ecmproduct_id
WHERE p.id='" . $material['ecmproduct_id'] . "' WHERE p.id='" . $material['ecmproduct_id'] . "'
GROUP BY p.id
")); "));
$ordered = $db->fetchByAssoc($db->query("SELECT SUM(poi.quantity) as ordered, GROUP_CONCAT(poi.ecmpurchaseorder_id SEPARATOR '|') AS orders $ordered = $db->fetchByAssoc($db->query("SELECT SUM(poi.quantity) as ordered, GROUP_CONCAT(poi.ecmpurchaseorder_id SEPARATOR '|') AS orders
FROM ecmpurchaseorderitems as poi FROM ecmpurchaseorderitems as poi
@@ -329,11 +332,11 @@ function getRawMaterials2($ids, $type)
$row['productGroupKS'] = $product['group_ks']; $row['productGroupKS'] = $product['group_ks'];
$row['orders'] = $orders; $row['orders'] = $orders;
$row['productStockState'] = (!empty($product['stockState'])) ? $product['stockState'] : 0; $row['productStockState'] = (!empty($product['stockState'])) ? $product['stockState'] : 0;
$row['stockAddress'] = (!empty($product['stock_addresses'])) ? $product['stock_addresses'] : "";
$response[] = $row; $response[] = $row;
} }
return json_encode($response); return json_encode($response);
} }
function getRawMaterials($ids, $cids) function getRawMaterials($ids, $cids)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -419,7 +422,6 @@ function getRawMaterials($ids, $cids)
echo json_encode($rawMaterialsData); echo json_encode($rawMaterialsData);
} }
function getProductRawMaterials($productId, $quantity) function getProductRawMaterials($productId, $quantity)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -454,7 +456,6 @@ WHERE
} }
return $response; return $response;
} }
function addToProductionScheduler($orderItemId) function addToProductionScheduler($orderItemId)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -472,7 +473,7 @@ function addToProductionScheduler($orderItemId)
foreach ($products as $product) { foreach ($products as $product) {
if ($saleInfo['ecmproduct_id'] == $product['ecmproduct_id']) { if ($saleInfo['ecmproduct_id'] == $product['ecmproduct_id']) {
$id = $masterId; $id = $masterId;
$mainId = null; $mainId = $masterId;
} else { } else {
$id = generateUuidV4(); $id = generateUuidV4();
$mainId = $masterId; $mainId = $masterId;
@@ -483,7 +484,6 @@ function addToProductionScheduler($orderItemId)
$db->query($query); $db->query($query);
} }
} }
function addComponentToProductionScheduler($productId, $qty) function addComponentToProductionScheduler($productId, $qty)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -492,7 +492,6 @@ function addComponentToProductionScheduler($productId, $qty)
generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId); generateUuidV4(), $qty, $current_user->id, $current_user->id, $productId);
$db->query($query); $db->query($query);
} }
function getComponents2($ids) function getComponents2($ids)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -534,7 +533,7 @@ function getComponents2($ids)
$row['orderId'] = $r['id']; $row['orderId'] = $r['id'];
$row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']]; $row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
$row['orderType'] = $app_list_strings['ecmsales_type_dom'][$r['type']]; $row['orderType'] = $app_list_strings['ecmsales_type_dom'][$r['type']];
$row['orderParent'] = ($r['shipping_address_name'] == 'Adres korespondencyjny' ? '' : $r['shipping_address_name']); $row['orderParent'] = (isset($r['shipping_address_name']) && $r['shipping_address_name'] != 'Adres korespondencyjny' ? $r['shipping_address_name'] : '');
$row['orderSendDate'] = $r['send_date']; $row['orderSendDate'] = $r['send_date'];
$componentsData[] = $row; $componentsData[] = $row;
} }
@@ -574,7 +573,6 @@ function getComponents2($ids)
* *
*/ */
} }
function getProductComponents($productId, $quantity) function getProductComponents($productId, $quantity)
{ {
$db = $GLOBALS['db']; $db = $GLOBALS['db'];
@@ -614,7 +612,6 @@ HAVING
return $response; return $response;
} }
} }
function generateUuidV4() function generateUuidV4()
{ {
$data = openssl_random_pseudo_bytes(16); $data = openssl_random_pseudo_bytes(16);

View File

@@ -215,7 +215,7 @@
{$ROW.orderParent} {$ROW.orderParent}
</a> </a>
</td> </td>
<td> <td title="{$ROW.shippingToFull}">
{$ROW.shippingTo} {$ROW.shippingTo}
</td> </td>
<td> <td>

View File

@@ -131,6 +131,16 @@ class readXML {
} }
$this->register_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->OrderDate ) ); $this->register_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->OrderDate ) );
$this->delivery_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->ExpectedDeliveryDate ) ); $this->delivery_date = date ( "d.m.Y", strtotime ( $this->nodes->{'Order-Header'}->ExpectedDeliveryDate ) );
$delivery_timestamp = strtotime($this->nodes->{'Order-Header'}->ExpectedDeliveryDate);
$delivery_day_of_week = date('N', $delivery_timestamp); // 1 = Monday, 7 = Sunday
if ($delivery_day_of_week == 1) { // Monday -> send on Friday
$send_timestamp = strtotime('-3 days', $delivery_timestamp);
} else { // send one day before
$send_timestamp = strtotime('-1 day', $delivery_timestamp);
}
$this->send_date = date("d.m.Y", $send_timestamp);
$this->assigned_user_id = $_SESSION ['authenticated_user_id']; $this->assigned_user_id = $_SESSION ['authenticated_user_id'];
$this->position_list = array (); $this->position_list = array ();
} }