From 54b90abd87b50cd8cf1ed7d318f3fccf8376a844 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 26 Jul 2022 13:50:53 +0200 Subject: [PATCH 01/23] Delete Knowledge : categorie management --- .../class/knowledgerecord.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 8629ec7bbc6..a1d41c97a9f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -467,6 +467,24 @@ class KnowledgeRecord extends CommonObject $this->error .= $this->db->lasterror(); $errorflag = -1; } + + // Delete all child tables + if (!$error) { + $elements = array('categorie_knowledgemanagement'); // product_batch is done before + foreach ($elements as $table) { + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; + $sql .= " WHERE fk_knowledgemanagement = ".(int) $this->id; + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + } + } + return $this->deleteCommon($user, $notrigger); //return $this->deleteCommon($user, $notrigger, 1); } From 4c306b958ca99a64c45c0213447df2c53ee679b7 Mon Sep 17 00:00:00 2001 From: atm-steve Date: Wed, 22 Jun 2022 10:50:54 +0200 Subject: [PATCH 02/23] wip: popin with new fileds --- htdocs/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 6715577e615..ff070d1939e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -155,14 +155,14 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; // Number of actions to do (late) - if (isModEnabled('agenda') && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->rights->agenda->myactions->read) { + if (isModEnabled('agenda') && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->hasRight('agenda', 'myactions', 'READ')) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board = new ActionComm($db); $dashboardlines[$board->element] = $board->load_board($user); } // Number of project opened - if (!empty($conf->project->enabled) && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && $user->hasRight('projet', 'lire')) { + if (isModEnabled('project') && empty($conf->global->MAIN_DISABLE_BLOCK_PROJECT) && $user->hasRight('projet', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $board = new Project($db); $dashboardlines[$board->element] = $board->load_board($user); @@ -202,7 +202,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of suppliers orders a deal - if (isModEnabled('supplier_order') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->rights->fournisseur->commande->lire) { + if (isModEnabled('supplier_order') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->hasRight('fournisseur', 'commande', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $board = new CommandeFournisseur($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); @@ -235,7 +235,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of supplier invoices (paid) - if (isModEnabled('supplier_invoice') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && !empty($user->rights->fournisseur->facture->lire)) { + if (isModEnabled('supplier_invoice') && empty($conf->global->MAIN_DISABLE_BLOCK_SUPPLIER) && $user->hasRight('fournisseur', 'facture', 'lire')) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $board = new FactureFournisseur($db); $dashboardlines[$board->element] = $board->load_board($user); From cec9725ced00a63289748d3062a4ad89428ac407 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 1 Aug 2022 16:28:44 +0200 Subject: [PATCH 03/23] FIX : VAT rate recalculation set a checkbox on clone formquestion --- htdocs/compta/facture/card.php | 11 ++++++++--- htdocs/compta/facture/class/facture.class.php | 10 +++++++++- htdocs/langs/en_US/bills.lang | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index eb43da88a4b..268463f1e7d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -207,8 +207,12 @@ if (empty($reshook)) { $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid. $objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); + $objectutil->socid = $socid; - $result = $objectutil->createFromClone($user, $id); + + $targetThirdPartyVat = GETPOSTISSET('targetThirdPartyVat'); + $result = $objectutil->createFromClone($user, $id, $targetThirdPartyVat); + if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result); exit(); @@ -4174,9 +4178,10 @@ if ($action == 'create') { // Create an array for form $formquestion = array( array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)), - array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()) + array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()), + array('type' => 'checkbox', 'name' => 'targetThirdPartyVat', 'label' => $langs->trans("targetThirdPartyVat"), 'value' => 0 ), ); - // Ask confirmatio to clone + // Ask confirmation to clone $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ec8e4a93b80..fb6a59ef3da 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1192,7 +1192,7 @@ class Facture extends CommonInvoice * @param int $fromid Id of object to clone * @return int New id of clone */ - public function createFromClone(User $user, $fromid = 0) + public function createFromClone(User $user, $fromid = 0, $targetThirdPartyVat = false) { global $conf, $hookmanager; @@ -1277,6 +1277,14 @@ class Facture extends CommonInvoice $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext } + // we have a different thirdparty selected and we checked $targetThirdPartyVat + if ($objFrom->socid != $object->socid && $targetThirdPartyVat) { + global $mysoc; + + foreach ($object->lines as $line) { + $line->tva_tx = get_default_tva($mysoc, $objsoc, $line->fk_product); + } + } // Create clone $object->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index b9b4b111b43..4d32f48f862 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -609,4 +609,5 @@ NoPaymentAvailable=No payment available for %s PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices MakePaymentAndClassifyPayed=Record payment -BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status) \ No newline at end of file +BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status) +targetThirdPartyVat=Modify the VAT rate to use the default rate depending on the new thirdparty From d872b9c2c789def2f1e7d76a3cc652e4c272486e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 2 Aug 2022 21:05:33 +0200 Subject: [PATCH 04/23] Fix correct fix of paymentok.php this line was deleted by error --- htdocs/public/payment/paymentok.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index e04f00d7459..57e23350a2c 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -368,6 +368,7 @@ if ($ispaymentok) { } if (empty($user->rights->adherent)) { $user->rights->adherent = new stdClass(); + $user->rights->adherent->cotisation = new stdClass(); } $user->rights->societe->creer = 1; $user->rights->facture->creer = 1; From 3185821806efb2b576a0ba8626c5647242187c90 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 3 Aug 2022 09:06:52 +0200 Subject: [PATCH 05/23] Update index.php --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index ff070d1939e..903f77c0ed8 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -155,7 +155,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; // Number of actions to do (late) - if (isModEnabled('agenda') && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->hasRight('agenda', 'myactions', 'READ')) { + if (isModEnabled('agenda') && empty($conf->global->MAIN_DISABLE_BLOCK_AGENDA) && $user->hasRight('agenda', 'myactions', 'read')) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board = new ActionComm($db); $dashboardlines[$board->element] = $board->load_board($user); From c545756b6eb49ae53d6356169305453ab7624c01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Aug 2022 17:06:19 +0200 Subject: [PATCH 06/23] Revert "FIX : VAT rate recalculation" --- htdocs/compta/facture/card.php | 11 +++-------- htdocs/compta/facture/class/facture.class.php | 10 +--------- htdocs/langs/en_US/bills.lang | 3 +-- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 268463f1e7d..eb43da88a4b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -207,12 +207,8 @@ if (empty($reshook)) { $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid. $objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); - $objectutil->socid = $socid; - - $targetThirdPartyVat = GETPOSTISSET('targetThirdPartyVat'); - $result = $objectutil->createFromClone($user, $id, $targetThirdPartyVat); - + $result = $objectutil->createFromClone($user, $id); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$result); exit(); @@ -4178,10 +4174,9 @@ if ($action == 'create') { // Create an array for form $formquestion = array( array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)), - array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()), - array('type' => 'checkbox', 'name' => 'targetThirdPartyVat', 'label' => $langs->trans("targetThirdPartyVat"), 'value' => 0 ), + array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()) ); - // Ask confirmation to clone + // Ask confirmatio to clone $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fb6a59ef3da..ec8e4a93b80 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1192,7 +1192,7 @@ class Facture extends CommonInvoice * @param int $fromid Id of object to clone * @return int New id of clone */ - public function createFromClone(User $user, $fromid = 0, $targetThirdPartyVat = false) + public function createFromClone(User $user, $fromid = 0) { global $conf, $hookmanager; @@ -1277,14 +1277,6 @@ class Facture extends CommonInvoice $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext } - // we have a different thirdparty selected and we checked $targetThirdPartyVat - if ($objFrom->socid != $object->socid && $targetThirdPartyVat) { - global $mysoc; - - foreach ($object->lines as $line) { - $line->tva_tx = get_default_tva($mysoc, $objsoc, $line->fk_product); - } - } // Create clone $object->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 4d32f48f862..b9b4b111b43 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -609,5 +609,4 @@ NoPaymentAvailable=No payment available for %s PaymentRegisteredAndInvoiceSetToPaid=Payment registered and invoice %s set to paid SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices MakePaymentAndClassifyPayed=Record payment -BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status) -targetThirdPartyVat=Modify the VAT rate to use the default rate depending on the new thirdparty +BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status) \ No newline at end of file From 93b040250eaf112f716383ba47844ba6cf47781f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Aug 2022 18:25:32 +0200 Subject: [PATCH 07/23] Update knowledgerecord.class.php --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index a1d41c97a9f..c78a88e07c7 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -470,7 +470,7 @@ class KnowledgeRecord extends CommonObject // Delete all child tables if (!$error) { - $elements = array('categorie_knowledgemanagement'); // product_batch is done before + $elements = array('categorie_knowledgemanagement'); foreach ($elements as $table) { if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; From 7544c26b9580afb9a30eb6bbbdc7fb1ac58dd402 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Aug 2022 19:10:38 +0200 Subject: [PATCH 08/23] Fix link to delete website --- htdocs/website/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 4f8c79d91b1..933f1f73687 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2741,7 +2741,12 @@ if (!GETPOST('hide_websitemenu')) { print ''; - print ''; + // Delete website + if ($website->status == $website::STATUS_VALIDATED) { + print ''; + } else { + print ''; + } // Regenerate all pages print 'ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; From a064b25fdd6d1dfa052a7777137df0b147b557cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2022 11:14:21 +0200 Subject: [PATCH 09/23] css --- htdocs/user/ldap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 5e6cf57bfd4..3e39a55cfb4 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -94,7 +94,7 @@ llxHeader(); $head = user_prepare_head($object); $title = $langs->trans("User"); -print dol_get_fiche_head($head, 'ldap', $title, 0, 'user'); +print dol_get_fiche_head($head, 'ldap', $title, -1, 'user'); $linkback = ''; @@ -107,7 +107,7 @@ dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $use print '
'; print '
'; -print ''; +print '
'; // Login print ''; From 9c87b56863e345b23243d52d2ef1d4d9c5d0ad3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2022 13:13:24 +0200 Subject: [PATCH 10/23] css --- htdocs/emailcollector/class/emailcollector.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 9a60624e9d2..47e3c1303da 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -111,7 +111,7 @@ class EmailCollector extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax250'), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'help'=>'Example: MyCollector1', 'csslist'=>'tdoverflowmax150'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'), 'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflow125'), From 39dccc4fdf4f0d38d1ef58f765f7b5ed8920b5e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2022 13:42:57 +0200 Subject: [PATCH 11/23] FIX Scan IMAP must not be done automatically --- htdocs/admin/emailcollector_card.php | 86 +++++++++++++++------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index ab4f0c7def0..2a32551eaad 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -378,33 +378,54 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $connectstringserver = $object->getConnectStringIMAP($usessl); - try { - if ($sourcedir) { - //$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); - $connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir); - } - if ($targetdir) { - //$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); - $connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir); + if ($action == 'scan') { + try { + if ($sourcedir) { + //$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); + $connectstringsource = $connectstringserver.$object->getEncodedUtf7($sourcedir); + } + if ($targetdir) { + //$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); + $connectstringtarget = $connectstringserver.$object->getEncodedUtf7($targetdir); + } + + $timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT; + $timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT; + + dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread); + + $result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect + $result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread); + $result3 = imap_timeout(IMAP_WRITETIMEOUT, 5); + $result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5); + + dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4); + + $connection = imap_open($connectstringsource, $object->login, $object->password); + + //dol_syslog("end imap_open connection=".var_export($connection, true)); + } catch (Exception $e) { + print $e->getMessage(); } - $timeoutconnect = empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT; - $timeoutread = empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 20 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT; + if (!$connection) { + $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; + if (function_exists('imap_last_error')) { + $morehtml .= '
'.imap_last_error(); + } + dol_syslog("Error ".$morehtml, LOG_WARNING); + //var_dump(imap_errors()) + } else { + dol_syslog("Imap connected. Now we call imap_num_msg()"); + $morehtml .= imap_num_msg($connection); + } - dol_syslog("imap_open connectstring=".$connectstringsource." login=".$object->login." password=".$object->password." timeoutconnect=".$timeoutconnect." timeoutread=".$timeoutread); - - $result1 = imap_timeout(IMAP_OPENTIMEOUT, $timeoutconnect); // timeout seems ignored with ssl connect - $result2 = imap_timeout(IMAP_READTIMEOUT, $timeoutread); - $result3 = imap_timeout(IMAP_WRITETIMEOUT, 5); - $result4 = imap_timeout(IMAP_CLOSETIMEOUT, 5); - - dol_syslog("result1=".$result1." result2=".$result2." result3=".$result3." result4=".$result4); - - $connection = imap_open($connectstringsource, $object->login, $object->password); - - //dol_syslog("end imap_open connection=".var_export($connection, true)); - } catch (Exception $e) { - print $e->getMessage(); + if ($connection) { + dol_syslog("Imap close"); + imap_close($connection); + } + } else { + $morehtml .= ''.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").''; } $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); @@ -412,23 +433,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= 'IMAP functions not available on your PHP. '; } - if (!$connection) { - $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; - if (function_exists('imap_last_error')) { - $morehtml .= '
'.imap_last_error(); - } - dol_syslog("Error ".$morehtml, LOG_WARNING); - //var_dump(imap_errors()) - } else { - dol_syslog("Imap connected. Now we call imap_num_msg()"); - $morehtml .= imap_num_msg($connection); - } - - if ($connection) { - dol_syslog("Imap close"); - imap_close($connection); - } - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'
'.$morehtml.'
', '', 0, '', '', 0, ''); print '
'; From 0a623ab0683c7b1b41bca4d070c70f7e1140befc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2022 16:17:07 +0200 Subject: [PATCH 12/23] Fix yogosha#11976 --- htdocs/barcode/printsheet.php | 35 ++++++++++++++++++---------------- htdocs/langs/en_US/errors.lang | 2 ++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 763463d6fb8..c55db4ef2a1 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -203,25 +203,30 @@ if ($action == 'builddoc') { $forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH); $forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT); - for ($i = 0; $i < $numberofsticker; $i++) { - $arrayofrecords[] = array( - 'textleft'=>$textleft, - 'textheader'=>$textheader, - 'textfooter'=>$textfooter, - 'textright'=>$textright, - 'code'=>$code, - 'encoding'=>$encoding, - 'is2d'=>$is2d, - 'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF - ); + $MAXSTICKERS = 1000; + if ($numberofsticker <= $MAXSTICKERS) { + for ($i = 0; $i < $numberofsticker; $i++) { + $arrayofrecords[] = array( + 'textleft'=>$textleft, + 'textheader'=>$textheader, + 'textfooter'=>$textfooter, + 'textright'=>$textright, + 'code'=>$code, + 'encoding'=>$encoding, + 'is2d'=>$is2d, + 'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF + ); + } + } else { + $mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS); + $error++; } } $i++; - $mesg = ''; // Build and output PDF - if ($mode == 'label') { + if (!$error && $mode == 'label') { if (!count($arrayofrecords)) { $mesg = $langs->trans("ErrorRecordNotFound"); } @@ -240,7 +245,7 @@ if ($action == 'builddoc') { } } - if ($result <= 0 || $mesg) { + if ($result <= 0 || $mesg || $error) { if (empty($mesg)) { $mesg = 'Error '.$result; } @@ -272,8 +277,6 @@ print '
'; print ''.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'
'; print '
'; -dol_htmloutput_errors($mesg); - //print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'
'; //print '
'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 9d38eab591e..50bc7931fd2 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -289,6 +289,8 @@ ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by current object status ErrorAjaxRequestFailed=Request failed ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is mandatory +ErrorFailedToWriteInTempDirectory=Failed to write in temp directory +ErrorQuantityIsLimitedTo=Quantity is limited to %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. From 3719366e04c7ce28d1ce0a6fcc5161c43b70926d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 4 Aug 2022 19:31:14 +0200 Subject: [PATCH 13/23] Fix read knowledgemanagement categories --- htdocs/categories/class/api_categories.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index fcac14f1337..0a618974024 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -305,7 +305,8 @@ class Categories extends DolibarrApi Categorie::TYPE_CUSTOMER, Categorie::TYPE_SUPPLIER, Categorie::TYPE_MEMBER, - Categorie::TYPE_PROJECT + Categorie::TYPE_PROJECT, + Categorie::TYPE_KNOWLEDGEMANAGEMENT ])) { throw new RestException(401); } @@ -322,6 +323,8 @@ class Categories extends DolibarrApi throw new RestException(401); } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); + } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + throw new RestException(401); } $categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page); From bbe74c5d77a20e2e64494a48fb08c251796a7140 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 6 Aug 2022 13:44:56 +0200 Subject: [PATCH 14/23] FIX errors when search by code --- htdocs/admin/dict.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 621b2b783a7..22481296c68 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1169,14 +1169,16 @@ if ($id) { $sql .= natural_search("code_iso", $search_code); } elseif ($search_code != '' && $id == 28) { $sql .= natural_search("h.code", $search_code); - } elseif ($search_code != '' && $id == 32) { + } elseif ($search_code != '' && ($id == 7 || $id == 32)) { $sql .= natural_search("a.code", $search_code); } elseif ($search_code != '' && $id == 3) { $sql .= natural_search("r.code_region", $search_code); - } elseif ($search_code != '' && $id == 7) { - $sql .= natural_search("a.code", $search_code); - } elseif ($search_code != '' && $id == 10) { + } elseif ($search_code != '' && ($id == 8 || $id == 10)) { $sql .= natural_search("t.code", $search_code); + } elseif ($search_code != '' && $id == 1) { + $sql .= natural_search("f.code", $search_code); + } elseif ($search_code != '' && $id == 2) { + $sql .= natural_search("d.code_departement", $search_code); } elseif ($search_code != '' && $id != 9) { $sql .= natural_search("code", $search_code); } From 0f6effcdb05d54099a69d13bea265d73aaa5d1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Sun, 7 Aug 2022 14:43:26 +0200 Subject: [PATCH 15/23] Update import_xlsx.modules.php --- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1c38f52cbfc..ae95b78ec8d 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -863,7 +863,7 @@ class ImportXlsx extends ModeleImports if (empty($keyfield)) { $keyfield = 'rowid'; } - $sqlSelect .= "WHERE " . $keyfield . " = " .((int) $lastinsertid); + $sqlSelect .= " WHERE " . $keyfield . " = " .((int) $lastinsertid); $resql = $this->db->query($sqlSelect); if ($resql) { From 96c17b485c2471bf5b9535ff731a013cc84572e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Aug 2022 11:07:38 +0200 Subject: [PATCH 16/23] do not loose decription when changing country, reload cause description lost --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a1be8f35c29..b6180b2f77d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -16,7 +16,7 @@ * Copyright (C) 2016 Charlie Benke * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * @@ -1728,7 +1728,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
"; From 5ef9d2d40d707b00a341cfd5eb7f2ad5b1b0d809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Aug 2022 11:11:17 +0200 Subject: [PATCH 17/23] keep url --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b6180b2f77d..b8f4a8fa7f7 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1738,7 +1738,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { print ''; } From b20144c3d01f0d44a6f22163650d1958e1e441dc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 8 Aug 2022 11:39:43 +0200 Subject: [PATCH 18/23] FIX php8 compatibility --- htdocs/comm/propal/card.php | 12 ++++++------ htdocs/commande/card.php | 8 ++++---- htdocs/compta/facture/card.php | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b8b46a0c8d9..c05554d2242 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -112,17 +112,17 @@ if ($id > 0 || !empty($ref)) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('propalcard', 'globalcard')); -$usercanread = $user->rights->propal->lire; -$usercancreate = $user->rights->propal->creer; -$usercandelete = $user->rights->propal->supprimer; +$usercanread = $user->hasRight("propal", "lire"); +$usercancreate = $user->hasRight("propal", "creer"); +$usercandelete = $user->hasRight("propal", "supprimer"); $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); -$usercancreateorder = $user->rights->commande->creer; -$usercancreateinvoice = $user->rights->facture->creer; -$usercancreatecontract = $user->rights->contrat->creer; +$usercancreateorder = $user->hasRight("commande", "creer"); +$usercancreateinvoice = $user->hasRight("facture", "creer"); +$usercancreatecontract = $user->hasRight("contrat", "creer"); $usercancreateintervention = $user->hasRight('ficheinter', 'creer'); $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1e6a33e8ae8..bc4d085f8ce 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -108,16 +108,16 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -$usercanread = $user->rights->commande->lire; -$usercancreate = $user->rights->commande->creer; -$usercandelete = $user->rights->commande->supprimer; +$usercanread = $user->hasRight("commande", "lire"); +$usercancreate = $user->hasRight("commande", "creer"); +$usercandelete = $user->hasRight("commande", "supprimer"); // Advanced permissions $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate))); $usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send); -$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$usercancreatepurchaseorder = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d0b0ba331f3..ea2eb805ce5 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -128,11 +128,11 @@ if ($id > 0 || !empty($ref)) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicecard', 'globalcard')); -$usercanread = $user->rights->facture->lire; -$usercancreate = $user->rights->facture->creer; -$usercanissuepayment = $user->rights->facture->paiement; -$usercandelete = $user->rights->facture->supprimer; -$usercancreatecontract = $user->rights->contrat->creer; +$usercanread = $user->hasRight("facture", "lire"); +$usercancreate = $user->hasRight("facture", "creer"); +$usercanissuepayment = $user->hasRight("facture", "paiement"); +$usercandelete = $user->hasRight("facture", "supprimer"); +$usercancreatecontract = $user->hasRight("contrat", "creer"); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send))); $usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen))); From 60e12db1dab18f624bbc538ece3f31cdbffd82b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Mon, 8 Aug 2022 15:12:40 +0200 Subject: [PATCH 19/23] php v8 warning --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 567c51f08c9..d7e2472f22c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6010,7 +6010,7 @@ abstract class CommonObject // Test fetch_array ! is_int($key) because fetch_array result is a mix table with Key as alpha and Key as int (depend db engine) if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && !is_int($key)) { // we can add this attribute to object - if (!empty($extrafields) && in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date', 'datetime'))) { + if (!empty($extrafields->attributes[$this->table_element]) && in_array($extrafields->attributes[$this->table_element]['type'][$key], array('date', 'datetime'))) { //var_dump($extrafields->attributes[$this->table_element]['type'][$key]); $this->array_options["options_".$key] = $this->db->jdate($value); } else { @@ -6023,7 +6023,7 @@ abstract class CommonObject // If field is a computed field, value must become result of compute foreach ($tab as $key => $value) { - if (!empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { + if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { //var_dump($conf->disable_compute); if (empty($conf->disable_compute)) { $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); From 0764a9c123d0896a024c90f49ad5ce8e6263343d Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 9 Aug 2022 16:45:04 +0200 Subject: [PATCH 20/23] FIX - php V8 multiprice thirdpaty card --- htdocs/comm/multiprix.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 8da9a17ebb2..0e582946df9 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -75,7 +75,7 @@ if ($_socid > 0) { // We load data of thirdparty $objsoc = new Societe($db); $objsoc->id = $_socid; - $objsoc->fetch($_socid, $to); + $objsoc->fetch($_socid); $head = societe_prepare_head($objsoc); @@ -141,7 +141,6 @@ if ($_socid > 0) { $resql = $db->query($sql); if ($resql) { print '
'.$langs->trans("Login").'
'.$langs->trans("Description").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%'); + $doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%'); $doleditor->Create(); print "
'.$langs->trans("PublicUrl").''; print img_picto('', 'globe', 'class="pictofixedwidth"'); - print ''; + print ''; print '
'; - $tag = !$tag; print ''; print ''; print ''; From 2dd1ef22fa7bf96ef6229945f0b493f8f3d0d75c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Aug 2022 03:34:16 +0200 Subject: [PATCH 21/23] css --- htdocs/product/stock/tpl/stockcorrection.tpl.php | 8 ++++---- htdocs/product/stock/tpl/stocktransfer.tpl.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 19974c49afe..08a66d1b8c6 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -106,7 +106,7 @@ if ($object->element == 'stock') { print ''; print ''; print 'element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; print ''; print ''; @@ -161,7 +161,7 @@ if (!empty($conf->project->enabled)) { print ''; print ''; } print ''; @@ -171,7 +171,7 @@ $valformovementlabel = ((GETPOST("label") && (GETPOST('label') != $langs->trans( print ''; print ''; print ''; print ''; print ''; } if ($object->element == 'stock') { @@ -87,7 +87,7 @@ if ($object->element == 'stock') { } print ''; print ''; print ''; @@ -104,7 +104,7 @@ if (!empty($conf->productbatch->enabled) && print ''; print ''; } else { - print ''; + print ''; } print ''; print ''; @@ -128,7 +128,7 @@ $valformovementlabel = (GETPOST("label") ? GETPOST("label") : $langs->trans("Mov print ''; print ''; print ''; print ''; print ''; // Product or sub-bom - print ''; - print ''; + // Qty print ''; print ''; //print ''; - // print ''; + //print ''; print ''; $i = 0; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index f6aba7f2597..d92c595c6ec 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -708,7 +708,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addconsumeline&token='.newToken(); - $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall'; + $permissiontoaddaconsumeline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; $parameters = array('morecss'=>'reposition'); $newcardbutton = ''; @@ -996,6 +996,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $i = 1; print ''."\n"; print ''; + // Ref print ''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) { @@ -1044,12 +1045,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $preselected = (GETPOSTISSET('batch-'.$line->id.'-'.$i) ? GETPOST('batch-'.$line->id.'-'.$i) : ''); print ''; print $formproduct->selectLotDataList('batch-'.$line->id.'-'.$i, 0, $line->fk_product, '', ''); - } - print ''; - print ''; } @@ -1094,10 +1092,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $newcardbutton = ''; $url = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addproduceline&token='.newToken(); - $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED && $action != 'consumeorproduce' && $action != 'consumeandproduceall'; + $permissiontoaddaproductline = $object->status != $object::STATUS_PRODUCED && $object->status != $object::STATUS_CANCELED; $parameters = array('morecss'=>'reposition'); - if ($nblinetoproduce == 0 || $object->mrptype == 1) { - $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); + if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { + if ($nblinetoproduce == 0 || $object->mrptype == 1) { + $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); + } } print load_fiche_titre($langs->trans('Production'), $newcardbutton, '', 0, '', ''); @@ -1196,12 +1196,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; if ($permissiontoupdatecost) { // Defined $manufacturingcost - $manufacturingcost = $bomcost; - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); - } - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcost = 0; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } } print ''; if ($permissiontoupdatecost) { // Defined $manufacturingcost - $manufacturingcost = $bomcost; - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); - } - if (empty($manufacturingcost)) { - $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + $manufacturingcost = 0; + if ($object->mrptype == 0) { // If MO is a "Manufacture" type (and not "Disassemble" + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } } if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($manufacturingcost)); + $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : ($manufacturingcost ? price($manufacturingcost) : '')); print ''; } else { - print ''; + print ''; } } print ''; diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index e641bd142fc..7e0468119bd 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -44,6 +44,7 @@ $res = $tmpbom->fetch($line->fk_bom_child); tpl['strike']) ? '' : ' strikefordisabled').'">'; +// Ref or label print ''; -//print ''; +// Qty print ''; print ''; -if ($tmpbom->id) { +if ($tmpbom->id > 0) { print ''; } else { - print ''; + print ''; } +//print ''; + print ''."\n"; // Select of all the sub-BOM lines From abcdb8dd10b2b907762034cecca5f478432daf5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Aug 2022 05:06:58 +0200 Subject: [PATCH 23/23] css --- htdocs/product/fournisseurs.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 49242eb47e4..99d204a1d64 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -471,6 +471,7 @@ if ($id > 0 || $ref) { print load_fiche_titre($langs->trans("AddSupplierPrice")); } + print "\n"; print '
'; print ''; print ''; @@ -480,7 +481,7 @@ if ($id > 0 || $ref) { print '
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("NumberOfUnit").''; if ($object->element == 'product' || $object->element == 'stock') { - print ''; print ''; print ''; print ''; @@ -134,7 +134,7 @@ if (!empty($conf->productbatch->enabled) && ) { print '
'; - print ''; + print ''; print '
'.$langs->trans('Project').''; print img_picto('', 'project'); - $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300 widthcentpercentminusx'); print '
'.$langs->trans("MovementLabel").''; -print ''; +print ''; print ''.$langs->trans("InventoryCode").''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 53803b0929d..f2ecfa1d73c 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -75,7 +75,7 @@ if ($object->element == 'product') { print img_picto('', 'stock'); $selected = (GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))); $warehousestatus = 'warehouseopen,warehouseinternal'; - print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1); + print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx'); print ''.$langs->trans("WarehouseTarget").''; -print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); +print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx'); print '
'.$langs->trans("NumberOfUnit").'
'.$langs->trans("MovementLabel").''; -print ''; +print ''; print ''.$langs->trans("InventoryCode").''; From 427541beaa3199dbca97b46eca73684f143baa2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Aug 2022 04:07:18 +0200 Subject: [PATCH 22/23] FIX #21668 --- htdocs/mrp/class/mo.class.php | 8 ++-- htdocs/mrp/mo_production.php | 52 +++++++++++++----------- htdocs/mrp/tpl/originproductline.tpl.php | 14 ++++--- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0a953ea869c..d186c6e533b 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -101,7 +101,7 @@ class Mo extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1), - 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall', 'picto'=>'bom'), 'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), @@ -1375,13 +1375,13 @@ class Mo extends CommonObject print '
'.$langs->trans('Description'); + print ''.$langs->trans('Ref'); if (!empty($conf->global->BOM_SUB_BOM)) { print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } print ''.$langs->trans('Ref').''.$langs->trans('Qty'); if ($this->bom->bomtype == 0) { print ' ('.$langs->trans("ForAQuantityOf", $this->bom->qty).')'; @@ -1395,7 +1395,7 @@ class Mo extends CommonObject print ''.$langs->trans('DisableStockChange').''.$langs->trans('MoChildGenerate').''.$form->showCheckAddButtons('checkforselect', 1).'
'.$langs->trans("ToConsume").''; - if ($tmpproduct->status_batch) { + $type = 'batch'; - print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$line->id.', \''.$type.'\', \'qtymissingconsume\')"'); + print ' '.img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.((int) $line->id).', \''.dol_escape_js($type).'\', \'qtymissingconsume\')"'); } print ''.$line->qty.''; @@ -1300,19 +1303,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ' '; if ($res) { print $tmpproduct->getNomUrl(1); @@ -58,7 +59,7 @@ if ($res) { print $this->tpl['label']; } print ''.$this->tpl['label'].''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS')); if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) { @@ -78,18 +79,19 @@ $selected = 1; if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { $selected = 0; } -print ''; -//print ''; -print ''; print ''; print ' '; +//print ''; +//print '
'; // Supplier - print ''; print '';
'.$langs->trans("Supplier").''; + print '
'.$langs->trans("Supplier").''; if ($rowid) { $supplier = new Fournisseur($db); $supplier->fetch($socid); @@ -636,7 +637,7 @@ if ($id > 0 || $ref) { $currencycodetouse = $conf->currency; } print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); - print '   '.$langs->trans("CurrencyRate").' '; + print '     '.$langs->trans("CurrencyRate").' '; print ''; print '