From 444e2f1130c6ca54ee47f13943ce9a9333e30a4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 14:01:12 +0100 Subject: [PATCH 01/17] Fix length of column --- htdocs/core/lib/company.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 8f658d850fe..fdb9f2f233d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1620,7 +1620,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $caction = new CActionComm($db); $arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); - foreach ($histo as $key=>$value) + foreach ($histo as $key => $value) { $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo @@ -1729,7 +1729,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin else $out .= ' '; $out .= ''; - // Contact pour cette action + // Contact(s) for action if (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) { $contactstatic->lastname = $histo[$key]['lastname']; @@ -1738,15 +1738,15 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $out .= ''.$contactstatic->getNomUrl(1, '', 10).''; } elseif (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) { $out .= ''; - foreach ($histo[$key]['socpeopleassigned'] as $cid => $Tab) { - $contact = new Contact($db); + $contact = new Contact($db); + foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) { $result = $contact->fetch($cid); if ($result < 0) dol_print_error($db, $contact->error); if ($result > 0) { - $out .= $contact->getNomUrl(1); + $out .= $contact->getNomUrl(1, '', 16); if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') { if (!empty($contact->phone_pro)) $out .= '('.dol_print_phone($contact->phone_pro).')'; From 192de503bb69d74b5df35faa147ae03e4e71cd8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 13:54:13 +0100 Subject: [PATCH 02/17] Modulebuilder template --- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 5beec62cac2..d8374fca245 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -251,7 +251,7 @@ if ($object->id > 0) $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } } From f4d7958ead3402404926146e6d90d5b700d91e19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 14:14:47 +0100 Subject: [PATCH 03/17] Fix duplicate record in list of events for projects --- htdocs/core/lib/company.lib.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index fdb9f2f233d..1316bb0db73 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1328,7 +1328,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " a.fk_contact,"; $sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; $sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; - if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= ", sp.lastname, sp.firstname"; + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) $sql .= ", sp.lastname, sp.firstname"; + elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ } + elseif (is_object($filterobj) && get_class($filterobj) == 'Project') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", m.lastname, m.firstname"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", o.ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", o.ref"; @@ -1348,13 +1350,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".$objcon->id; } - if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; $sql .= " ON er.resource_type = 'dolresource'"; $sql .= " AND er.element_id = a.id"; $sql .= " AND er.resource_id = ".$filterobj->id; } + elseif (is_object($filterobj) && get_class($filterobj) == 'Project') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql .= ", ".MAIN_DB_PREFIX."adherent as m"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql .= ", ".MAIN_DB_PREFIX."product as o"; @@ -1366,6 +1369,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; if ($force_filter_contact === false) { if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql .= " AND a.fk_soc = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql .= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { From e3c56cea5fbc8f3ebb753b23cd868bf25e1e3abd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 14:19:41 +0100 Subject: [PATCH 04/17] Fix missing lang --- htdocs/langs/en_US/errors.lang | 1 + htdocs/takepos/takepos.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index db7fa8330bf..dc63f12511a 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -224,6 +224,7 @@ ErrorObjectMustHaveStatusActiveToBeDisabled=Objects must have status 'Active' to ErrorObjectMustHaveStatusDraftOrDisabledToBeActivated=Objects must have status 'Draft' or 'Disabled' to be enabled ErrorNoFieldWithAttributeShowoncombobox=No fields has property 'showoncombobox' into definition of object '%s'. No way to show the combolist. ErrorFieldRequiredForProduct=Field '%s' is required for product %s +ProblemIsInSetupOfTerminal=Problem is in setup of terminal %s. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 4662681217e..78ead8ff9c5 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -683,7 +683,7 @@ if ($resql) { if (empty($paiementsModes)) { $langs->load('errors'); setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); - setEventMessages($langs->trans("ProblemIsInSetupOfTerminal").' '.$_SESSION["takeposterminal"], null, 'errors'); + setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); } if (count($maincategories) == 0) { setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors'); From 0e2edde6d3de8c3fe28a33b467b221b79e4132e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 14:25:58 +0100 Subject: [PATCH 05/17] Look and feel v11 --- htdocs/core/lib/project.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index b593a4bc0a0..b050b560197 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1072,7 +1072,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if ($projectstatic->title) { print ' - '; - print $projectstatic->title; + print ''.$projectstatic->title.''; } /* $colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); @@ -1451,7 +1451,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if ($projectstatic->title) { print ' - '; - print $projectstatic->title; + print ''.$projectstatic->title.''; } /*$colspan=5+(empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:2); From 9e6fb7b2f1d7b20feb3e1bec84f8925a16d97a9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 14:55:31 +0100 Subject: [PATCH 06/17] Look and feel v11 --- htdocs/admin/user.php | 3 --- htdocs/admin/usergroup.php | 4 ---- htdocs/user/card.php | 6 +++--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index d19e5d6fe92..56602502715 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -297,10 +297,7 @@ foreach ($dirmodels as $reldir) } $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 270d7dd6653..43910bedb56 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -34,7 +34,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "members", "users")); - if (!$user->admin) accessforbidden(); $extrafields = new ExtraFields($db); @@ -244,10 +243,7 @@ foreach ($dirmodels as $reldir) } $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1); - $htmltooltip .= '
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1); $htmltooltip .= '
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1); - $htmltooltip .= '
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 609aa11abb9..a438dfea8de 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2581,7 +2581,7 @@ else if ($conf->accounting->enabled) { print ""; - print ''.$langs->trans("AccountancyCode").''; + print ''.$langs->trans("AccountancyCode").''; print ''; if ($caneditfield) { @@ -2647,7 +2647,7 @@ else // Company / Contact if (!empty($conf->societe->enabled)) { - print ''.$langs->trans("LinkToCompanyContact").''; + print ''.$langs->trans("LinkToCompanyContact").''; print ''; if ($object->socid > 0) { @@ -2674,7 +2674,7 @@ else if (!empty($conf->adherent->enabled)) { $langs->load("members"); - print ''.$langs->trans("LinkedToDolibarrMember").''; + print ''.$langs->trans("LinkedToDolibarrMember").''; print ''; if ($object->fk_member) { From ecdd43f7707351f3655e99aff2a2581e19cdf709 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 16:22:58 +0100 Subject: [PATCH 07/17] Fix: If signature is zipped, we must unzip it first --- htdocs/admin/system/filecheck.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 9a530262b6e..5ee4741709c 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -127,6 +127,18 @@ if (GETPOST('target') == 'local') { if (dol_is_file($xmlfile)) { + // If file is a zip file (.../filelist-x.y.z.xml.zip), we uncompress it before + if (preg_match('/\.zip$/i', $xmlfile)) { + dol_mkdir($conf->admin->dir_temp); + $xmlfilenew = preg_replace('/\.zip$/i', '', $xmlfile); + $result = dol_uncompress($xmlfile, $conf->admin->dir_temp); + if (empty($result['error'])) { + $xmlfile = $conf->admin->dir_temp.'/'.basename($xmlfilenew); + } else { + print $langs->trans('FailedToUncompressFile').': '.$xmlfile; + $error++; + } + } $xml = simplexml_load_file($xmlfile); } else From b9a7401f1d2c23374b93c6ce01f22987bf7fc2e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 16:29:37 +0100 Subject: [PATCH 08/17] Doc --- .../interface_50_modBlockedlog_ActionsBlockedLog.class.php | 4 ++-- .../triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index aa9f358bb92..c26e2b7e26b 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; class InterfaceActionsBlockedLog extends DolibarrTriggers { public $family = 'system'; - public $description = "Triggers of this module add action for BlockedLog module."; + public $description = "Triggers of this module add action for BlockedLog module (Module of unalterable logs)."; /** * Version of the trigger @@ -45,7 +45,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers public $picto = 'technic'; /** - * Function called on Dolibarrr payment or invoice event. + * Function called on Dolibarr payment or invoice event. * * @param string $action Event action code * @param Object $object Object diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 75343c84f3f..55fe4d34d4c 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -46,7 +46,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = "ticket"; - $this->description = "Triggers of the module ticket"; + $this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties"; $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version $this->picto = 'ticket'; } From a2be1891e6bb7ffc1de5a0892ca61cea261b5a27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 19:08:35 +0100 Subject: [PATCH 09/17] Finished MRP experimental module --- htdocs/mrp/class/mo.class.php | 68 ++++++++++++++++++-------- htdocs/mrp/mo_production.php | 92 +++++++++++++++++++++++++++-------- 2 files changed, 120 insertions(+), 40 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0f22e00de3c..658205a7c36 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -467,6 +467,55 @@ class Mo extends CommonObject } } + /** + * Get list of lines linked to current line for a defined role. + * + * @param string $role Get lines linked to current line with the selected role ('consumed', 'produced', ...) + * @param int $lineid Id of production line to filter childs + * @return array Array of lines + */ + public function fetchLinesLinked($role, $lineid = 0) + { + $resarray = array(); + $mostatic = new MoLine($this->db); + + $sql = 'SELECT '; + $sql .= $mostatic->getFieldList(); + $sql .= ' FROM '.MAIN_DB_PREFIX.$mostatic->table_element.' as t'; + $sql .= " WHERE t.role = '".$this->db->escape($role)."'"; + if ($lineid > 0) $sql .= ' AND t.fk_mrp_production = '.$lineid; + else $sql .= 'AND t.fk_mo = '.$this->id; + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i=0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + $resarray[] = array( + 'rowid'=> $obj->rowid, + 'qty' => $obj->qty, + 'role' => $obj->role, + 'fk_product' => $obj->fk_product, + 'fk_warehouse' => $obj->fk_warehouse, + 'batch' => $obj->batch, + 'fk_stock_movement' => $obj->fk_stock_movement + ); + } + + $i++; + } + + return $resarray; + } else { + $this->error = $this->db->lasterror(); + var_dump($this->error); + return array(); + } + } + /** * Update object into database * @@ -1458,25 +1507,6 @@ class MoLine extends CommonObjectLine } } - /** - * Get list of lines linked to current line for a defined role - * - * @param string $role Get lines linked to current line with the selected role ('consumed', 'produced', ...) - * @return array Array of lines - */ - public function fetchLinesLinked($role) - { - $array = array(); - - $sql = 'SELECT rowid, qty '; - $sql .= $this->getFieldList(); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; - else $sql .= ' WHERE 1 = 1'; - - return $array; - } - /** * Update object into database * diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 840e46c9c1c..9c588d927de 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -104,6 +104,7 @@ $upload_dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->enti $permissiontoproduce = $permissiontoadd; + /* * Actions */ @@ -152,6 +153,10 @@ if (empty($reshook)) $object->setProject(GETPOST('projectid', 'int')); } + if ($action == 'confirm_reopen') { + $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN'); + } + if ($action == 'confirm_consumeandproduceall') { $stockmove = new MouvementStock($db); @@ -169,8 +174,8 @@ if (empty($reshook)) $i=1; while (GETPOSTISSET('qty-'.$line->id.'-'.$i)) { // Check warehouse is set if we should have to - if (GETPOST('idwarehouse-'.$line->id.'-'.$i)) { - if (! (GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0)) { + if (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i)) { // If there is a warehouse to set + if (price2num(GETPOST('qty-'.$line->id.'-'.$i)) > 0 && ! (GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0)) { // If there is a quantity to dispatch and warehouse not set. $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); $error++; @@ -186,7 +191,8 @@ if (empty($reshook)) if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) { // Record stock movement $id_product_batch = 0; - $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + $stockmove->origin = $object; + $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), price2num(GETPOST('qty-'.$line->id.'-'.$i)), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); if ($idstockmove < 0) { $error++; setEventMessages($stockmove->error, $stockmove->errors, 'errors'); @@ -201,7 +207,7 @@ if (empty($reshook)) $moline->position = $pos; $moline->fk_product = $line->fk_product; $moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i); - $moline->qty = GETPOST('qty-'.$line->id.'-'.$i); + $moline->qty = price2num(GETPOST('qty-'.$line->id.'-'.$i)); $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); $moline->role = 'consumed'; $moline->fk_mrp_production = $line->id; @@ -231,8 +237,8 @@ if (empty($reshook)) $i=1; while (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) { // Check warehouse is set if we should have to - if (GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i)) { - if (! (GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0)) { + if (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i)) { // If there is a warehouse to set + if (price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)) > 0 && ! (GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0)) { // If there is a quantity to dispatch and warehouse not set. $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); $error++; @@ -248,7 +254,8 @@ if (empty($reshook)) if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { // Record stock movement $id_product_batch = 0; - $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), GETPOST('qtytoproduce-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + $stockmove->origin = $object; + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); if ($idstockmove < 0) { $error++; setEventMessages($stockmove->error, $stockmove->errors, 'errors'); @@ -263,7 +270,7 @@ if (empty($reshook)) $moline->position = $pos; $moline->fk_product = $line->fk_product; $moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i); - $moline->qty = GETPOST('qtytoproduce-'.$line->id.'-'.$i); + $moline->qty = price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)); $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); $moline->role = 'produced'; $moline->fk_mrp_production = $line->id; @@ -285,13 +292,47 @@ if (empty($reshook)) } if (! $error) { + $consumptioncomplete = true; + $productioncomplete = true; + + if (GETPOST('autoclose', 'int')) { + foreach($object->lines as $line) { + if ($line->role == 'toconsume') { + $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); + $alreadyconsumed = 0; + foreach($arrayoflines as $line2) { + $alreadyconsumed += $line2['qty']; + } + + if ($alreadyconsumed < $line->qty) { + $consumptioncomplete = false; + } + } + if ($line->role == 'toproduce') { + $arrayoflines = $object->fetchLinesLinked('produced', $line->id); + $alreadyproduced = 0; + foreach($arrayoflines as $line2) { + $alreadyproduced += $line2['qty']; + } + + if ($alreadyproduced < $line->qty) { + $productioncomplete = false; + } + } + } + } + else { + $consumptioncomplete = false; + $productioncomplete = false; + } + // Update status of MO - $qtyremaintoconsume = 0; - $qtyremaintoproduce = 0; - if ($qtyremaintoconsume == 0 && $qtyremaintoproduce == 0) { - $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED'); - } else { + dol_syslog("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + //var_dump("consumptioncomplete = ".$consumptioncomplete." productioncomplete = ".$productioncomplete); + if ($consumptioncomplete && $productioncomplete) { $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); + } else { + $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED'); } if ($result <= 0) { $error++; @@ -479,7 +520,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { print ''.$langs->trans('Consume').''; } - } else { + } elseif ($object->status == Mo::STATUS_DRAFT) { print ''.$langs->trans('Consume').''; } @@ -490,7 +531,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { print ''.$langs->trans('Produce').''; } - } else { + } elseif ($object->status == Mo::STATUS_DRAFT) { print ''.$langs->trans('Produce').''; } @@ -501,9 +542,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { print ''.$langs->trans('ConsumeAndProduceAll').''; } - } else { + } elseif ($object->status == Mo::STATUS_DRAFT) { print ''.$langs->trans('ConsumeAndProduceAll').''; } + + // Reopen + if ($object->status == Mo::STATUS_PRODUCED) { + if ($permissiontoproduce) { + print ''.$langs->trans('ReOpen').''; + } else { + print ''.$langs->trans('ReOpen').''; + } + } } print ''; @@ -585,10 +635,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); - $arrayoflines = $line->fetchLinesLinked('consumed'); + $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; foreach($arrayoflines as $line2) { - $alreadyconsumed += $line2->qty; + $alreadyconsumed += $line2['qty']; } print ''; @@ -612,7 +662,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Show detailed of already consumed with js code to collapse - //$arrayoflines = $line->fetchLinesLinked('consumed'); + //$arrayoflines = $object->fetchLinesLinked('consumed', $line->id); if ($action == 'consumeandproduceall') { $i = 1; @@ -697,10 +747,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); - $arrayoflines = $line->fetchLinesLinked('produced'); + $arrayoflines = $object->fetchLinesLinked('produced', $line->id); $alreadyproduced = 0; foreach($arrayoflines as $line2) { - $alreadyproduced += $line2->qty; + $alreadyproduced += $line2['qty']; } print ''; From 7ef3ee56bd96bf53fd8087ca32583cb1e195039d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 20:28:21 +0100 Subject: [PATCH 10/17] Fix MRP --- htdocs/comm/action/card.php | 1 + htdocs/core/lib/functions2.lib.php | 5 +++ htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/mrp.lang | 2 +- htdocs/mrp/mo_agenda.php | 2 +- htdocs/mrp/mo_production.php | 37 ++++++++++++++++--- .../stock/class/mouvementstock.class.php | 4 ++ htdocs/product/stock/movement_list.php | 10 ++--- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f7a9495c244..118ab6ededf 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1461,6 +1461,7 @@ if ($id > 0) print ''.$langs->trans("Priority").''; print ''; print ''; + // Object linked if (!empty($object->fk_element) && !empty($object->elementtype)) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e1603fce57d..2eebf38ad56 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1888,6 +1888,11 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $module='stock'; $myobject='inventory'; } + elseif ($objecttype == 'mo') { + $classpath = 'mrp/class'; + $module='mrp'; + $myobject='mo'; + } // Generic case for $classfile and $classname $classfile = strtolower($myobject); $classname = ucfirst($myobject); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ac411f56f3e..942d7eac20f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1013,3 +1013,4 @@ ContactDefault_supplier_proposal=Supplier Proposal ContactDefault_ticketsup=Ticket ContactAddedAutomatically=Contact added from contact thirdparty roles More=More +ShowDetails=Show details diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index e336dd2552d..6bec44d66e6 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -60,6 +60,6 @@ TheProductXIsAlreadyTheProductToProduce=The product to add is already the produc ForAQuantityOf1=For a quantity to produce of 1 ConfirmValidateMo=Are you sure you want to validate this Manufacturing Order? ConfirmProductionDesc=By clicking on '%s', you will validate the consumption and/or production for the quantities set. This will also update the stock and record stock movements. -ProductionForRefAndDate=Production %s - %s +ProductionForRef=Production of %s AutoCloseMO=Close automatically the Manufacturing Order if quantities to consume and to produce are reached NoStockChangeOnServices=No stock change on services \ No newline at end of file diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index ee2c9840a0d..203408ea79e 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -242,7 +242,7 @@ if ($object->id > 0) $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 9c588d927de..7284d764d6f 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -577,9 +577,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if ($action == 'consumeandproduceall') { - $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard')); + $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref; + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); print '
'; print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; @@ -654,8 +654,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; print ''.$alreadyconsumed.''; - print ''; - print ''; // Warehouse + print ''; // Warehouse + if ($alreadyconsumed) { + print ''; + if (empty($conf->use_javascript_ajax)) print 'id.'">'; + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); + if (empty($conf->use_javascript_ajax)) print ''; + } + print ''; if ($conf->productbatch->enabled) { print ''; // Lot } @@ -757,7 +770,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$tmpproduct->getNomUrl(1).''; print ''.$line->qty.''; print ''.$alreadyproduced.''; - print ''; // Warehouse + print ''; // Warehouse + if ($alreadyproduced) { + print ''; + if (empty($conf->use_javascript_ajax)) print 'id.'">'; + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expand'.$line->id.'"'); + if (empty($conf->use_javascript_ajax)) print ''; + } + print ''; if ($conf->productbatch->enabled) { print ''; // Lot } diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index c50d816f14f..55e7af367b7 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -941,6 +941,10 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $origin = new Project($this->db); break; + case 'mo': + require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; + $origin = new Mo($this->db); + break; default: if ($origintype) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index cfb0d6d0b9c..ebcc7968c60 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -674,9 +674,9 @@ if ($resql) } $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($id > 0) $param .= '&id='.$id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($id > 0) $param .= '&id='.urlencode($id); if ($search_movement) $param .= '&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param .= '&search_inventorycode='.urlencode($search_inventorycode); if ($search_type_mouvement) $param .= '&search_type_mouvement='.urlencode($search_type_mouvement); @@ -684,10 +684,8 @@ if ($resql) if ($search_product) $param .= '&search_product='.urlencode($search_product); if ($search_batch) $param .= '&search_batch='.urlencode($search_batch); if ($search_warehouse > 0) $param .= '&search_warehouse='.urlencode($search_warehouse); - if (!empty($sref)) $param .= '&sref='.urlencode($sref); // FIXME $sref is not defined - if (!empty($snom)) $param .= '&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param .= '&search_user='.urlencode($search_user); - if ($idproduct > 0) $param .= '&idproduct='.$idproduct; + if ($idproduct > 0) $param .= '&idproduct='.urlencode($idproduct); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From ec81474694e42134898e275916c31395c5437b9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 20:36:36 +0100 Subject: [PATCH 11/17] Fix form confirm for "one column" type. --- htdocs/core/class/html.form.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6b0950b4f8d..887a8fc8ec6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4129,6 +4129,7 @@ class Form } // Now add questions + $moreonecolumn = ''; $more .= '
'."\n"; foreach ($formquestion as $key => $input) { @@ -4202,13 +4203,14 @@ class Form elseif ($input['type'] == 'onecolumn') { - $more .= '
'; - $more .= $input['value']; - $more .= '
'."\n"; + $moreonecolumn .= '
'; + $moreonecolumn .= $input['value']; + $moreonecolumn .= '
'."\n"; } } } $more .= '
'."\n"; + $more .= $moreonecolumn; } // JQUI method dialog is broken with jmobile, we use standard HTML. From 622dc7e8d7592c40813a599037add3d29dddb56b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 22:01:55 +0100 Subject: [PATCH 12/17] Debug v11 --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/core/lib/company.lib.php | 6 +++--- htdocs/mrp/mo_production.php | 6 +++++- htdocs/product/stock/movement_list.php | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c249a6a7b5f..b3dab6d5703 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1800,7 +1800,7 @@ class Propal extends CommonObject $this->newref = $num; $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET ref = '".$num."',"; + $sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 1316bb0db73..f108c5cc04f 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1705,13 +1705,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Date $out .= ''; - $out .= dol_print_date($histo[$key]['datestart'], 'dayhour'); + $out .= dol_print_date($histo[$key]['datestart'], 'dayhour', 'tzuserrel'); if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) { $tmpa = dol_getdate($histo[$key]['datestart'], true); $tmpb = dol_getdate($histo[$key]['dateend'], true); - if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour'); - else $out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour'); + if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour', 'tzuserrel'); + else $out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour', 'tzuserrel'); } $late = 0; if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) $late = 1; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 7284d764d6f..5fc7d78c770 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -345,6 +345,10 @@ if (empty($reshook)) $db->rollback(); } else { $db->commit(); + + // Redirect to avoid to action done a second time if we make a back from browser + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; } } } @@ -585,7 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; print $langs->trans("MovementLabel").':   '; print $langs->trans("InventoryCode").':

