From 223224d12c21791162343ee88370eebbe91c2f93 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Tue, 19 May 2020 08:07:21 +0200 Subject: [PATCH 01/33] Add function to update the event percent + const --- htdocs/comm/action/class/actioncomm.class.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bf906989d16..6df61e3bc72 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -343,6 +343,20 @@ class ActionComm extends CommonObject */ public $errors_to; + /** + * Typical value for a event that is in a todo state + */ + const EVENT_TODO = 0; + + /** + * Typical value for a event that is in a progress state + */ + const EVENT_IN_PROGRESS = 50; + + /** + * Typical value for a event that is in a finished state + */ + const EVENT_FINISHED = 100; /** * Constructor @@ -2021,4 +2035,32 @@ class ActionComm extends CommonObject return $error; } + + /** + * Udpate the percent value of a event with the given id + * + * @param int $id The id of the event + * @param int $percent The new percent value for the event + * @return int 1 when update of the event was suscessfull, otherwise -1 + */ + public function updatePercent($id, $percent) + { + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; + $sql .= " SET percent = '".$percent."'"; + $sql .= " WHERE id=".$id; + + if ($this->db->query($sql)) + { + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + return -1; + } + } } From 7fd6151c432957d94232c5fba8d46dc799ebd9e6 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Tue, 19 May 2020 08:18:38 +0200 Subject: [PATCH 02/33] Add massactions for event list --- htdocs/comm/action/list.php | 60 +++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2391f9ca491..be841ea8506 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2017 Open-DSI * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other")); $action = GETPOST('action', 'alpha'); +$massaction = GETPOST('massaction', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search $resourceid = GETPOST("search_resourceid", "int") ?GETPOST("search_resourceid", "int") : GETPOST("resourceid", "int"); $pid = GETPOST("search_projectid", 'int', 3) ?GETPOST("search_projectid", 'int', 3) : GETPOST("projectid", 'int', 3); @@ -49,6 +51,8 @@ $optioncss = GETPOST('optioncss', 'alpha'); $year = GETPOST("year", 'int'); $month = GETPOST("month", 'int'); $day = GETPOST("day", 'int'); +$toselect = GETPOST('toselect', 'array'); + // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('search_actioncode', 'array')) { @@ -185,9 +189,42 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $datestart = ''; $dateend = ''; $search_status = ''; + $toselect = ''; $search_array_options = array(); } +if (empty($reshook) && !empty($massaction)) +{ + unset($percent); + + switch ($massaction) + { + case 'set_all_events_to_todo': + $percent = ActionComm::EVENT_TODO; + break; + + case 'set_all_events_to_in_progress': + $percent = ActionComm::EVENT_IN_PROGRESS; + break; + + case 'set_all_events_to_finished': + $percent = ActionComm::EVENT_FINISHED; + break; + } + + if(isset($percent)) + { + foreach ($toselect as $toselectid) + { + $result = $object->updatePercent($toselectid, $percent); + if($result < 0) + { + dol_print_error($db); + break; + } + } + } +} /* * View @@ -239,6 +276,15 @@ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// List of mass actions available +$arrayofmassactions = array( + 'set_all_events_to_todo' => $langs->trans("SetAllEventsToTodo"), + 'set_all_events_to_in_progress' => $langs->trans("SetAllEventsToInProgress"), + 'set_all_events_to_finished' => $langs->trans("SetAllEventsToFinished"), +); + +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + $sql = "SELECT"; if ($usergroup > 0) $sql .= " DISTINCT"; $sql .= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,"; @@ -366,6 +412,8 @@ if ($resql) $num = $db->num_rows($resql); + $arrayofselected = is_array($toselect) ? $toselect : array(); + // Local calendar $newtitle = '
'.$langs->trans("LocalAgenda").'  
'; //$newtitle=$langs->trans($title); @@ -436,7 +484,7 @@ if ($resql) $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); } - print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -740,7 +788,15 @@ if ($resql) $datep = $db->jdate($obj->datep); print ''.$actionstatic->LibStatut($obj->percent, 5, 0, $datep).''; } - print ''; + // Action column + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected = 0; + if (in_array($obj->id, $arrayofselected)) $selected = 1; + print ''; + } + print ''; print "\n"; $i++; From 0cba74277a69a49e4b46aba10b89b74a7ee98a87 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Tue, 19 May 2020 08:19:14 +0200 Subject: [PATCH 03/33] Update agenda.lang --- htdocs/langs/en_US/agenda.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index f4c8c5b4fbc..869a312910e 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -152,3 +152,6 @@ EveryMonth=Every month DayOfMonth=Day of month DayOfWeek=Day of week DateStartPlusOne=Date start + 1 hour +SetAllEventsToTodo=Set all events to todo +SetAllEventsToInProgress=Set all events to in progress +SetAllEventsToFinished=Set all events to finished From f0bb7d233fb211d706dc70be9a0147c54e700a08 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 19 May 2020 06:29:23 +0000 Subject: [PATCH 04/33] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6df61e3bc72..dadc180ce08 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2035,7 +2035,7 @@ class ActionComm extends CommonObject return $error; } - + /** * Udpate the percent value of a event with the given id * From b79a30c0f96d701171ec52bf3d30d395b3df04d2 Mon Sep 17 00:00:00 2001 From: altairis Date: Tue, 19 May 2020 14:18:06 +0200 Subject: [PATCH 05/33] edit and delete dispatched lines --- htdocs/fourn/commande/dispatch.php | 126 ++++++++++++++++++++++++++--- 1 file changed, 113 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index d132a87233f..596e657f2e3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -8,7 +8,7 @@ * Copyright (C) 2016 Florian Henry * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018 Frédéric France - * Copyright (C) 2019 Christophe Battarel + * Copyright (C) 2019-2020 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +53,8 @@ $ref = GETPOST('ref'); $lineid = GETPOST('lineid', 'int'); $action = GETPOST('action', 'aZ09'); $fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); +$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); if ($user->socid) $socid = $user->socid; @@ -366,6 +368,34 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) } } +// Remove a dispatched line +if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->commande->receptionner) +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result = $supplierorderdispatch->fetch($lineid); + if ($result > 0) $result = $supplierorderdispatch->delete($user); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +// Update a dispatched line +if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionner) +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result = $supplierorderdispatch->fetch($lineid); + if ($result > 0) + { + $supplierorderdispatch->qty = GETPOST('qty', 'int'); + $supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot'); + $result = $supplierorderdispatch->update($user); + } + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } +} /* * View @@ -379,7 +409,7 @@ $warehouse_static = new Entrepot($db); $supplierorderdispatch = new CommandeFournisseurDispatch($db); $help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores'; -llxHeader('', $langs->trans("Order"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php')); +llxHeader('', $langs->trans("OrderDispatch"), $help_url, '', 0, 0, array('/fourn/js/lib_dispatch.js.php')); if ($id > 0 || !empty($ref)) { $soc = new Societe($db); @@ -393,6 +423,23 @@ if ($id > 0 || !empty($ref)) { $title = $langs->trans("SupplierOrder"); dol_fiche_head($head, 'dispatch', $title, -1, 'order'); + $formconfirm=''; + + // Confirmation to delete line + if ($action == 'ask_deleteline') + { + $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + } + + // Call Hook formConfirm + $parameters = array('lineid' => $lineid); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + + // Print form confirm + print $formconfirm; // Supplier order card @@ -493,6 +540,9 @@ if ($id > 0 || !empty($ref)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); $formproduct->loadWarehouses(); + $entrepot = new Entrepot($db); + $listwarehouses=$entrepot->list_array(1); + if (empty($conf->reception->enabled))print '
'; else print ''; @@ -567,8 +617,6 @@ if ($id > 0 || !empty($ref)) { $i = 0; if ($num) { - $entrepot = new Entrepot($db); - $listwarehouses = $entrepot->list_array(1); print ''; @@ -965,7 +1013,6 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("SellByDate").''; } print ''.$langs->trans("QtyDispatched").''; - print ''; print ''.$langs->trans("Warehouse").''; print ''.$langs->trans("Comment").''; @@ -977,14 +1024,23 @@ if ($id > 0 || !empty($ref)) { print ''; } - print ''; + print ''; print "\n"; while ($i < $num) { $objp = $db->fetch_object($resql); - print ""; + if ($action == 'editline' && $lineid == $objp->dispatchlineid) + { + print ' + + + + '; + } + + print ''; if (!empty($conf->reception->enabled)) { print ''; @@ -1011,14 +1067,34 @@ if ($id > 0 || !empty($ref)) { } // Qty - print ''.$objp->qty.''; - print ' '; + if ($action == 'editline' && $lineid == $objp->dispatchlineid) + { + print ''; + } + else + { + print ''.$objp->qty.''; + } // Warehouse print ''; - $warehouse_static->id = $objp->warehouse_id; - $warehouse_static->libelle = $objp->entrepot; - print $warehouse_static->getNomUrl(1); + if ($action == 'editline' && $lineid == $objp->dispatchlineid) + { + if (count($listwarehouses) > 1) { + print $formproduct->selectWarehouses(GETPOST("fk_entrepot")?GETPOST("fk_entrepot"):($objp->warehouse_id?$objp->warehouse_id:''), "fk_entrepot", '', 1, 0, $objp->fk_product, '', 1, 1, null, 'csswarehouse'); + } elseif (count($listwarehouses) == 1) { + print $formproduct->selectWarehouses(GETPOST("fk_entrepot")?GETPOST("fk_entrepot"):($objp->warehouse_id?$objp->warehouse_id:''), "fk_entrepot", '', 0, 0, $objp->fk_product, '', 1, 1, null, 'csswarehouse'); + } else { + $langs->load("errors"); + print $langs->trans("ErrorNoWarehouseDefined"); + } + } + else + { + $warehouse_static->id = $objp->warehouse_id; + $warehouse_static->libelle = $objp->entrepot; + print $warehouse_static->getNomUrl(1); + } print ''; // Comment @@ -1069,9 +1145,33 @@ if ($id > 0 || !empty($ref)) { print ''; } - print ''; + if ($action != 'editline' ||  && $lineid != $objp->dispatchlineid) + { + print ''; + print 'dispatchlineid .'#line_'. $objp->dispatchlineid . '">'; + print img_edit(); + print ''; + print ''; + + print ''; + print 'dispatchlineid . '#dispatch_received_products">'; + print img_delete(); + print ''; + print ''; + } + else + { + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + print "\n"; + if ($action == 'editline' && $lineid == $objp->dispatchlineid) print '
'; $i++; } From 80c56b30179b9c5baa619a9c7be1d1cb41f6a88b Mon Sep 17 00:00:00 2001 From: altairis Date: Tue, 19 May 2020 15:59:03 +0200 Subject: [PATCH 06/33] manage stock on edit and delete dispatched lines --- htdocs/fourn/commande/dispatch.php | 109 +++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 596e657f2e3..088cff61ee6 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -38,6 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/stock/class/mouvementstock.class.php'; + if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -371,29 +373,121 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) // Remove a dispatched line if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->commande->receptionner) { + $db->begin(); + $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result = $supplierorderdispatch->fetch($lineid); - if ($result > 0) $result = $supplierorderdispatch->delete($user); + if ($result > 0) + { + $qty = $supplierorderdispatch->qty; + $entrepot = $supplierorderdispatch->fk_entrepot; + $product = $supplierorderdispatch->fk_product; + $price = GETPOST('price'); + $comment = $supplierorderdispatch->comment; + $eatby = $supplierorderdispatch->fk_product; + $sellby = $supplierorderdispatch->sellby; + $batch = $supplierorderdispatch->batch; + + $result = $supplierorderdispatch->delete($user); + } if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + $errors = $object->errors; + $error++; + } + else + { + // If module stock is enabled and the stock increase is done on purchase order dispatching + if ($entrepot > 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) + { + $mouv = new MouvementStock($db); + if ($product > 0) + { + $mouv->origin = &$object; + $result=$mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); + if ($result < 0) + { + $errors=$mouv->errors; + $error++; + } + } + } + } + if ($error > 0) + { + $db->rollback(); + setEventMessages($error, $errors, 'errors'); + } + else + { + $db->commit(); } } // Update a dispatched line if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionner) { + $db->begin(); + $error = 0; + $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result = $supplierorderdispatch->fetch($lineid); if ($result > 0) { + $qty = $supplierorderdispatch->qty; + $entrepot = $supplierorderdispatch->fk_entrepot; + $product = $supplierorderdispatch->fk_product; + $price = GETPOST('price'); + $comment = $supplierorderdispatch->comment; + $eatby = $supplierorderdispatch->fk_product; + $sellby = $supplierorderdispatch->sellby; + $batch = $supplierorderdispatch->batch; + $supplierorderdispatch->qty = GETPOST('qty', 'int'); $supplierorderdispatch->fk_entrepot = GETPOST('fk_entrepot'); $result = $supplierorderdispatch->update($user); } if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + $error++; + $errors=$supplierorderdispatch->errors; + } + else + { + // If module stock is enabled and the stock increase is done on purchase order dispatching + if ($entrepot > 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) + { + $mouv = new MouvementStock($db); + if ($product > 0) + { + $mouv->origin = &$object; + $result=$mouv->livraison($user, $product, $entrepot, $qty, $price, $comment, '', $eatby, $sellby, $batch); + if ($result < 0) + { + $errors=$mouv->errors; + $error++; + } + else + { + $mouv->origin = &$object; + $result=$mouv->reception($user, $product, $supplierorderdispatch->fk_entrepot, $supplierorderdispatch->qty, $price, $comment, $eatby, $sellby, $batch); + if ($result < 0) + { + $errors=$mouv->errors; + $error++; + } + } + } + } + } + if ($error > 0) + { + $db->rollback(); + setEventMessages($error, $errors, 'errors'); + } + else + { + $db->commit(); } } @@ -979,9 +1073,11 @@ if ($id > 0 || !empty($ref)) { $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; + $sql.=" ,cd.rowid, cd.subprice"; if ($conf->reception->enabled)$sql .= " ,cfd.fk_reception, r.date_delivery"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; if ($conf->reception->enabled)$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."reception as r ON cfd.fk_reception = r.rowid"; $sql .= " WHERE cfd.fk_commande = ".$object->id; @@ -1067,14 +1163,17 @@ if ($id > 0 || !empty($ref)) { } // Qty + print ''; if ($action == 'editline' && $lineid == $objp->dispatchlineid) { - print ''; + print ''; } else { - print ''.$objp->qty.''; + print $objp->qty; } + print ''; + print ''; // Warehouse print ''; From 16cc94660893f1fe3e7e14c999dba0f82bcc430a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 May 2020 20:13:42 +0200 Subject: [PATCH 07/33] Update datapolicycron.class.php --- htdocs/datapolicy/class/datapolicycron.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 409df1362e9..8e3cfe10874 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -482,7 +482,7 @@ class DataPolicyCron while ($i < $num && !$error) { - $obj = $db->fetch_object($resql); + $obj = $this->db->fetch_object($resql); $object->fetch($obj->rowid); $object->id = $obj->rowid; From e7714acc77395b602616e9391d5b1400c0f16f50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 May 2020 20:19:00 +0200 Subject: [PATCH 08/33] Update paymentloan.class.php same picto in loan --- htdocs/loan/class/paymentloan.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index ce152317710..0aa5b2dbf62 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2018 Frederic France + * Copyright (C) 2015-2020 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,11 @@ class PaymentLoan extends CommonObject */ public $table_element = 'payment_loan'; + /** + * @var string String with name of icon for PaymentLoan + */ + public $picto = 'money-bill-alt'; + /** * @var int Loan ID */ From 358054908fbb5e966cb9fc26c685b39e92abca39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 May 2020 22:59:23 +0200 Subject: [PATCH 09/33] Update AccountingAccountTest.php --- test/phpunit/AccountingAccountTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index b4367e96f49..622bd346872 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -204,7 +204,7 @@ class AccountingAccountTest extends PHPUnit\Framework\TestCase $localobject->label='New label'; $result=$localobject->update($user); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); return $localobject->id; From 86e220dd40be45b964177e8623cd3b8f67435c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 May 2020 23:00:52 +0200 Subject: [PATCH 10/33] Update ActionCommTest.php --- test/phpunit/ActionCommTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 0dd4946f69c..abebfd728bf 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -223,7 +223,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $result=$localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject->id; } From 3ea613896e253d3f3913498829735de49259386b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 May 2020 23:04:38 +0200 Subject: [PATCH 11/33] Update CommandeTest.php --- test/phpunit/CommandeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php index 990ef41f0b7..1decbe4e201 100644 --- a/test/phpunit/CommandeTest.php +++ b/test/phpunit/CommandeTest.php @@ -196,7 +196,7 @@ class CommandeTest extends PHPUnit\Framework\TestCase $result=$localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject; } From 2efe3d7da0335b2b400603e6a8b2c2dafc004775 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Thu, 21 May 2020 09:31:06 +0200 Subject: [PATCH 12/33] Fix not wokring default values for date (re...) --- htdocs/compta/facture/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab2262844bf..522d4471daa 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1025,7 +1025,7 @@ if (empty($reshook)) // Replacement invoice if ($_POST['type'] == Facture::TYPE_REPLACEMENT) { - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1086,7 +1086,7 @@ if (empty($reshook)) $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1269,7 +1269,7 @@ if (empty($reshook)) // Standard invoice or Deposit invoice, created from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec', 'int') > 0) { - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1320,7 +1320,7 @@ if (empty($reshook)) $action = 'create'; } - $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $dateinvoice = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($dateinvoice)) { $error++; @@ -1745,7 +1745,7 @@ if (empty($reshook)) // Situation invoices if (GETPOST('type') == Facture::TYPE_SITUATION && (!empty($_POST['situations']))) { - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) { $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); From 44ffb8dbf7e5101ee8c812d812fd3ccd57686c1f Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Thu, 21 May 2020 09:34:20 +0200 Subject: [PATCH 13/33] Fix not working default value (re...) --- htdocs/fourn/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6e8f259bc01..91d1b333e56 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -644,7 +644,7 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); // Replacement invoice @@ -1758,7 +1758,7 @@ if ($action == 'create') if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - $datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datedue = ($datetmp == '' ?-1 : $datetmp); @@ -1772,7 +1772,7 @@ if ($action == 'create') $cond_reglement_id = $societe->cond_reglement_supplier_id; $mode_reglement_id = $societe->mode_reglement_supplier_id; $fk_account = $societe->fk_account; - $datetmp = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datedue = ($datetmp == '' ?-1 : $datetmp); From e6a5d4c8d92d0a72588ee0a8549845616f145ab5 Mon Sep 17 00:00:00 2001 From: Birame SENE Date: Thu, 21 May 2020 17:01:27 +0200 Subject: [PATCH 14/33] Add PNG/JPEG packages to build GD extension --- build/docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 4b1df7e0876..9264eed5ef2 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -3,7 +3,7 @@ FROM php:7.2-apache ENV HOST_USER_ID 33 ENV PHP_INI_DATE_TIMEZONE 'UTC' -RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\ +RUN apt-get update && apt-get install -y libpng16-16 libpng-dev libjpeg62-turbo libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++\ && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install gd \ @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev lib && docker-php-ext-install calendar \ && docker-php-ext-configure intl \ && docker-php-ext-install intl \ - && apt-get autoremove --purge -y libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++ + && apt-get autoremove --purge -y libpng-dev libjpeg62-turbo-dev libldap2-dev zlib1g-dev libicu-dev g++ RUN mkdir /var/documents RUN chown www-data /var/documents From d9a2d2b982613e5a52beb29d949f26931abad44d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 22 May 2020 08:00:26 +0200 Subject: [PATCH 15/33] fix not working default values for payment --- htdocs/fourn/facture/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6e8f259bc01..ae6af7bf99b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1780,6 +1780,18 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } + // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($cond_reglement_id)) + { + $cond_reglement_id = GETPOST("cond_reglement_id"); + } + + // when payment mode is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($mode_reglement_id)) + { + $mode_reglement_id = GETPOST("mode_reglement_id"); + } + print '
'; print ''; print ''; From 53080be2453eb2c6815d809e344c1e5191f070d3 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 22 May 2020 08:01:29 +0200 Subject: [PATCH 16/33] fix not working default values for payment --- htdocs/compta/facture/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab2262844bf..3b36950447f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2907,6 +2907,18 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } + // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value + if(empty($cond_reglement_id)) + { + $cond_reglement_id = GETPOST("cond_reglement_id"); + } + + // when payment mode is empty (means not override by payment mode form a other object, like third-party), try to use default value + if(empty($mode_reglement_id)) + { + $mode_reglement_id = GETPOST("mode_reglement_id"); + } + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); From 2873f4dacfe3a0bdf0c7e91281bb73a40b4f2ce4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 May 2020 06:08:12 +0000 Subject: [PATCH 17/33] Fixing style errors. --- htdocs/compta/facture/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3b36950447f..038120151e3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2918,7 +2918,7 @@ if ($action == 'create') { $mode_reglement_id = GETPOST("mode_reglement_id"); } - + if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTURE_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ae6af7bf99b..05cb43fceb8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1791,7 +1791,7 @@ if ($action == 'create') { $mode_reglement_id = GETPOST("mode_reglement_id"); } - + print ''; print ''; print ''; From e349b9323f04db2ee0fda7d73fe8fea41abf4106 Mon Sep 17 00:00:00 2001 From: "gael.langlais" Date: Fri, 22 May 2020 17:42:06 +0200 Subject: [PATCH 18/33] Change some curly braces #13929 --- htdocs/contact/list.php | 11 +++++------ htdocs/core/antispamimage.php | 2 +- htdocs/core/class/lessc.class.php | 6 +++--- htdocs/core/lib/security2.lib.php | 16 ++++++++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9e7485d189f..7eee6d797e7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = GETPOST("search_".$key, 'alpha'); + $search_[$key] = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = ""; + $search_[$key] = ""; } } } @@ -357,9 +357,8 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_{$key})) { - //$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key}); - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; + if ($value['active'] && strlen($search_[$key])) { + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; } } } @@ -669,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 68e585c3ea0..7d6512a64a9 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -43,7 +43,7 @@ $number = strlen($letters); $string = ''; for ($i = 0; $i < $length; $i++) { - $string .= $letters{mt_rand(0, $number - 1)}; + $string .= $letters[mt_rand(0, $number - 1)]; } //print $string; diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 210c3d3c29d..8ab9e58aa58 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -1966,7 +1966,7 @@ class Lessc { $this->pushEnv(); $parser = new lessc_parser($this, __METHOD__); foreach ($args as $name => $strValue) { - if ($name{0} !== '@') { + if ($name[0] !== '@') { $name = '@'.$name; } $parser->count = 0; @@ -2638,7 +2638,7 @@ class lessc_parser { $hidden = true; if (!isset($block->args)) { foreach ($block->tags as $tag) { - if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { + if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { $hidden = false; break; } @@ -2692,7 +2692,7 @@ class lessc_parser { protected function fixTags($tags) { // move @ tags out of variable namespace foreach ($tags as &$tag) { - if ($tag{0} == $this->lessc->vPrefix) + if ($tag[0] == $this->lessc->vPrefix) $tag[0] = $this->lessc->mPrefix; } return $tags; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 04d16084365..c7f5a7b7330 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -463,15 +463,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{random_int(0, $max)}; + $randomCode .= $lowercase[random_int(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{random_int(0, $max)}; + $randomCode .= $uppercase[random_int(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{random_int(0, $max)}; + $randomCode .= $numbers[random_int(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -480,15 +480,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{mt_rand(0, $max)}; + $randomCode .= $lowercase[mt_rand(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{mt_rand(0, $max)}; + $randomCode .= $uppercase[mt_rand(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{mt_rand(0, $max)}; + $randomCode .= $numbers[mt_rand(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -512,11 +512,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $max = strlen($numbers) - 1; if (function_exists('random_int')) // Cryptographic random { - $generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[random_int(0, $max)], $generated_password); } else { - $generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[mt_rand(0, $max)], $generated_password); } } From dce93197d7535a3290d0562b453934120410cfd7 Mon Sep 17 00:00:00 2001 From: "gael.langlais" Date: Fri, 22 May 2020 17:58:24 +0200 Subject: [PATCH 19/33] FIX #13908 keep child label if modified by user --- .../variants/class/ProductCombination.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index f19c81960db..c3cb5f77a5f 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -326,11 +326,16 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); - $child->price_autogen = $parent->price_autogen; - $child->weight = $parent->weight + $this->variation_weight; - $child->weight_units = $parent->weight_units; - $varlabel = $this->getCombinationLabel($this->fk_product_child); - $child->label = $parent->label.$varlabel; + $child->price_autogen = $parent->price_autogen; + $child->weight = $parent->weight + $this->variation_weight; + $child->weight_units = $parent->weight_units; + + // Don't update the child label if the user modified it. + if ($child->label == $parent->label) { + // This will trigger only at variant creation time + $varlabel = $this->getCombinationLabel($this->fk_product_child); + $child->label = $parent->label.$varlabel;; + } if ($child->update($child->id, $user) > 0) { $new_vat = $parent->tva_tx; From c460cff01c63df7ab8af295d109917195adc6bc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 01:17:01 +0200 Subject: [PATCH 20/33] Fix calculation and add tooltip to understand it. --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 11 ++++++++++- htdocs/langs/en_US/mrp.lang | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 48e9c9d965a..c98dee97f51 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -523,7 +523,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - print ''.$langs->trans("TotalCost").''.price($object->total_cost).''; + print ''.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).''; print ''.$langs->trans("UnitCost").''.price($object->unit_cost).''; // Other attributes diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 3e522b3c11f..86e0b84b655 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1013,11 +1013,20 @@ class BOM extends CommonObject $this->unit_cost = 0; $this->total_cost = 0; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $productFournisseur = new ProductFournisseur($this->db); + foreach ($this->lines as &$line) { $tmpproduct = new Product($this->db); $tmpproduct->fetch($line->fk_product); + $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp); + if (empty($line->unit_cost)) { + if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) + { + $line->unit_cost = $productFournisseur->fourn_unitprice; + } + } - $line->unit_cost = (!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp; // TODO : add option to work with cost_price or pmp $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT'); $this->total_cost += $line->total_cost; } diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index d3c4d3253c6..faa8eb60cf4 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -74,3 +74,4 @@ ProductsToConsume=Products to consume ProductsToProduce=Products to produce UnitCost=Unit cost TotalCost=Total cost +BOMTotalCost=The cost to produce this BOM based on cost of each quantity and product to consume (use Cost price if defined, else Average Weighted Price if defined, else the Best purchase price) \ No newline at end of file From 0bf6b26117a631ee6843e3b2911bad1929743c37 Mon Sep 17 00:00:00 2001 From: Laurent De Coninck Date: Sat, 23 May 2020 12:20:56 +0200 Subject: [PATCH 21/33] add a mail server --- build/docker/docker-compose.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml index 3fe6125a874..cc839810e7f 100644 --- a/build/docker/docker-compose.yml +++ b/build/docker/docker-compose.yml @@ -21,5 +21,12 @@ web: - ../../htdocs:/var/www/html links: - mariadb + - mail ports: - "80:80" + +mail: + image: maildev/maildev + ports: + - "8081:80" + - "25:25" \ No newline at end of file From f2c02f5559b931b2288929f4bd1686114c791aed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 12:41:06 +0200 Subject: [PATCH 22/33] FIX Language for RSS --- htdocs/core/lib/xcal.lib.php | 7 +++++-- htdocs/website/samples/wrapper.php | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 440f1147cbf..3d8120a6d29 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -334,9 +334,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) * @param string $outputfile Output file * @param string $filter (optional) Filter * @param string $url Url (If empty, forge URL for agenda RSS export) + * @param string $langcode Language code to show in header * @return int < 0 if ko, Nb of events in file if ok */ -function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '') +function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '', $langcode = '') { global $user, $conf, $langs; global $dolibarr_main_url_root; @@ -362,7 +363,9 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fwrite($fichier, ''); fwrite($fichier, "\n"); - fwrite($fichier, "\n".$title."\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "".$title."\n"); + if ($langcode) fwrite($fichier, "".$langcode."\n"); /* fwrite($fichier, ""."\n". diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 25483a36f53..bb761c5f894 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -12,6 +12,7 @@ $hashp = GETPOST('hashp', 'aZ09'); $modulepart = GETPOST('modulepart', 'aZ09'); $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; $original_file = GETPOST("file", "alpha"); +$l = GETPOST('l', 'aZ09'); // Parameters for RSS $rss = GETPOST('rss', 'aZ09'); @@ -90,8 +91,8 @@ if ($rss) { $type = ''; $cachedelay = 0; $filename = $original_file; - $filters = array('type_container'=>'blogpost', 'lang'=>'en_US'); $dir_temp = $conf->website->dir_temp; + include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; $website = new Website($db); @@ -99,6 +100,9 @@ if ($rss) { $website->fetch('', $websitekey); + $filters = array('type_container'=>'blogpost'); + if ($l) $filters['lang'] = $l; + $MAXNEWS = 20; $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); $eventarray = array(); @@ -151,7 +155,7 @@ if ($rss) { @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); // Write file - $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'); + $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l); if ($result >= 0) { From e947ddba10be56526118e82ebae5f19f5a4b20ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 12:51:44 +0200 Subject: [PATCH 23/33] Fix RSS feed --- htdocs/website/index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 8a6aa296efb..06c072dc86d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2977,6 +2977,19 @@ if ($action == 'editcss') print ''; + // RSS + print ''; + //$htmlhelp = $langs->trans("Example").' :
'; + //$htmlhelp .= dol_htmlentitiesbr($manifestjsoncontentdefault); + $htmlhelp = ''; + print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, 'rsstooltip'); + print ''; + //print $langs->trans("RSS").': '.$form->selectyesno('WEBSITE_ENBALE_RSS', $website->use_rss, 1).'
'; + //$doleditor = new DolEditor('WEBSITE_ENBALE_RSS', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + //print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text'); + print '/wrapper.php?rss=1[&lang=XX]'; + print ''; + print ''; dol_fiche_end(); From 50d063256e7171363892dd77411d89be7954e782 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 12:54:06 +0200 Subject: [PATCH 24/33] NEW Povide a RSS Feed for blogposts --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 06c072dc86d..7cd0660cdb1 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2987,7 +2987,7 @@ if ($action == 'editcss') //print $langs->trans("RSS").': '.$form->selectyesno('WEBSITE_ENBALE_RSS', $website->use_rss, 1).'
'; //$doleditor = new DolEditor('WEBSITE_ENBALE_RSS', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); //print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text'); - print '/wrapper.php?rss=1[&lang=XX]'; + print '/wrapper.php?rss=1[&l=XX]'; print ''; print ''; From aff2872fc11453f8d635a681f251dfdca4e1ca7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 12:57:58 +0200 Subject: [PATCH 25/33] Fix RSS --- htdocs/langs/en_US/website.lang | 4 +++- htdocs/website/index.php | 11 +++-------- htdocs/website/samples/wrapper.php | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 2c555b40c20..6109f3ca879 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -127,4 +127,6 @@ OtherLanguages=Other languages UseManifest=Provide a manifest.json file PublicAuthorAlias=Public author alias AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are defined into website properties -ReplacementDoneInXPages=Replacement done in %s pages or containers \ No newline at end of file +ReplacementDoneInXPages=Replacement done in %s pages or containers +RSSFeed=RSS Feed +RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL \ No newline at end of file diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7cd0660cdb1..b6d2404de6f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2979,15 +2979,10 @@ if ($action == 'editcss') // RSS print ''; - //$htmlhelp = $langs->trans("Example").' :
'; - //$htmlhelp .= dol_htmlentitiesbr($manifestjsoncontentdefault); - $htmlhelp = ''; - print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, 'rsstooltip'); + $htmlhelp = $langs->trans('RSSFeedDesc'); + print $form->textwithpicto($langs->trans('RSSFeed'), $htmlhelp, 1, 'help', '', 0, 2, ''); print ''; - //print $langs->trans("RSS").': '.$form->selectyesno('WEBSITE_ENBALE_RSS', $website->use_rss, 1).'
'; - //$doleditor = new DolEditor('WEBSITE_ENBALE_RSS', $manifestjsoncontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); - //print $doleditor->Create(1, '', true, $langs->trans("File").' manifest.json', 'text'); - print '/wrapper.php?rss=1[&l=XX]'; + print '/wrapper.php?rss=1[&l=XX][&limit=123]'; print ''; print ''; diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index bb761c5f894..abb2bea0179 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -13,6 +13,7 @@ $modulepart = GETPOST('modulepart', 'aZ09'); $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; $original_file = GETPOST("file", "alpha"); $l = GETPOST('l', 'aZ09'); +$limit = GETPOST('limit', 'int'); // Parameters for RSS $rss = GETPOST('rss', 'aZ09'); @@ -103,7 +104,7 @@ if ($rss) { $filters = array('type_container'=>'blogpost'); if ($l) $filters['lang'] = $l; - $MAXNEWS = 20; + $MAXNEWS = ($limit ? $limit : 20); $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); $eventarray = array(); if (is_array($arrayofblogs)) { From 755c47f900ef9583b18f6749d4022a067090158e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:10:33 +0200 Subject: [PATCH 26/33] Fix save of wrapper missing --- htdocs/core/lib/website2.lib.php | 54 +++++++++++++++++++------------- htdocs/website/index.php | 9 ++++-- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 33093fb953c..776c535d586 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -229,11 +229,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) /** - * Save content of the index.php and wrapper.php page + * Save content of the index.php and/or wrapper.php page * * @param string $pathofwebsite Path of website root * @param string $fileindex Full path of file index.php - * @param string $filetpl File tpl to index.php page redirect to + * @param string $filetpl File tpl the index.php page redirect to * @param string $filewrapper Full path of file wrapper.php * @return boolean True if OK */ @@ -246,29 +246,39 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper) dol_mkdir($pathofwebsite); - dol_delete_file($fileindex); - $indexcontent = ''."\n"; - $result1 = file_put_contents($fileindex, $indexcontent); - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + if ($fileindex) { + dol_delete_file($fileindex); + $indexcontent = ''."\n"; + + $result1 = file_put_contents($fileindex, $indexcontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($fileindex, octdec($conf->global->MAIN_UMASK)); + } + } + else { + $result1 = true; } - dol_delete_file($filewrapper); - $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); + if ($filewrapper) { + dol_delete_file($filewrapper); + $wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php'); - $result2 = file_put_contents($filewrapper, $wrappercontent); - if (!empty($conf->global->MAIN_UMASK)) { - @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); + $result2 = file_put_contents($filewrapper, $wrappercontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filewrapper, octdec($conf->global->MAIN_UMASK)); + } + } else { + $result2 = true; } return ($result1 && $result2); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b6d2404de6f..eefebd0e652 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -197,6 +197,7 @@ $fileindex = $pathofwebsite.'/index.php'; $filewrapper = $pathofwebsite.'/wrapper.php'; $filemanifestjson = $pathofwebsite.'/manifest.json.php'; $filereadme = $pathofwebsite.'/README.md'; +$filemaster = $pathofwebsite.'/master.inc.php'; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -1189,8 +1190,6 @@ if ($action == 'updatecss') if (!$error) { // Save master.inc.php file - $filemaster = $pathofwebsite.'/master.inc.php'; - dol_syslog("Save master file ".$filemaster); dol_mkdir($pathofwebsite); @@ -1384,6 +1383,10 @@ if ($action == 'updatecss') } + // Save wrapper.php + $result = dolSaveIndexPage($pathofwebsite, '', '', $filewrapper); + + // Message if no error if (!$error) { @@ -1727,8 +1730,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf } else { - $fileindex = $pathofwebsitenew.'/index.php'; $filetpl = $pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php'; + $fileindex = $pathofwebsitenew.'/index.php'; $filewrapper = $pathofwebsitenew.'/wrapper.php'; //var_dump($pathofwebsitenew); From 072d8c622297c87ac2f3bf1040908d8fab63d9f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:02 +0200 Subject: [PATCH 27/33] Update list.php --- htdocs/contact/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7eee6d797e7..8ee51ca815e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = GETPOST("search_".$key, 'alpha'); + $search_{$key} = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = ""; + $search_{$key} = ""; } } } @@ -358,7 +358,7 @@ if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && strlen($search_[$key])) { - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } } From 9e95342e2fcb7c254f97763f6502f16e1e740323 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:39 +0200 Subject: [PATCH 28/33] Update list.php --- htdocs/contact/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8ee51ca815e..781daacd030 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -357,7 +357,7 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_[$key])) { + if ($value['active'] && strlen($search_{$key})) { $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } @@ -668,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } From af5de05a31cdd5f6d204033f8b75a5d35361e0a1 Mon Sep 17 00:00:00 2001 From: "gael.langlais" Date: Fri, 22 May 2020 17:42:06 +0200 Subject: [PATCH 29/33] Change some curly braces #13929 --- htdocs/contact/list.php | 11 +++++------ htdocs/core/antispamimage.php | 2 +- htdocs/core/class/lessc.class.php | 6 +++--- htdocs/core/lib/security2.lib.php | 16 ++++++++-------- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9e7485d189f..7eee6d797e7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = GETPOST("search_".$key, 'alpha'); + $search_[$key] = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_{$key} = ""; + $search_[$key] = ""; } } } @@ -357,9 +357,8 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_{$key})) { - //$sql.= natural_search("p.socialnetworks->'$.".$key."'", $search_{$key}); - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; + if ($value['active'] && strlen($search_[$key])) { + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; } } } @@ -669,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 68e585c3ea0..7d6512a64a9 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -43,7 +43,7 @@ $number = strlen($letters); $string = ''; for ($i = 0; $i < $length; $i++) { - $string .= $letters{mt_rand(0, $number - 1)}; + $string .= $letters[mt_rand(0, $number - 1)]; } //print $string; diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 210c3d3c29d..8ab9e58aa58 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -1966,7 +1966,7 @@ class Lessc { $this->pushEnv(); $parser = new lessc_parser($this, __METHOD__); foreach ($args as $name => $strValue) { - if ($name{0} !== '@') { + if ($name[0] !== '@') { $name = '@'.$name; } $parser->count = 0; @@ -2638,7 +2638,7 @@ class lessc_parser { $hidden = true; if (!isset($block->args)) { foreach ($block->tags as $tag) { - if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { + if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) { $hidden = false; break; } @@ -2692,7 +2692,7 @@ class lessc_parser { protected function fixTags($tags) { // move @ tags out of variable namespace foreach ($tags as &$tag) { - if ($tag{0} == $this->lessc->vPrefix) + if ($tag[0] == $this->lessc->vPrefix) $tag[0] = $this->lessc->mPrefix; } return $tags; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 04d16084365..c7f5a7b7330 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -463,15 +463,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{random_int(0, $max)}; + $randomCode .= $lowercase[random_int(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{random_int(0, $max)}; + $randomCode .= $uppercase[random_int(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{random_int(0, $max)}; + $randomCode .= $numbers[random_int(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -480,15 +480,15 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $lowercase{mt_rand(0, $max)}; + $randomCode .= $lowercase[mt_rand(0, $max)]; } $max = strlen($uppercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { - $randomCode .= $uppercase{mt_rand(0, $max)}; + $randomCode .= $uppercase[mt_rand(0, $max)]; } $max = strlen($numbers) - 1; for ($x = 0; $x < $nbofcharlast; $x++) { - $randomCode .= $numbers{mt_rand(0, $max)}; + $randomCode .= $numbers[mt_rand(0, $max)]; } $generated_password = str_shuffle($randomCode); @@ -512,11 +512,11 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $max = strlen($numbers) - 1; if (function_exists('random_int')) // Cryptographic random { - $generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[random_int(0, $max)], $generated_password); } else { - $generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); + $generated_password = str_replace($replaceambiguouschars, $numbers[mt_rand(0, $max)], $generated_password); } } From 15de6194c4b61c3b73f30aab91aca5680eea0e10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:02 +0200 Subject: [PATCH 30/33] Update list.php --- htdocs/contact/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7eee6d797e7..8ee51ca815e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_no_email = GETPOST("search_no_email", 'int'); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = GETPOST("search_".$key, 'alpha'); + $search_{$key} = GETPOST("search_".$key, 'alpha'); } } } @@ -253,7 +253,7 @@ if (empty($reshook)) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { - $search_[$key] = ""; + $search_{$key} = ""; } } } @@ -358,7 +358,7 @@ if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax) if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active'] && strlen($search_[$key])) { - $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_[$key].'%\''; + $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } } From 493becde8b06a830a5dba611dea008058a16cdb5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:36:39 +0200 Subject: [PATCH 31/33] Update list.php --- htdocs/contact/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 8ee51ca815e..781daacd030 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -357,7 +357,7 @@ if (strlen($search_phone_mobile)) $sql .= natural_search('p.phone_mobile', $se if (strlen($search_fax)) $sql .= natural_search('p.fax', $search_fax); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if ($value['active'] && strlen($search_[$key])) { + if ($value['active'] && strlen($search_{$key})) { $sql .= ' AND p.socialnetworks LIKE \'%"'.$key.'":"'.$search_{$key}.'%\''; } } @@ -668,7 +668,7 @@ if (!empty($conf->socialnetworks->enabled)) { if (!empty($arrayfields['p.'.$key]['checked'])) { print ''; - print ''; + print ''; print ''; } } From 83ecbef9bc3ec4449262b4b6b8e8ae7371e11617 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 13:46:37 +0200 Subject: [PATCH 32/33] FIX #13911 #13940 --- htdocs/variants/class/ProductCombination.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index f19c81960db..128c1974c77 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -327,7 +327,10 @@ class ProductCombination $child = new Product($this->db); $child->fetch($this->fk_product_child); $child->price_autogen = $parent->price_autogen; - $child->weight = $parent->weight + $this->variation_weight; + $child->weight = $parent->weight; + if ($this->variation_weight) { // If we must add a delta on weight + $child->weight = ($child->weight ? $child->weight : 0) + $this->variation_weight; + } $child->weight_units = $parent->weight_units; $varlabel = $this->getCombinationLabel($this->fk_product_child); $child->label = $parent->label.$varlabel; From 7397806ae770b6a03ce030711a11341fc0d3b554 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 May 2020 14:26:28 +0200 Subject: [PATCH 33/33] Update actioncomm.class.php --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index dadc180ce08..f3ec464e7c0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2048,7 +2048,7 @@ class ActionComm extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm "; - $sql .= " SET percent = '".$percent."'"; + $sql .= " SET percent = ".(int) $percent; $sql .= " WHERE id=".$id; if ($this->db->query($sql))