From 49e2b57f8d23ec1837a64d9c6a7f4406585946ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jul 2024 12:12:14 +0200 Subject: [PATCH 01/11] Fix add link of login after password change. --- htdocs/user/passwordforgotten.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 93ca97dc41d27..58458fae5c66e 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -107,7 +107,7 @@ $newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0); dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database"); - header("Location: ".DOL_URL_ROOT.'/'); + header("Location: ".DOL_URL_ROOT.'/?username='.urlencode($edituser->login)); exit; } else { $langs->load("errors"); From 8b9b3f942981fdd8d7120b202275d1648e211d9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Jul 2024 12:30:36 +0200 Subject: [PATCH 02/11] QUAL Use archiveOrBackupFile for MAIN_MAIL_DEBUG_LOG_WITH_DATE --- htdocs/core/class/CMailFile.class.php | 8 +++----- htdocs/core/lib/files.lib.php | 12 ++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f444f5fc46f57..a4bd1e2426cdb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1431,12 +1431,10 @@ public function dump_mail() fclose($fp); dolChmod($outputfile); - // Move dolibarr_mail.log into a dolibarr_mail.YYYYMMDD.log - if (getDolGlobalString('MAIN_MAIL_DEBUG_LOG_WITH_DATE')) { - $destfile = $dolibarr_main_data_root."/dolibarr_mail.".dol_print_date(dol_now(), 'dayhourlog', 'gmt').".log"; - + // Move dolibarr_mail.log into a dolibarr_mail.log.v123456789 + if (getDolGlobalInt('MAIN_MAIL_DEBUG_LOG_WITH_DATE')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_move($outputfile, $destfile, 0, 1, 0, 0); + archiveOrBackupFile($outputfile, getDolGlobalInt('MAIN_MAIL_DEBUG_LOG_WITH_DATE')); } } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 09a2ed74e134f..59d239032cd68 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3735,16 +3735,16 @@ function dragAndDropFileUpload($htmlname) /** * Manage backup versions for a given file, ensuring only a maximum number of versions are kept. * - * @param string $filetpl Full path of the source filename for the backups. Example /mydir/mydocuments/mymodule/filename.ext + * @param string $srcfile Full path of the source filename for the backups. Example /mydir/mydocuments/mymodule/filename.ext * @param int $max_versions The maximum number of backup versions to keep. * @param string $archivedir Target directory of backups (without ending /). Keep empty to save into the same directory than source file. * @param string $suffix 'v' (versioned files) or 'd' (archived files after deletion) * @param string $moveorcopy 'move' or 'copy' * @return bool Returns true if successful, false otherwise. */ -function archiveOrBackupFile($filetpl, $max_versions = 5, $archivedir = '', $suffix = "v", $moveorcopy = 'move') +function archiveOrBackupFile($srcfile, $max_versions = 5, $archivedir = '', $suffix = "v", $moveorcopy = 'move') { - $base_file_pattern = ($archivedir ? $archivedir : dirname($filetpl)).'/'.basename($filetpl).".".$suffix; + $base_file_pattern = ($archivedir ? $archivedir : dirname($srcfile)).'/'.basename($srcfile).".".$suffix; $files_in_directory = glob($base_file_pattern . "*"); // Extract the modification timestamps for each file @@ -3786,13 +3786,13 @@ function archiveOrBackupFile($filetpl, $max_versions = 5, $archivedir = '', $suf } $timestamp = dol_now('gmt'); - $new_backup = $filetpl . ".v" . $timestamp; + $new_backup = $srcfile . ".v" . $timestamp; // Move or copy the original file to the new backup with the timestamp if ($moveorcopy == 'move') { - $result = dol_move($filetpl, $new_backup, '0', 1, 0, 0); + $result = dol_move($srcfile, $new_backup, '0', 1, 0, 0); } else { - $result = dol_copy($filetpl, $new_backup, '0', 1, 0, 0); + $result = dol_copy($srcfile, $new_backup, '0', 1, 0, 0); } if (!$result) { From b2626efd4d3ab5194ed7a02599eb70714dfb3d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 1 Jul 2024 12:52:05 +0200 Subject: [PATCH 03/11] fix phan (#30218) --- htdocs/mrp/class/api_mos.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index ac2c2e6c03952..4f4e5f46a3193 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -785,13 +785,14 @@ public function produceAndConsume($id, $request_data = null) } $qtytoprocess = $value["qty"]; + $fk_warehousetoprocess = 0; if ($molinetoprocess->disable_stock_change == false) { if (isset($value["fk_warehouse"])) { // If there is a warehouse to set if (!($value["fk_warehouse"] > 0)) { // If there is no warehouse set. throw new RestException(500, "Field fk_warehouse required in " . $arrayname); } } - $fk_warehousetoprocess = $value["fk_warehouse"]; + $fk_warehousetoprocess = (int) $value["fk_warehouse"]; } $pricetoproduce = 0; From c6d44671f58ab2aa251a27707e3945a659fc616a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 1 Jul 2024 12:55:16 +0200 Subject: [PATCH 04/11] clean date phpdoc (#30221) --- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e60effb1ba364..963d0404693a5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -182,7 +182,7 @@ class Propal extends CommonObject public $datep; /** - * @var integer|'' $delivery_date; + * @var null|int|'' $delivery_date; */ public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) @@ -2247,7 +2247,7 @@ public function setDeliveryDate($user, $delivery_date, $notrigger = 0) $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; - $sql .= " SET date_livraison = ".($delivery_date != '' ? "'".$this->db->idate($delivery_date)."'" : 'null'); + $sql .= " SET date_livraison = ".(isDolTms($delivery_date) ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9108c22aa2eec..2dfdd3b376522 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -120,7 +120,7 @@ class Facture extends CommonInvoice public $datem; /** - * @var int Date expected for delivery + * @var null|int|'' Date expected for delivery */ public $delivery_date; // Date expected of shipment (date of start of shipment, not the reception that occurs some days after) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index aff021633ffd0..c130bbf50bf4d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -165,7 +165,7 @@ class CommandeFournisseur extends CommonOrder public $methode_commande; /** - * @var int Expected Delivery Date + * @var null|int|'' Expected Delivery Date */ public $delivery_date; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 8fb7061c0c9fd..af2fcd3a2b3c5 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -104,6 +104,7 @@ class SupplierProposal extends CommonObject public $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande /** + * @var int * @deprecated */ public $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed) @@ -114,7 +115,7 @@ class SupplierProposal extends CommonObject public $date; /** - * @var integer|string date_livraison + * @var null|int|'' date_livraison */ public $delivery_date; @@ -942,7 +943,7 @@ public function create($user, $notrigger = 0) $sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL'); - $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); + $sql .= ", ".(isDolTms($delivery_date) ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL'); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", ".((int) $conf->entity); @@ -1517,7 +1518,7 @@ public function setDeliveryDate($user, $delivery_date) { if ($user->hasRight('supplier_proposal', 'creer')) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; - $sql .= " SET date_livraison = ".($delivery_date != '' ? "'".$this->db->idate($delivery_date)."'" : 'null'); + $sql .= " SET date_livraison = ".(isDolTms($delivery_date) ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".((int) $this->id); if ($this->db->query($sql)) { From d654f90f914ccc724bbbbed323b8cc925a623eaa Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:56:24 +0200 Subject: [PATCH 05/11] return resprint hook (#30222) --- htdocs/projet/element.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 9ff27e0afcf7a..0692464dcf74b 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -701,6 +701,8 @@ if (!empty($hookmanager->resArray)) { $listofreferent = array_merge($listofreferent, $hookmanager->resArray); +} elseif ($resHook > 0 && !empty($hookmanager->resPrint)) { + $listofreferent = $hookmanager->resPrint; } if ($action == "addelement") { From f6194ba3e5d3f26e67792cce9e73be15551944a8 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:57:27 +0200 Subject: [PATCH 06/11] New col showuserlogin contact (#30223) * hook retour completeListOfReferent * add showuserlogin in burger contact.php * space pre-commit --- htdocs/core/lib/company.lib.php | 1 + htdocs/societe/contact.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index afb5d48ba2c06..06c09aa60fcd4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1226,6 +1226,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl 'sc.role' => array('label' => "ContactByDefaultFor", 'checked' => 1, 'position' => 40), 't.birthday' => array('label' => "Birthday", 'checked' => 0, 'position' => 45), 't.statut' => array('label' => "Status", 'checked' => 1, 'position' => 50, 'class' => 'center'), + 'u.user'=>array('label'=>"DolibarrLogin", 'checked'=>1, 'position'=>50, 'class'=>'center'), ); // Extra fields if (!empty($extrafields->attributes[$contactstatic->table_element]['label']) && is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) { diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 1ef8690e8a780..82bb50d851919 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -66,11 +66,12 @@ // Get parameters -$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); -$cancel = GETPOST('cancel', 'alpha'); -$backtopage = GETPOST('backtopage', 'alpha'); -$confirm = GETPOST('confirm'); -$socid = GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('id'); +$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$confirm = GETPOST('confirm'); +$socid = GETPOSTINT('socid') ? GETPOSTINT('socid') : GETPOSTINT('id'); +$selectedfields = GETPOST('selectedfields', 'alpha'); if ($user->socid) { $socid = $user->socid; @@ -206,7 +207,8 @@ if ($action != 'presend') { // Contacts list if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) { - $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1); + $showuserlogin = in_array('u.user', explode(',', $selectedfields)) ? 1 : 0; + $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, $showuserlogin); } } if ($action == 'delete') { From 760021b32fe61453308e03e0662d54fdf786480d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Jul 2024 13:00:33 +0200 Subject: [PATCH 07/11] Typo in en_US language (#30212) --- htdocs/langs/en_US/admin.lang | 6 +++--- htdocs/langs/en_US/bills.lang | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9adbb71316ad6..a6fec1dddf0a3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -511,7 +511,7 @@ ModuleCompanyCodeSupplierDigitaria=%s followed by the truncated supplier name by Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).
Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required. UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than... WarningPHPMail=WARNING: The setup to send emails from the application is using the default generic setup. It is often better to setup outgoing emails to use the email server of your Email Service Provider instead of the default setup for several reasons: -WarningPHPMailA=- Using the server of the Email Service Provider increases the trustability of your email, so it increases the deliverablity without being flagged as SPAM +WarningPHPMailA=- Using the server of the Email Service Provider increases the trustworthiness of your email, so it increases the deliverability without being flagged as SPAM WarningPHPMailB=- Some Email Service Providers (like Yahoo) do not allow you to send an email from another server than their own server. Your current setup uses the server of the application to send email and not the server of your email provider, so some recipients (the one compatible with the restrictive DMARC protocol), will ask your email provider if they can accept your email and some email providers (like Yahoo) may respond "no" because the server is not theirs, so few of your sent Emails may not be accepted for delivery (be careful also of your email provider's sending quota). WarningPHPMailC=- Using the SMTP server of your own Email Service Provider to send emails is also interesting so all emails sent from application will also be saved into your "Sent" directory of your mailbox. WarningPHPMailD=It is therefore recommended to change the sending method of e-mails to the value "SMTP". @@ -2239,7 +2239,7 @@ GeneralOptions=General Options LogsLinesNumber=Number of lines to show on logs tab UseDebugBar=Use the debug bar DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console -WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output +WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramatically output ModuleActivated=Module %s is activated and slows the interface ModuleActivatedWithTooHighLogLevel=Module %s is activated with a too high logging level (try to use a lower level for better performances and security) ModuleSyslogActivatedButLevelNotTooVerbose=Module %s is activated and log level (%s) is correct (not too verbose) @@ -2429,7 +2429,7 @@ DesktopsAndSmartphones=Desktops et smartphones AllowOnlineSign=Allow online signing AllowExternalDownload=Allow external download (without login, using a shared link) DeadlineDayVATSubmission=Deadline day for vat submission on the next month -MaxNumberOfAttachementOnForms=Max number of joinded files in a form +MaxNumberOfAttachementOnForms=Max number of joined files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s Reload=Reload ConfirmReload=Confirm module reload diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ce5c777899328..c41cadb34bc49 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -645,7 +645,7 @@ BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted UnitPriceXQtyLessDiscount=Unit price x Qty - Discount CustomersInvoicesArea=Customer billing area SupplierInvoicesArea=Supplier billing area -SituationTotalRayToRest=Remainder to pay without taxe +SituationTotalRayToRest=Remainder to pay without tax PDFSituationTitle=Situation n° %d SituationTotalProgress=Total progress %d %% SearchUnpaidInvoicesWithDueDate=Search unpaid invoices with a due date = %s From f105f9339bfd2d08b59a6059e1517a81e56b7658 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Jul 2024 13:02:08 +0200 Subject: [PATCH 08/11] Small review of asset module (#30213) --- htdocs/asset/admin/setup.php | 22 +++++++--------- htdocs/asset/class/asset.class.php | 36 +++++++++++++------------- htdocs/core/modules/modAsset.class.php | 10 +++---- htdocs/langs/en_US/admin.lang | 3 +++ htdocs/langs/en_US/assets.lang | 1 + 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 8648f35076f18..d1287cbdd4ef7 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -1,8 +1,8 @@ - * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2018-2024 Alexandre Spangaro + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,9 +19,9 @@ */ /** - * \file htdocs/asset/admin/setup.php + * \file htdocs/asset/admin/setup.php * \ingroup asset - * \brief Asset setup page. + * \brief Asset setup page. */ // Load Dolibarr environment @@ -197,10 +197,6 @@ $head = assetAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "asset"); -// Setup page goes here -echo ''.$langs->trans("AssetSetupPage").''; - - foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($myTmpObjectArray['includerefgeneration']) { /* @@ -208,7 +204,7 @@ */ $setupnotempty++; - print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); + print load_fiche_titre($langs->trans("AssetNumberingModules", $myTmpObjectKey), '', ''); print ''; print ''; @@ -236,7 +232,7 @@ $module = new $file($db); '@phan-var-force CommonNumRefGenerator $module'; - // Show modules according to features level + // Show modules according to feature level if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } @@ -251,7 +247,7 @@ print $module->info($langs); print ''; - // Show example of numbering model + // Show example of the numbering model print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index cc77b1e36f405..f40da96678630 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2166,7 +2166,7 @@ } else { // Show line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index dd0559a162cbb..4a1e019334cce 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1747,7 +1747,7 @@ print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 2ae144d002b3e..7e320484e75fe 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1716,7 +1716,7 @@ // Show here line of result $j = 0; - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } } else { - print ''; + print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; print ''; - // Prospect/Customer - print ''; - print ''; - - if ($conf->browser->layout == 'phone') { - print ''; + // Prospect/Customer/Supplier + $selected = $object->client; + $selectedcustomer = 0; + $selectedprospect = 0; + switch ($selected) { + case 1: + $selectedcustomer = 1; + break; + case 2: + $selectedprospect = 1; + break; + case 3: + $selectedprospect = 1; + $selectedcustomer = 1; + break; + default: + break; } - print ''; + print ''; + print ''; + print ''; - - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) - || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { - // Supplier - print ''; - print ''; - - if ($conf->browser->layout == 'phone') { - print ''; - } + print ''; // Status print ''; } - // Prospect/Customer - print ''; - print ''; - if ($conf->browser->layout == 'phone') { - print ''; + // Prospect/Customer/Supplier + $selected = $object->client; + $selectedcustomer = 0; + $selectedprospect = 0; + switch ($selected) { + case 1: + $selectedcustomer = 1; + break; + case 2: + $selectedprospect = 1; + break; + case 3: + $selectedprospect = 1; + $selectedcustomer = 1; + break; + default: + break; } - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - print ''; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - print ''; } + print ''; + // Barcode if (isModEnabled('barcode')) {
'; $tmp = $module->getExample(); if (preg_match('/^Error/', $tmp)) { diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 1d8d0d04ce18b..369b6a37bea24 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2018 Alexandre Spangaro - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2018-2024 Alexandre Spangaro + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,9 +19,9 @@ */ /** - * \file asset/class/asset.class.php - * \ingroup asset - * \brief This file is a CRUD class file for Asset (Create/Read/Update/Delete) + * \file asset/class/asset.class.php + * \ingroup asset + * \brief This file is a CRUD class file for Asset (Create/Read/Update/Delete) */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; @@ -37,12 +37,12 @@ class Asset extends CommonObject public $module = 'asset'; /** - * @var string ID to identify managed object. + * @var string ID to identify a managed object. */ public $element = 'asset'; /** - * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + * @var string Name of table without prefix where an object is stored. This is also the key used for extrafields management. */ public $table_element = 'asset'; @@ -64,20 +64,20 @@ class Asset extends CommonObject * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) * 'noteditable' says if field is not editable (1 or 0) - * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'default' is a default value for creation (can still be overwritten by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and the field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. * 'index' if we want an index in database. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommended to name the field fk_...). * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. - * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) - * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into a list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example, 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. - * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'showoncombobox' if the value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' - * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'arrayofkeyval' to set a list of values if a type is a list of predefined values. For example, array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a creation form. Only 1 field should have this property set to 1. * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * 'validate' is 1 if need to validate with $this->validateField() - * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + * 'validate' is 1 if you need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow adding a picto to copy value into clipboard (1=picto after label, 2=picto after value) * * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ @@ -992,7 +992,7 @@ public function calculationDepreciation() // futures depreciation lines //----------------------------------------------------- - $nb_days_in_year = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_YEAR', 365); + $nb_days_in_year = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_YEAR', 360); $nb_days_in_month = getDolGlobalInt('ASSET_DEPRECIATION_DURATION_PER_MONTH', 30); $period_amount = (float) price2num($depreciation_period_amount / $fields['duration'], 'MT'); $first_period_found = false; diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 299b2564ec51f..262ea329abd2c 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro +/* Copyright (C) 2004-2019 Laurent Destailleur + * Copyright (C) 2018-2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,8 +106,8 @@ public function __construct($db) $this->const[1] = array( "ASSET_DEPRECIATION_DURATION_PER_YEAR", "chaine", - "365", - "Duration per year to calculate depreciation. In some case, can be 360 days", + "360", + "Duration per year to calculate depreciation. In some case, can be 365 days", 0, 'current', 1 @@ -232,7 +232,7 @@ public function __construct($db) /** * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * The init function adds constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * * @param string $options Options when enabling module ('', 'noboxes') diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d41619b4f2e61..7f7c7092f141e 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1966,6 +1966,8 @@ CloseFiscalYear=Close accounting period DeleteFiscalYear=Delete accounting period ConfirmDeleteFiscalYear=Are you sure to delete this accounting period? ShowFiscalYear=Show accounting period +##### Assets ##### +AssetNumberingModules=Assets numbering module AlwaysEditable=Can always be edited MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application) NbMajMin=Minimum number of uppercase characters @@ -1978,6 +1980,7 @@ SortOrder=Sort order Format=Format TypePaymentDesc=0:Customer payment type, 1:Vendor payment type, 2:Both customers and suppliers payment type IncludePath=Include path (defined into variable %s) +##### Expense reports ##### ExpenseReportsSetup=Setup of module Expense Reports TemplatePDFExpenseReports=Document templates to generate expense report document ExpenseReportsRulesSetup=Setup of module Expense Reports - Rules diff --git a/htdocs/langs/en_US/assets.lang b/htdocs/langs/en_US/assets.lang index 1d9bcdab0d0e6..7cd68618ec692 100644 --- a/htdocs/langs/en_US/assets.lang +++ b/htdocs/langs/en_US/assets.lang @@ -34,6 +34,7 @@ AssetsTypeId=Asset model id AssetsTypeLabel=Asset model label AssetsTypes=Assets models ASSET_ACCOUNTANCY_CATEGORY=Fixed asset accounting group +ASSET_DEPRECIATION_DURATION_PER_YEAR=Proportional period in days for calculating amortization over one year # Menu MenuAssets=Assets MenuNewAsset=New asset From 37f4c89760e766d0a1a3bbbf9503dba93f83c75c Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Mon, 1 Jul 2024 14:16:23 +0200 Subject: [PATCH 09/11] New function to get public files of object (#30226) * function commit * Update website.lib.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/website.lib.php | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 4e3acd765bb43..d050cf0841d4e 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -1098,6 +1098,56 @@ function getImagePublicURLOfObject($object, $no = 1, $extName = '') return $image_path; } +/** + * Return list of public files of a given object. + * + * @param Object $object Object + * @return array List of public files of object + */ +function getPublicFilesOfObject($object) +{ + global $db; + + $files = array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + $regexforimg = getListOfPossibleImageExt(0); + $regexforimg = '/('.$regexforimg.')$/i'; + + $sql = "SELECT rowid, ref, share, filename, cover, position"; + $sql .= " FROM ".MAIN_DB_PREFIX."ecm_files"; + $sql .= " WHERE entity IN (".getEntity($object->element).")"; + $sql .= " AND src_object_type = '".$db->escape($object->element)."' AND src_object_id = ".((int) $object->id); + $sql .= $db->order("cover,position,rowid", "ASC,ASC,ASC"); + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + if ($obj) { + if (!empty($obj->share)) { + $files[$obj->rowid]['filename'] = $obj->filename; + $files[$obj->rowid]['position'] = $obj->position; + if (defined('USEDOLIBARRSERVER') || defined('USEDOLIBARREDITOR')) { + if (preg_match($regexforimg, $obj->filename)) { + $files[$obj->rowid]['url'] = DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($obj->share); + } else { + $files[$obj->rowid]['url'] = DOL_URL_ROOT.'/document.php?hashp='.urlencode($obj->share); + } + } else { + $files[$obj->rowid]['url'] = '/wrapper.php?hashp='.urlencode($obj->share); + } + } + } + $i++; + } + } + + return $files; +} + /** * Return list of containers object that match a criteria. From 4170bd410c63c2e4d04ac8f1332d1eef9c9d32dd Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:17:44 +0200 Subject: [PATCH 10/11] NEW Opacity for finished lines (#30219) * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php * Update list.php --------- Co-authored-by: Laurent Destailleur --- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 15ef7de9d7a19..ef52235ec004c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1792,7 +1792,7 @@ print '
'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 457e7cae3914e..1ede2ad14bd3a 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1636,7 +1636,7 @@ } else { // Show line of result $j = 0; - print '
'; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 5d39c3f3840ba..725de0edfa90e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -1037,7 +1037,7 @@ print '
'; From f7c0253035f901dace4c8323a38fa233562ee3ad Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:18:56 +0200 Subject: [PATCH 11/11] NEW checkbox to choose thirdparty nature (#30192) * New checkbox to choose thirdparty nature * fix some values * fix display for fields --------- Co-authored-by: Hystepik --- htdocs/societe/card.php | 212 +++++++++++++++++++++------------------- 1 file changed, 109 insertions(+), 103 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 075670f105b21..31d8b9f79f69d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -283,11 +283,15 @@ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors'); $error++; } - if (GETPOSTINT('client') && GETPOSTINT('client') < 0) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors'); + if (GETPOSTINT('customer') && GETPOSTINT('customer') < 0) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors'); $error++; } - if (GETPOSTISSET('fournisseur') && GETPOSTINT('fournisseur') < 0) { + if (GETPOSTINT('prospect') && GETPOSTINT('prospect') < 0) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Prospect")), null, 'errors'); + $error++; + } + if (GETPOSTISSET('supplier') && GETPOSTINT('supplier') < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors'); $error++; } @@ -375,8 +379,13 @@ $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type - $object->client = GETPOSTINT('client'); - $object->fournisseur = GETPOSTINT('fournisseur'); + // Calculate the type of the thirdparty + $customer = (GETPOSTINT('customer') > 0 ? 1 : 0); + $prospect = (GETPOSTINT('prospect') > 0 ? 2 : 0); + $prospectcustomer = $customer + $prospect; + + $object->client = $prospectcustomer; + $object->fournisseur = (GETPOSTINT('supplier') > 0 ? 1 : 0); $object->commercial_id = GETPOSTINT('commercial_id'); $object->default_lang = GETPOST('default_lang'); @@ -1350,18 +1359,44 @@ function formatCustomerSelection (selection) { print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - $selected = (GETPOSTISSET('client') ? GETPOSTINT('client') : $object->client); - print $formcompany->selectProspectCustomerType($selected); - print '
'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + $selectedprospect = (GETPOSTISSET('prospect') ? GETPOSTINT('prospect') : $selectedprospect); + $selectedcustomer = (GETPOSTISSET('customer') ? GETPOSTINT('customer') : $selectedcustomer); + print '
'.$form->editfieldkey('NatureOfThirdParty', 'customerprospect', '', $object, 0, 'string', '', 0).''; + print ''.$langs->trans("Prospect").''; + print '      '; + + print ''.$langs->trans("Customer").''; + print '      '; + + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) + || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { + // Supplier + $selected = (GETPOSTISSET('supplier') ? GETPOSTINT('supplier') : $object->fournisseur); + print ''.$langs->trans("Vendor").''; + } + print '
'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print '
'; $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { @@ -1372,44 +1407,22 @@ function formatCustomerSelection (selection) { $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); print '
'; - print '
'.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).''; - $default = -1; - if (getDolGlobalString('THIRDPARTY_SUPPLIER_BY_DEFAULT')) { - $default = 1; - } - print $form->selectyesno("fournisseur", (GETPOSTINT('fournisseur') != '' ? GETPOSTINT('fournisseur') : (GETPOSTINT("type") == '' ? $default : $object->fournisseur)), 1, 0, (GETPOSTINT("type") == '' ? 1 : 0), 1); - print '
'.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; - print ''; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { - print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { + print ''; + $s = $modCodeFournisseur->getToolTip($langs, $object, 1); + print $form->textwithpicto('', $s, 1); + print '
'; + $tmpcode = $object->code_fournisseur; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($object, 1); } + print ''; print ''; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { - print '
'; - $tmpcode = $object->code_fournisseur; - if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { - $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - } - print ''; - print ''; - $s = $modCodeFournisseur->getToolTip($langs, $object, 1); - print $form->textwithpicto('', $s, 1); - print '
'; - } - print '
'; } + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; @@ -2090,78 +2103,71 @@ function init_supplier_categ() { print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - print $formcompany->selectProspectCustomerType($object->client); - print '
'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + $selectedprospect = (GETPOSTISSET('prospect') ? GETPOSTINT('prospect') : $selectedprospect); + $selectedcustomer = (GETPOSTISSET('customer') ? GETPOSTINT('customer') : $selectedcustomer); + print '
'.$form->editfieldkey('NatureOfThirdParty', 'customerprospect', '', $object, 0, 'string', '', 0).''; + print ''.$langs->trans("Prospect").''; + print '      '; + + print ''.$langs->trans("Customer").''; + print '      '; + + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')) + || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { + // Supplier + $selected = (GETPOSTISSET('supplier') ? GETPOSTINT('supplier') : $object->fournisseur); + print ''.$langs->trans("Vendor").''; + } + print '
'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; print '
'; - if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) { - $tmpcode = $object->code_client; - if (empty($tmpcode) && !empty($object->oldcopy->code_client)) { - $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - } - if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { - $tmpcode = $modCodeClient->getNextValue($object, 0); - } - print ''; - } elseif ($object->codeclient_modifiable()) { - print ''; - } else { - print $object->code_client; - print ''; + $tmpcode = $object->code_client; + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($object, 0); } + print ''; print ''; $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); print '
'; - print '
'.$form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0).''; - // Supplier - if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) - || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) { - print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; - print $form->selectyesno("fournisseur", $object->fournisseur, 1, false, 0, 1); - print '
'; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { - print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); - } - print ''; + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { print '
'; - if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { - $tmpcode = $object->code_fournisseur; - if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) { - $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - } - if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { - $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - } - print ''; - } elseif ($object->codefournisseur_modifiable()) { - print ''; - } else { - print $object->code_fournisseur; - print ''; + $tmpcode = $object->code_fournisseur; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($object, 1); } + print ''; print ''; $s = $modCodeFournisseur->getToolTip($langs, $object, 1); print $form->textwithpicto('', $s, 1); print '
'; - print '