'; - print ' '.$langs->trans("AutoCloseMO").'
'; + print '
'; print ''; print '   '; print ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ebcc7968c60..1c7862f10f0 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -750,6 +750,7 @@ if ($resql) } if (!empty($arrayfields['m.datem']['checked'])) { + // Date print ''; print ''; if (empty($conf->productbatch->enabled)) print ' '; @@ -1006,7 +1007,7 @@ if ($resql) if (!empty($arrayfields['m.datem']['checked'])) { // Date - print ''.dol_print_date($db->jdate($objp->datem), 'dayhour').''; + print ''.dol_print_date($db->jdate($objp->datem), 'dayhour', 'tzuserrel').''; } if (!empty($arrayfields['p.ref']['checked'])) { From 20c9035837b99a1a587c7ada283e35041cf588d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Jan 2020 22:17:40 +0100 Subject: [PATCH 13/17] Debug MRP --- .../install/mysql/migration/10.0.0-11.0.0.sql | 3 +- .../mysql/tables/llx_mrp_production.sql | 2 +- htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/mo_production.php | 186 +++++++++--------- 4 files changed, 101 insertions(+), 92 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 50014e2da05..24c62c040e4 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -537,7 +537,7 @@ CREATE TABLE llx_mrp_production( position integer NOT NULL DEFAULT 0, fk_product integer NOT NULL, fk_warehouse integer, - qty integer NOT NULL DEFAULT 1, + qty real NOT NULL DEFAULT 1, qty_frozen smallint DEFAULT 0, disable_stock_change smallint DEFAULT 0, batch varchar(30), @@ -550,6 +550,7 @@ CREATE TABLE llx_mrp_production( fk_user_modif integer, import_key varchar(14) ) ENGINE=innodb; +ALTER TABLE llx_mrp_production MODIFY COLUMN qty real NOT NULL DEFAULT 1; ALTER TABLE llx_mrp_production ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_mrp_production ADD COLUMN disable_stock_change smallint DEFAULT 0; diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index b05e261c65b..78b8847d9de 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -20,7 +20,7 @@ CREATE TABLE llx_mrp_production( position integer NOT NULL DEFAULT 0, fk_product integer NOT NULL, fk_warehouse integer, - qty integer NOT NULL DEFAULT 1, + qty real NOT NULL DEFAULT 1, qty_frozen smallint DEFAULT 0, disable_stock_change smallint DEFAULT 0, batch varchar(30), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 658205a7c36..e82d30bebc2 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1331,7 +1331,7 @@ class MoLine extends CommonObjectLine 'position' =>array('type'=>'integer', 'label'=>'Position', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), 'fk_product' =>array('type'=>'integer', 'label'=>'Fk product', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'fk_warehouse' =>array('type'=>'integer', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'qty' =>array('type'=>'integer', 'label'=>'Qty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), + 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), 'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'), 'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'), 'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>140), diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 5fc7d78c770..ba4a2ca9c3d 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -173,55 +173,59 @@ if (empty($reshook)) $i=1; while (GETPOSTISSET('qty-'.$line->id.'-'.$i)) { - // Check warehouse is set if we should have to - if (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i)) { // If there is a warehouse to set - if (price2num(GETPOST('qty-'.$line->id.'-'.$i)) > 0 && ! (GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0)) { // If there is a quantity to dispatch and warehouse not set. - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); - $error++; - } - if ($tmpproduct->status_batch && (! GETPOST('batch-'.$line->id.'-'.$i))) { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref), null, 'errors'); - $error++; - } - } + $qtytoprocess = price2num(GETPOST('qty-'.$line->id.'-'.$i)); - $idstockmove = 0; - if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) { - // Record stock movement - $id_product_batch = 0; - $stockmove->origin = $object; - $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), price2num(GETPOST('qty-'.$line->id.'-'.$i)), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($idstockmove < 0) { - $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); - } - } + if ($qtytoprocess != 0) { + // Check warehouse is set if we should have to + if (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i)) { // If there is a warehouse to set + if (! (GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0)) { // If there is no warehouse set. + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); + $error++; + } + if ($tmpproduct->status_batch && (! GETPOST('batch-'.$line->id.'-'.$i))) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref), null, 'errors'); + $error++; + } + } - if (! $error) { - $pos = 0; - // Record consumption - $moline = new MoLine($db); - $moline->fk_mo = $object->id; - $moline->position = $pos; - $moline->fk_product = $line->fk_product; - $moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i); - $moline->qty = price2num(GETPOST('qty-'.$line->id.'-'.$i)); - $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); - $moline->role = 'consumed'; - $moline->fk_mrp_production = $line->id; - $moline->fk_stock_movement = $idstockmove; - $moline->fk_user_creat = $user->id; + $idstockmove = 0; + if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $stockmove->origin = $object; + $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { + $error++; + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + } + } - $resultmoline = $moline->create($user); - if ($resultmoline <= 0) { - $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); - } + if (! $error) { + $pos = 0; + // Record consumption + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i); + $moline->qty = $qtytoprocess; + $moline->batch = GETPOST('batch-'.$line->id.'-'.$i); + $moline->role = 'consumed'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; - $pos++; - } + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { + $error++; + setEventMessages($moline->error, $moline->errors, 'errors'); + } + + $pos++; + } + } $i++; } @@ -236,54 +240,58 @@ if (empty($reshook)) $i=1; while (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i)) { - // Check warehouse is set if we should have to - if (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i)) { // If there is a warehouse to set - if (price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)) > 0 && ! (GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0)) { // If there is a quantity to dispatch and warehouse not set. - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); - $error++; - } - if ($tmpproduct->status_batch && (! GETPOST('batchtoproduce-'.$line->id.'-'.$i))) { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref), null, 'errors'); - $error++; - } - } + $qtytoprocess = price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)); - $idstockmove = 0; - if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { - // Record stock movement - $id_product_batch = 0; - $stockmove->origin = $object; - $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); - if ($idstockmove < 0) { - $error++; - setEventMessages($stockmove->error, $stockmove->errors, 'errors'); - } - } + if ($qtytoprocess != 0) { + // Check warehouse is set if we should have to + if (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i)) { // If there is a warehouse to set + if (! (GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0)) { // If there is no warehouse set. + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Warehouse"), $tmpproduct->ref), null, 'errors'); + $error++; + } + if ($tmpproduct->status_batch && (! GETPOST('batchtoproduce-'.$line->id.'-'.$i))) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequiredForProduct", $langs->transnoentitiesnoconv("Batch"), $tmpproduct->ref), null, 'errors'); + $error++; + } + } - if (! $error) { - $pos = 0; - // Record production - $moline = new MoLine($db); - $moline->fk_mo = $object->id; - $moline->position = $pos; - $moline->fk_product = $line->fk_product; - $moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i); - $moline->qty = price2num(GETPOST('qtytoproduce-'.$line->id.'-'.$i)); - $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); - $moline->role = 'produced'; - $moline->fk_mrp_production = $line->id; - $moline->fk_stock_movement = $idstockmove; - $moline->fk_user_creat = $user->id; + $idstockmove = 0; + if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) { + // Record stock movement + $id_product_batch = 0; + $stockmove->origin = $object; + $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), $qtytoprocess, 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement); + if ($idstockmove < 0) { + $error++; + setEventMessages($stockmove->error, $stockmove->errors, 'errors'); + } + } - $resultmoline = $moline->create($user); - if ($resultmoline <= 0) { - $error++; - setEventMessages($moline->error, $moline->errors, 'errors'); - } + if (! $error) { + $pos = 0; + // Record production + $moline = new MoLine($db); + $moline->fk_mo = $object->id; + $moline->position = $pos; + $moline->fk_product = $line->fk_product; + $moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i); + $moline->qty = $qtytoprocess; + $moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i); + $moline->role = 'produced'; + $moline->fk_mrp_production = $line->id; + $moline->fk_stock_movement = $idstockmove; + $moline->fk_user_creat = $user->id; - $pos++; + $resultmoline = $moline->create($user); + if ($resultmoline <= 0) { + $error++; + setEventMessages($moline->error, $moline->errors, 'errors'); + } + + $pos++; + } } $i++; From 14e92bd0beefc95ba82fc5557799ef0924387f0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 02:39:25 +0100 Subject: [PATCH 14/17] css --- htdocs/mrp/class/mo.class.php | 4 ++-- htdocs/projet/activity/perweek.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index e82d30bebc2..be784dbf5ad 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1048,8 +1048,8 @@ class Mo extends CommonObject $statusType = 'status'.$status; if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; if ($status == self::STATUS_INPROGRESS) $statusType = 'status3'; - if ($status == self::STATUS_PRODUCED) $statusType = 'status5'; - if ($status == self::STATUS_CANCELED) $statusType = 'status6'; + if ($status == self::STATUS_PRODUCED) $statusType = 'status6'; + if ($status == self::STATUS_CANCELED) $statusType = 'status5'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index d4fbd628a4d..4488342ab73 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -693,7 +693,7 @@ if ($conf->use_javascript_ajax) print ''; print ''; print $langs->trans("Total"); - print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; + print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; for ($idw = 0; $idw < 7; $idw++) @@ -810,7 +810,7 @@ if (count($tasksarray) > 0) print ' '; print $langs->trans("Total"); - print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; + print ' - '.$langs->trans("ExpectedWorkedHours").': '.price($usertoprocess->weeklyhours, 1, $langs, 0, 0).''; print ''; for ($idw = 0; $idw < 7; $idw++) From bf61a9423c41363d6c2d0c02fdd2515f9d74d027 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 03:08:12 +0100 Subject: [PATCH 15/17] Debug MRP --- htdocs/mrp/mo_production.php | 61 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index ba4a2ca9c3d..037fe3270b1 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -157,7 +157,7 @@ if (empty($reshook)) $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN'); } - if ($action == 'confirm_consumeandproduceall') { + if (in_array($action, array('confirm_consume', 'confirm_produce', 'confirm_consumeandproduceall'))) { $stockmove = new MouvementStock($db); $labelmovement = GETPOST('inventorylabel', 'alphanohtml'); @@ -579,31 +579,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - if ($action == 'consume') - { - print $langs->trans("FeatureNotYetAvailable"); - } - if ($action == 'produce') - { - print $langs->trans("FeatureNotYetAvailable"); - } - if ($action == 'consumeandproduceall') - { - $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); - //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); - $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); + $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); + //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); + $defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref); - print '
'; - print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; - print $langs->trans("MovementLabel").':   '; - print $langs->trans("InventoryCode").':

'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; - print '
'; - } + print '
'; + print ''.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'
'; + print $langs->trans("MovementLabel").':   '; + print $langs->trans("InventoryCode").':

'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + print '
'; } @@ -631,11 +620,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyConsumed").''; print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Warehouse"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Batch"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -689,11 +678,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Show detailed of already consumed with js code to collapse //$arrayoflines = $object->fetchLinesLinked('consumed', $line->id); - if ($action == 'consumeandproduceall') { + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { $i = 1; print ''; print ''.$langs->trans("ToConsume").''; - print ''; + $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); + if ($action == 'produce') $preselected = 0; + print ''; print ''; print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { @@ -756,11 +747,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Qty").''; print ''.$langs->trans("QtyAlreadyProduced").''; print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Warehouse"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Warehouse"); print ''; if ($conf->productbatch->enabled) { print ''; - if ($action == 'consumeandproduceall') print $langs->trans("Batch"); + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) print $langs->trans("Batch"); print ''; } print ''; @@ -802,15 +793,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; - if ($action == 'consumeandproduceall') { + if (in_array($action, array('consume', 'produce', 'consumeandproduceall'))) { print ''; print ''.$langs->trans("ToProduce").''; - print ''; + $preselected = (GETPOSTISSET('qtytoproduce-'.$line->id.'-'.$i) ? GETPOST('qtytoproduce-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyproduced)); + if ($action == 'consume') $preselected = 0; + print ''; print ''; print ''; if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone')); print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1); + } else { + print ''.$langs->trans("NoStockChangeOnServices").''; } print ''; if ($conf->productbatch->enabled) { From 027d88d3ce34849404747a0172d5ad2ed0a36529 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 13:35:17 +0100 Subject: [PATCH 16/17] Fix purge script --- dev/initdata/purge-data.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 62f41ce825f..de869c90f61 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -64,6 +64,10 @@ $sqls=array( "DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')", "DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)", ), + 'supplier_payment'=>array( + "DELETE FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn where fk_facturefourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."paiementfourn where rowid NOT IN (SELECT fk_paiementfourn FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn)", + ), 'bank'=>array( "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')", "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')", @@ -103,6 +107,7 @@ $sqls=array( "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'", ), 'supplier_invoice'=>array( + '@payment', "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')", "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'", ), From e52ca6f1b59ba2363638f7fae018820624318a30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Jan 2020 13:35:38 +0100 Subject: [PATCH 17/17] Fix script --- dev/initdata/purge-data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index de869c90f61..b1aadd56ed8 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -107,7 +107,7 @@ $sqls=array( "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'", ), 'supplier_invoice'=>array( - '@payment', + '@supplier_payment', "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')", "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'", ),