From 2dc54191451588d6e6de7f9f81bfba7d03423ea4 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Tue, 24 Oct 2023 13:12:59 +0200 Subject: [PATCH 001/323] Fix #26337 updateline fatal error on updateline (#26341) Co-authored-by: Hystepik --- htdocs/fichinter/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index fe5850a6cd9..0748a3043de 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -608,7 +608,9 @@ if (empty($reshook)) { // Extrafields $extrafields->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line); - $objectline->array_options = array_merge($objectline->array_options, $array_options); + if(!empty($array_options)){ + $objectline->array_options = array_merge($objectline->array_options, $array_options); + } $result = $objectline->update($user); if ($result < 0) { From 777a22ebaa05f7f8b0950bd1e4e07d6fdf7bfe49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Oct 2023 18:11:09 +0200 Subject: [PATCH 002/323] Fix warning --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3d460c93560..01b8ff97f34 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1050,7 +1050,7 @@ class Facture extends CommonInvoice $buyprice, $_facrec->lines[$i]->label, empty($_facrec->lines[$i]->array_options) ?null:$_facrec->lines[$i]->array_options, - $_facrec->lines[$i]->situation_percent, + 100, // situation percent is undefined on recurring invoice lines '', $_facrec->lines[$i]->fk_unit, $_facrec->lines[$i]->multicurrency_subprice, From 8ea84c5bb50bd66e571fba0eae587971100fd13f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Oct 2023 19:27:04 +0200 Subject: [PATCH 003/323] FIX error of webhook not returned --- .../interface_95_modWebhook_WebhookTriggers.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 6a05551d333..43e64838647 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -122,10 +122,13 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $response = getURLContent($tmpobject->url, 'POST', $jsonstr, 1, array(), array('http', 'https'), 0, -1); if (empty($response['curl_error_no']) && $response['http_code'] >= 200 && $response['http_code'] < 300) { - $nbPosts ++; + $nbPosts++; } else { - $errors ++; - dol_syslog("Failed to get url with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""), LOG_DEBUG); + $errors++; + $errormsg = "Failed to get url with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""); + $this->error = $errormsg; + $this->errors[] = $errormsg; + dol_syslog($errormsg, LOG_DEBUG); } } } From 69e7a76aee18e69f887c3d0b4f0c568babd4a8c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Oct 2023 19:28:28 +0200 Subject: [PATCH 004/323] Fix log level --- .../triggers/interface_95_modWebhook_WebhookTriggers.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 43e64838647..44111822c9f 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -128,7 +128,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $errormsg = "Failed to get url with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""); $this->error = $errormsg; $this->errors[] = $errormsg; - dol_syslog($errormsg, LOG_DEBUG); + dol_syslog($errormsg, LOG_ERR); } } } From 7e994e44395df85d4597955bd05fe8548da29fb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Oct 2023 19:45:56 +0200 Subject: [PATCH 005/323] Fix error message --- .../interface_95_modWebhook_WebhookTriggers.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 44111822c9f..3eb8a2ce076 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -125,9 +125,11 @@ class InterfaceWebhookTriggers extends DolibarrTriggers $nbPosts++; } else { $errors++; - $errormsg = "Failed to get url with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""); - $this->error = $errormsg; + $errormsg = "The WebHook for ".$action." failed to get URL ".$tmpobject->url." with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""); $this->errors[] = $errormsg; + /*if (!empty($response['content'])) { + $this->errors[] = dol_trunc($response['content'], 200); + }*/ dol_syslog($errormsg, LOG_ERR); } } From 1c99bb0344de447aebb6b47a0d164d376a32050b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 15:53:31 +0200 Subject: [PATCH 006/323] Add a tooltip to explain why a link is not visible --- htdocs/blockedlog/admin/blockedlog_list.php | 5 ++++- htdocs/langs/en_US/blockedlog.lang | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 671b016c527..d19019ae99f 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -540,6 +540,7 @@ if (is_array($blocks)) { $nbshown = 0; $MAXFORSHOWLINK = 100; $object_link = ''; + $object_link_title = ''; foreach ($blocks as &$block) { //if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) @@ -548,8 +549,10 @@ if (is_array($blocks)) { if ($nbshown < $MAXFORSHOWLINK) { // For performance and memory purpose, we get/show the link of objects only for the 100 first output $object_link = $block->getObjectLink(); + $object_link_title = ''; } else { $object_link = $block->element.'/'.$block->fk_object; + $object_link_title = $langs->trans('LinkHasBeenDisabledForPerformancePurpose'); } print ''; @@ -581,7 +584,7 @@ if (is_array($blocks)) { print ''; // Link to source object - print ''; + print ''; print ''; // $object_link can be a ''; diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 9fdef53260f..3fb18394c7e 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -33,6 +33,7 @@ RestrictYearToExport=Restrict month / year to export BlockedLogEnabled=System to track events into unalterable logs has been enabled BlockedLogDisabled=System to track events into unalterable logs has been disabled after some recording were done. We saved a special Fingerprint to track the chain as broken BlockedLogDisabledBis=System to track events into unalterable logs has been disabled. This is possible because no record were done yet. +LinkHasBeenDisabledForPerformancePurpose=For performance purpose, direct link to the document is not shown after the 100th line. ## logTypes logBILL_DELETE=Customer invoice logically deleted From abfaadb7f858b9286d4836065d3869b0c88e60f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 16:41:46 +0200 Subject: [PATCH 007/323] Fix for backward compatibility --- htdocs/install/inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 4173955cbb3..a2939ac48e2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -130,7 +130,7 @@ function usage($program, $header) echo " Display this help message.\n"; } -if (php_sapi_name() === "cli") { +if (php_sapi_name() === "cli" && (float) PHP_VERSION > 7.0) { $rest_index = 0; $opts = getopt($short_options, $long_options, $rest_index); From 1066d8ea53dfa0450aa8b3b4be566d2b4f2111e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 17:03:37 +0200 Subject: [PATCH 008/323] Fix log --- htdocs/install/step2.php | 2 +- htdocs/install/step4.php | 4 ++-- htdocs/install/step5.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index a06408bd32c..74dbd106bec 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -87,7 +87,7 @@ if (@file_exists($forcedfile)) { } } -dolibarr_install_syslog("- step2: entering step2.php page"); +dolibarr_install_syslog("--- step2: entering step2.php page"); /* diff --git a/htdocs/install/step4.php b/htdocs/install/step4.php index 3feb55fd63a..f1a2598f724 100644 --- a/htdocs/install/step4.php +++ b/htdocs/install/step4.php @@ -48,7 +48,7 @@ if (@file_exists($forcedfile)) { include_once $forcedfile; } -dolibarr_install_syslog("- step4: entering step4.php page"); +dolibarr_install_syslog("--- step4: entering step4.php page"); $error = 0; $ok = 0; @@ -114,7 +114,7 @@ if ($error && isset($argv[1])) { } dolibarr_install_syslog("Exit ".$ret); -dolibarr_install_syslog("- step4: end"); +dolibarr_install_syslog("--- step4: end"); pFooter($error, $setuplang); diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index cc433c440a5..4fd038e73e8 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -93,7 +93,7 @@ if (@file_exists($forcedfile)) { } } -dolibarr_install_syslog("- step5: entering step5.php page"); +dolibarr_install_syslog("--- step5: entering step5.php page ".$versionfrom." ".$versionto); $error = 0; @@ -545,7 +545,7 @@ if ($error && isset($argv[1])) { } dolibarr_install_syslog("Exit ".$ret); -dolibarr_install_syslog("- step5: Dolibarr setup finished"); +dolibarr_install_syslog("--- step5: Dolibarr setup finished"); pFooter(1, $setuplang, '', 0, $morehtml); From 1281e7550a9f756db37c7a90b297c88e27067772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 17:06:45 +0200 Subject: [PATCH 009/323] Fix log --- htdocs/install/upgrade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index a1179ac848b..0a0c2d63219 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -79,9 +79,9 @@ if ($dolibarr_main_db_type == "mssql") { } -dolibarr_install_syslog("--- upgrade: Entering upgrade.php page"); +dolibarr_install_syslog("--- upgrade: entering upgrade.php page ".$versionfrom." ".$versionto); if (!is_object($conf)) { - dolibarr_install_syslog("upgrade2: conf file not initialized", LOG_ERR); + dolibarr_install_syslog("upgrade: conf file not initialized", LOG_ERR); } From e564b063dab0d4f666e438206c4e36c5dcca825c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 20:14:14 +0200 Subject: [PATCH 010/323] FIX Bad error message when dir not writable --- htdocs/langs/en_US/errors.lang | 1 + htdocs/product/stock/massstockmove.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 357c27008f4..997ba200df4 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -65,6 +65,7 @@ ErrorFileNotFound=File %s not found (Bad path, wrong permissions or acces ErrorDirNotFound=Directory %s not found (Bad path, wrong permissions or access denied by PHP openbasedir or safe_mode parameter) ErrorFunctionNotAvailableInPHP=Function %s is required for this feature but is not available in this version/setup of PHP. ErrorDirAlreadyExists=A directory with this name already exists. +ErrorDirNotWritable=Directory %s is not writable. ErrorFileAlreadyExists=A file with this name already exists. ErrorDestinationAlreadyExists=Another file with the name %s already exists. ErrorPartialFile=File not received completely by server. diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index eda59611f88..d8d40111f8a 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -321,12 +321,17 @@ if ($action == 'importCSV' && $user->hasRight('stock', 'mouvement', 'creer')) { $nowyearmonth = dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $fullpath = $conf->stock->dir_temp."/".$user->id.'-csvfiletotimport.csv'; - if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath, 1) > 0) { + $resultupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $fullpath, 1); + if (is_numeric($resultupload) && $resultupload > 0) { dol_syslog("File ".$fullpath." was added for import"); } else { $error++; $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + if ($resultupload === 'ErrorDirNotWritable') { + setEventMessages($langs->trans("ErrorFailedToSaveFile").' - '.$langs->trans($resultupload, $fullpath), null, 'errors'); + } else { + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } } if (!$error) { From f2095952ba55a706ad57ba60d66ea1ff645f9dc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 23:05:30 +0200 Subject: [PATCH 011/323] FIX Mass import of stock from a file must accept empty source --- htdocs/langs/en_US/errors.lang | 1 + .../stock/class/mouvementstock.class.php | 2 +- htdocs/product/stock/massstockmove.php | 116 ++++++++++++++---- 3 files changed, 94 insertions(+), 25 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 52385d6b441..c2bcdd614c0 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -301,6 +301,7 @@ ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first. ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character + ErrorTableNotFound=Table %s not found +ErrorRefNotFound=Ref %s not found ErrorValueForTooLow=Value for %s is too low ErrorValueCantBeNull=Value for %s can't be null ErrorDateOfMovementLowerThanDateOfFileTransmission=The date of the bank transaction can't be lower than the date of the file transmission diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 72b97a44873..54c3815aa37 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -153,7 +153,7 @@ class MouvementStock extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Add a movement of stock (in one direction only). - * This is the lowest level method to record a stock change. + * This is the lowest level method to record a stock change. There is no control if warehouse is open or not. * $this->origin_type and $this->origin_id can be also be set to save the source object of movement. * * @param User $user User object diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 1ebd9ca2e5f..8a2a56fd7c2 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -340,51 +340,114 @@ if ($action == 'importCSV' && !empty($user->rights->stock->mouvement->creer)) { $productstatic = new Product($db); $warehousestatics = new Entrepot($db); $warehousestatict = new Entrepot($db); + + // Loop on each line in CSV file while (($i < $nblinesrecord) && !$error) { - $data[] = $importcsv->import_read_record(); + $newrecord = $importcsv->import_read_record(); + + $data[$i] = $newrecord; if (count($data[$i]) == 1) { // Only 1 empty line unset($data[$i]); $i++; continue; } - //var_dump($data); + $tmp_id_sw = $data[$i][0]['val']; $tmp_id_tw = $data[$i][1]['val']; $tmp_id_product = $data[$i][2]['val']; $tmp_qty = $data[$i][3]['val']; $tmp_batch = $data[$i][4]['val']; - if (!is_numeric($tmp_id_product)) { - $result = fetchref($productstatic, $tmp_id_product); - $tmp_id_product = $result; - $data[$i][2]['val'] = $result; + $errorforproduct = 0; + $isidorref = 'ref'; + if (!is_numeric($tmp_id_product) && $tmp_id_product != '' && preg_match('/^id:/i', $tmp_id_product)) { + $isidorref = 'id'; } - if (!($tmp_id_product > 0)) { + $tmp_id_product = preg_replace('/^(id|ref):/i', '', $tmp_id_product); + + if ($isidorref === 'ref') { + $tmp_id_product = preg_replace('/^ref:/', '', $tmp_id_product); + $result = fetchref($productstatic, $tmp_id_product); + if ($result === -2) { + $error++; + $errorforproduct = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorMultipleRecordFoundFromRef", $tmp_id_product), null, 'errors'); + } elseif ($result <= 0) { + $error++; + $errorforproduct = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorRefNotFound", $tmp_id_product), null, 'errors'); + } + $tmp_id_product = $result; + } + $data[$i][2]['val'] = $tmp_id_product; + if (!$errorforproduct && !($tmp_id_product > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); } - if (!is_numeric($tmp_id_sw)) { - $result = fetchref($warehousestatics, $tmp_id_sw); - $tmp_id_sw = $result; - $data[$i][0]['val'] = $result; - } - if (!($tmp_id_sw > 0)) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WarehouseSource")), null, 'errors'); + if ($tmp_id_sw !== '') { + // For source, we allow empty value + $errorforwarehouses = 0; + $isidorref = 'ref'; + if (!is_numeric($tmp_id_sw) && $tmp_id_sw != '' && preg_match('/^id:/i', $tmp_id_sw)) { + $isidorref = 'id'; + } + $tmp_id_sw = preg_replace('/^(id|ref):/i', '', $tmp_id_sw); + if ($isidorref === 'ref') { + $tmp_id_sw = preg_replace('/^ref:/', '', $tmp_id_sw); + $result = fetchref($warehousestatics, $tmp_id_sw); + if ($result === -2) { + $error++; + $errorforwarehouses = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorMultipleRecordFoundFromRef", $tmp_id_sw), null, 'errors'); + } elseif ($result <= 0) { + $error++; + $errorforwarehouses = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorRefNotFound", $tmp_id_sw), null, 'errors'); + } + $tmp_id_sw = $result; + } + $data[$i][0]['val'] = $tmp_id_sw; + if (!$errorforwarehouses && !($tmp_id_sw > 0)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WarehouseSource")), null, 'errors'); + } } - if (!is_numeric($tmp_id_tw)) { - $result = fetchref($warehousestatict, $tmp_id_tw); - $tmp_id_tw = $result; - $data[$i][1]['val'] = $result; + $errorforwarehouset = 0; + $isidorref = 'ref'; + if (!is_numeric($tmp_id_tw) && $tmp_id_tw != '' && preg_match('/^id:/i', $tmp_id_tw)) { + $isidorref = 'id'; } - if (!($tmp_id_tw > 0)) { + $tmp_id_tw = preg_replace('/^(id|ref):/i', '', $tmp_id_tw); + if ($isidorref === 'ref') { + $tmp_id_tw = preg_replace('/^ref:/', '', $tmp_id_tw); + $result = fetchref($warehousestatict, $tmp_id_tw); + if ($result === -2) { + $error++; + $errorforwarehouset = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorMultipleRecordFoundFromRef", $tmp_id_tw), null, 'errors'); + } elseif ($result <= 0) { + $error++; + $errorforwarehouset = 1; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorRefNotFound", $tmp_id_tw), null, 'errors'); + } + $tmp_id_tw = $result; + } + $data[$i][1]['val'] = $tmp_id_tw; + if (!$errorforwarehouset && !($tmp_id_tw > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("WarehouseTarget")), null, 'errors'); } + // If a source is provided and same than target if ($tmp_id_sw > 0 && $tmp_id_tw == $tmp_id_sw) { $error++; $langs->load("errors"); @@ -428,6 +491,9 @@ if ($action == 'importCSV' && !empty($user->rights->stock->mouvement->creer)) { } } } + if ($error) { + $listofdata = array(); + } $_SESSION['massstockmove'] = json_encode($listofdata); } @@ -633,28 +699,29 @@ print ''; foreach ($listofdata as $key => $val) { + $productstatic->id = 0; $productstatic->fetch($val['id_product']); $warehousestatics->id = 0; - $warehousestatict->id = 0; if ($val['id_sw'] > 0) { $warehousestatics->fetch($val['id_sw']); } + $warehousestatict->id = 0; if ($val['id_tw'] > 0) { $warehousestatict->fetch($val['id_tw']); } if ($productstatic->id <= 0) { $error++; - setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("Product")), null, 'errors'); + setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("Product").' (id='.$val['id_product'].')'), null, 'errors'); } if ($warehousestatics->id < 0) { // We accept 0 for source warehouse id $error++; - setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("WarehouseSource")), null, 'errors'); + setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("WarehouseSource").' (id='.$val['id_sw'].')'), null, 'errors'); } if ($warehousestatict->id <= 0) { $error++; - setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("WarehouseTarget")), null, 'errors'); + setEventMessages($langs->trans("ObjectNotFound", $langs->transnoentitiesnoconv("WarehouseTarget").' (id='.$val['id_tw'].')'), null, 'errors'); } if (!$error) { @@ -752,6 +819,7 @@ function fetchref($static_object, $tmp_ref) if (startsWith($tmp_ref, 'ref:')) { $tmp_ref = str_replace('ref:', '', $tmp_ref); } + $static_object->id = 0; $static_object->fetch('', $tmp_ref); return $static_object->id; } From e00046c2b65b750b2ee4993dd48bba3df03de5fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Oct 2023 23:13:26 +0200 Subject: [PATCH 012/323] FIX Link to list of movement from the inventory code --- htdocs/product/stock/movement_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 06c283eef59..c0e37902b6c 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1481,11 +1481,11 @@ while ($i < $imaxinloop) { } if (!empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code - print 'inventorycode.'$').'&search_type_mouvement='.urlencode($obj->type_mouvement).'">'.$obj->inventorycode.''; + print 'inventorycode.'$').'">'.dol_escape_htmltag($obj->inventorycode).''; } if (!empty($arrayfields['m.label']['checked'])) { // Label of movement - print ''.$obj->label.''; + print ''.dol_escape_htmltag($obj->label).''; } if (!empty($arrayfields['origin']['checked'])) { // Origin of movement From 2075179795b5d288b944d265534547c17b4113cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 01:34:36 +0200 Subject: [PATCH 013/323] Fix responsive --- htdocs/compta/paiement_charge.php | 25 +++++++++++++++---------- htdocs/compta/sociales/list.php | 8 ++++---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 4ae310fe421..b1a120b1df9 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->load("bills"); +$langs->loadLangs(array("banks", "bills", "compta")); $chid = GETPOST("id", 'int'); $action = GETPOST('action', 'aZ09'); @@ -208,7 +208,8 @@ if ($action == 'create') { print ''; print ''.$langs->trans("PaymentMode").''; - $form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype") : $charge->paiementtype, "paiementtype"); + print img_picto('', 'bank', 'class="pictofixedwidth"'); + print $form->select_types_paiements(GETPOSTISSET("paiementtype") ? GETPOST("paiementtype") : $charge->paiementtype, "paiementtype", '', 0, 1, 0, 0, 1, 'maxwidth500 widthcentpercentminusxx', 1); print "\n"; print ''; @@ -216,18 +217,20 @@ if ($action == 'create') { print ''.$langs->trans('AccountToDebit').''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $charge->accountid, "accountid", 0, '', 2); // Show opend bank account list + print $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $charge->accountid, "accountid", 0, '', 2, '', 0, 'maxwidth500 widthcentpercentminusx', 1); // Show opend bank account list print ''; // Number print ''.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + if (empty($conf->dol_optimize_smallscreen)) { + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + } print ''; - print ''."\n"; + print ''."\n"; print ''; print ''.$langs->trans("Comments").''; - print ''; + print ''; print ''; print ''; @@ -240,6 +243,7 @@ if ($action == 'create') { $num = 1; $i = 0; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; //print ''; @@ -265,13 +269,13 @@ if ($action == 'create') { print "\n"; } - print '"; + print '"; - print '"; + print '"; - print '"; + print '"; - print '
'.$langs->trans("SocialContribution").'!!!'.price($objp->amount)."'.price($objp->amount)."'.price($sumpaid)."'.price($sumpaid)."'.price($objp->amount - $sumpaid)."'.price($objp->amount - $sumpaid)."'; + print ''; if ($sumpaid < $objp->amount) { $namef = "amount_".$objp->id; $nameRemain = "remain_".$objp->id; @@ -304,6 +308,7 @@ if ($action == 'create') { } print "
"; + print '
'; // Save payment button print '
'.$langs->trans("ClosePaidContributionsAutomatically"); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 5594f92862e..5fce0895c97 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -634,7 +634,7 @@ $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; -$totalarray['val'] = array(); +$totalarray['val'] = array('totalttcfield'=>0); $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -800,7 +800,9 @@ while ($i < $imaxinloop) { print $bankstatic->getNomUrl(1); } print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Amount @@ -808,8 +810,6 @@ while ($i < $imaxinloop) { print ''.price($obj->amount).''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; } $totalarray['val']['totalttcfield'] += $obj->amount; From d3c95491546dabebba9b17b0a21485e5e6e05afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 01:36:44 +0200 Subject: [PATCH 014/323] Comment dead code --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/supplier_proposal/class/supplier_proposal.class.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b122114793c..826255fdc44 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2474,6 +2474,7 @@ class Propal extends CommonObject * @return int <0 if ko, >0 if ok * @deprecated remise_percent is a deprecated field for object parent */ + /* public function set_remise_percent($user, $remise, $notrigger = 0) { // phpcs:enable @@ -2526,7 +2527,7 @@ class Propal extends CommonObject return -1; } - + */ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a817f992898..9bfb28e2a6f 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1533,6 +1533,7 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ + /* public function set_remise_percent($user, $remise) { // phpcs:enable @@ -1555,7 +1556,7 @@ class SupplierProposal extends CommonObject } return 0; } - + */ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** From 21f602bf05551f9375e3292958de234ed2c4df67 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:01:51 +0300 Subject: [PATCH 015/323] fix suppliers_bills_payment link (#26361) --- htdocs/core/menus/init_menu_auguria.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 9ac9eff352e..a01e673e862 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -222,7 +222,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?mainmenu=billing&action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'billing', '', 1600__+MAX_llx_menu__, '/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', 'List', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?mainmenu=billing&leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'billing', 'suppliers_bills_payment', 1600__+MAX_llx_menu__, '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1605__+MAX_llx_menu__, 'billing', 'suppliers_bills_reports', 1603__+MAX_llx_menu__, '/fourn/facture/rapport.php?mainmenu=billing&leftmenu=suppliers_bills_reports', 'Reporting', 2, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); From 1a5592624bc4a0dffab56f93d2169d1e50184303 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:07:21 +0300 Subject: [PATCH 016/323] fix suppliers bills payment url (#26372) --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 50a37908d36..6a82c3bf18c 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -409,4 +409,4 @@ ALTER TABLE llx_projet ADD COLUMN extraparams varchar(255); DELETE FROM llx_const WHERE name = 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'; - +UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment'; From f8d81e3ae00b1aa344d97fa4d1d135f97b22af27 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:07:28 +0300 Subject: [PATCH 017/323] fix suppliers bills payment url (#26373) --- htdocs/install/mysql/migration/17.0.0-18.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 76857a50989..b475c8702ce 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -563,3 +563,5 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_VALIDATE', 'HR Evaluation validated', 'Executed when an evaluation is validated', 'hrm', 4002); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_UNVALIDATE', 'HR Evaluation back to draft', 'Executed when an evaluation is back to draft', 'hrm', 4003); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HRM_EVALUATION_DELETE', 'HR Evaluation deleted', 'Executed when an evaluation is dleted', 'hrm', 4005); + +UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment'; From 40ea006536c6f4fbacd896e0171bbddd44e77295 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 12:22:54 +0200 Subject: [PATCH 018/323] Debug v19 --- htdocs/api/class/api_access.class.php | 1 + htdocs/api/class/api_documents.class.php | 35 ++++++++++++++++-------- htdocs/api/class/api_setup.class.php | 2 +- htdocs/api/class/api_status.class.php | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 48d57c67506..04c26a0e749 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUs require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Resources.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Defaults.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/RestException.php'; + use Luracast\Restler\iAuthenticate; use Luracast\Restler\iUseAuthentication; use Luracast\Restler\Resources; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 1ae21b0d8ef..89e405354cf 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -22,7 +22,7 @@ use Luracast\Restler\RestException; use Luracast\Restler\Format\UploadFormat; require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/api/class/api.php'; +require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; /** @@ -658,10 +658,6 @@ class Documents extends DolibarrApi throw new RestException(400, 'Modulepart not provided.'); } - if (!DolibarrApiAccess::$user->rights->ecm->upload) { - throw new RestException(401); - } - $newfilecontent = ''; if (empty($fileencoding)) { $newfilecontent = $filecontent; @@ -783,10 +779,17 @@ class Documents extends DolibarrApi $tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier'); } - $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); - - $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); - $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + // Test on permissions + if ($modulepart != 'ecm') { + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); + $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); + $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + } else { + if (!DolibarrApiAccess::$user->hasRight('ecm', 'upload')) { + throw new RestException(401, 'Missing permission to upload files in ECM module'); + } + $upload_dir = $conf->medias->multidir_output[$conf->entity]; + } if (empty($upload_dir) || $upload_dir == '/') { throw new RestException(500, 'This value of modulepart ('.$modulepart.') does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); @@ -799,9 +802,17 @@ class Documents extends DolibarrApi $modulepart = 'adherent'; } - $relativefile = $subdir; - $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); - $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + // Test on permissions + if ($modulepart != 'ecm') { + $relativefile = $subdir; + $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write'); + $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir + } else { + if (!DolibarrApiAccess::$user->hasRight('ecm', 'upload')) { + throw new RestException(401, 'Missing permission to upload files in ECM module'); + } + $upload_dir = $conf->medias->multidir_output[$conf->entity]; + } if (empty($upload_dir) || $upload_dir == '/') { if (!empty($tmp['error'])) { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 50118773b3e..5622d3e0e97 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -24,7 +24,7 @@ use Luracast\Restler\RestException; require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/api/class/api.php'; +require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/cstate.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/cregion.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; diff --git a/htdocs/api/class/api_status.class.php b/htdocs/api/class/api_status.class.php index ac84072927d..899bd1b40aa 100644 --- a/htdocs/api/class/api_status.class.php +++ b/htdocs/api/class/api_status.class.php @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -require_once DOL_DOCUMENT_ROOT.'/api/class/api.php'; +require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; From b177af109e0126dfced47c188e727b4a9388e8eb Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:25:34 +0300 Subject: [PATCH 019/323] fix suppliers bills payment url (#26374) --- htdocs/install/mysql/migration/18.0.0-19.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 3abef2f7a78..060da345369 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -150,3 +150,5 @@ ALTER TABLE llx_resource ADD COLUMN url varchar(255) DEFAULT NULL AFTER email; ALTER TABLE llx_user_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_bank_account ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_societe_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; + +UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment'; From fc3cd7dfcfd5a76b8191cba63a5700e7f677ba99 Mon Sep 17 00:00:00 2001 From: Bhargav Shirin Nalamati Date: Thu, 26 Oct 2023 15:55:54 +0530 Subject: [PATCH 020/323] fixed typo license (#26364) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1eca96e4c48..e90fdca7a6c 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Dolibarr ERP & CRM is a modern software package that helps manage your organizat It's an Open Source Software suite (written in PHP with optional JavaScript enhancements) designed for small, medium or large companies, foundations and freelancers. -You can freely use, study, modify or distribute it according to its licence. +You can freely use, study, modify or distribute it according to its license. You can use it as a standalone application or as a web application to access it from the Internet or a LAN. From 7e3b098f78fcb25fb9db27420df4daa932cd1461 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 26 Oct 2023 12:28:00 +0200 Subject: [PATCH 021/323] fix: when option MAIN_USE_COMPANY_NAME_OF_CONTACT is set the VAT num have to be the VAT num of thirdparty of contact (#26371) --- htdocs/core/lib/pdf.lib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 49e0672e462..611024ceb55 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -642,7 +642,12 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t // Intra VAT if (empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) { - if ($targetcompany->tva_intra) { + if ($usecontact && is_object($targetcontact) && getDolGlobalInt('MAIN_USE_COMPANY_NAME_OF_CONTACT')) { + $targetcontact->fetch_thirdparty(); + if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) { + $stringaddress .= ($stringaddress ? "\n" : '') . $outputlangs->transnoentities("VATIntraShort") . ': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra); + } + } elseif ($targetcompany->tva_intra) { $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra); } } From 3697580d7adcf564eb6bde8077a0c9705b55aafc Mon Sep 17 00:00:00 2001 From: William Mead Date: Thu, 26 Oct 2023 12:36:12 +0200 Subject: [PATCH 022/323] Fix resource data structure missing address state (#26370) * Added fk_state foreign key * Update llx_resource.key.sql * Update 18.0.0-19.0.0.sql --------- Co-authored-by: William Mead Co-authored-by: Laurent Destailleur --- htdocs/install/mysql/migration/18.0.0-19.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_resource.key.sql | 4 ++++ htdocs/install/mysql/tables/llx_resource.sql | 1 + 3 files changed, 8 insertions(+) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 060da345369..436a0d7c953 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -146,6 +146,9 @@ ALTER TABLE llx_resource ADD COLUMN max_users integer DEFAULT NULL AFTER photo_f ALTER TABLE llx_resource ADD COLUMN phone varchar(255) DEFAULT NULL AFTER user_places; ALTER TABLE llx_resource ADD COLUMN email varchar(255) DEFAULT NULL AFTER phone; ALTER TABLE llx_resource ADD COLUMN url varchar(255) DEFAULT NULL AFTER email; +ALTER TABLE llx_resource ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country; +ALTER TABLE llx_resource ADD INDEX idx_resource_fk_state (fk_state); +--ALTER TABLE llx_resource ADD CONSTRAINT fk_resource_fk_state FOREIGN KEY (fk_state) REFERENCES llx_c_departements (rowid); ALTER TABLE llx_user_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_bank_account ADD COLUMN bic_intermediate varchar(11) AFTER bic; diff --git a/htdocs/install/mysql/tables/llx_resource.key.sql b/htdocs/install/mysql/tables/llx_resource.key.sql index bc426f3aa49..4bdd44bfeb2 100644 --- a/htdocs/install/mysql/tables/llx_resource.key.sql +++ b/htdocs/install/mysql/tables/llx_resource.key.sql @@ -1,5 +1,6 @@ -- Module to manage resources into Dolibarr ERP/CRM -- Copyright (C) 2013 Jean-François Ferry +-- Copyright (C) 2023 William Mead -- -- 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 @@ -21,3 +22,6 @@ ALTER TABLE llx_resource ADD INDEX fk_code_type_resource_idx (fk_code_type_resou ALTER TABLE llx_resource ADD INDEX idx_resource_fk_country (fk_country); ALTER TABLE llx_resource ADD CONSTRAINT fk_resource_fk_country FOREIGN KEY (fk_country) REFERENCES llx_c_country (rowid); + +ALTER TABLE llx_resource ADD INDEX idx_resource_fk_state (fk_state); +--ALTER TABLE llx_resource ADD CONSTRAINT fk_resource_fk_state FOREIGN KEY (fk_state) REFERENCES llx_c_departements (rowid); diff --git a/htdocs/install/mysql/tables/llx_resource.sql b/htdocs/install/mysql/tables/llx_resource.sql index 8cda2a5f341..00f13469f06 100644 --- a/htdocs/install/mysql/tables/llx_resource.sql +++ b/htdocs/install/mysql/tables/llx_resource.sql @@ -43,5 +43,6 @@ CREATE TABLE llx_resource import_key varchar(14), extraparams varchar(255), -- for stock other parameters with json format fk_country integer DEFAULT NULL, -- Optional id of original country + fk_state integer DEFAULT NULL, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )ENGINE=innodb; From af17b767c0930f3c1b642bab116d4d1c0612b47c Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:37:18 +0200 Subject: [PATCH 023/323] fix some warnings php8 (#26346) Co-authored-by: Hystepik --- htdocs/accountancy/class/accountingaccount.class.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/workstation/workstation_list.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index bce01982e03..3d2930cf66b 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -496,7 +496,7 @@ class AccountingAccount extends CommonObject $url = ''; $labelurl = ''; if (empty($option) || $option == 'ledger') { - $url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); + $url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode((isset($this->account_number) ? $this->account_number : '')) . '&search_accountancy_code_end=' . urlencode((isset($this->account_number) ? $this->account_number : '')); $labelurl = $langs->trans("ShowAccountingAccountInLedger"); } elseif ($option == 'journals') { $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . urlencode($this->account_number) . '&search_accountancy_code_end=' . urlencode($this->account_number); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f96482038ee..cada5c083ac 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6162,7 +6162,7 @@ abstract class CommonObject //var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]); } if (!empty($extrafields->attributes[$this->table_element]['type'][$key]) && $extrafields->attributes[$this->table_element]['type'][$key] == 'password') { - if (preg_match('/^dolcrypt:/', $value)) { + if (!empty($value) && preg_match('/^dolcrypt:/', $value)) { $this->array_options["options_".$key] = dolDecrypt($value); } } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index cbb06647ed2..eb263ad97fc 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -732,7 +732,7 @@ if ($action == 'create') { $result = $db->query($sql); if ($result) { $objtp = $db->fetch_object($result); - if ($objtp->label != '') { + if (isset($objtp->label) && $objtp->label != '') { $objp->produit = $objtp->label; } } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8786a508f19..570ea0ef6b9 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -556,7 +556,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), (isset($val['notnull']) ? $val['notnull'] : 0), 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index bd265fc92dd..46cc3d40d40 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -594,7 +594,7 @@ print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; - $totalaray['nbfield']++; + $totalarray['nbfield']++; } print ''."\n"; From 6445189eb44be96696f4b04ecd90d499304bb977 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 26 Oct 2023 12:37:47 +0200 Subject: [PATCH 024/323] fix: document linked in asset module permission (#26357) --- htdocs/asset/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 96b222b26c1..be4aa3b1557 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -72,7 +72,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->asset->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object); } -$permissiontoadd = $user->rights->asset->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php // Security check (enable the most restrictive one) if ($user->socid > 0) accessforbidden(); From 753430de5f37ab4cb836227c9452c433ec9b0488 Mon Sep 17 00:00:00 2001 From: Florent Poinsaut <1256948+FlorentPoinsaut@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:40:21 +0200 Subject: [PATCH 025/323] Fix error return value in the dol_delete_preview (#26360) --- htdocs/core/lib/files.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index edb89290592..2111e5c1149 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1558,7 +1558,8 @@ function dol_delete_preview($object) } if (empty($dir)) { - return 'ErrorObjectNoSupportedByFunction'; + $object->error = $langs->trans('ErrorObjectNoSupportedByFunction'); + return 0; } $refsan = dol_sanitizeFileName($object->ref); From 00a936bffa5adae95fe73f3468a1ae7634485fe5 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Thu, 26 Oct 2023 12:42:07 +0200 Subject: [PATCH 026/323] fix #18654 : orders are partially received even if all products have been received (#26358) --- htdocs/reception/class/reception.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 8518709eddd..56b236ad260 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -742,6 +742,8 @@ class Reception extends CommonObject foreach ($supplierorderdispatch->lines as $dispatch_line) { if (array_key_exists($dispatch_line->fk_product, $qty_received)) { $qty_received[$dispatch_line->fk_product] += $dispatch_line->qty; + } else { + $qty_received[$dispatch_line->fk_product] = $dispatch_line->qty; } } From 35906c0af6c5bba5887f526f2d6bb9b02133f161 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 12:43:29 +0200 Subject: [PATCH 027/323] Fix bad test --- htdocs/reception/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 85645b9a237..913bfa11e94 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1074,7 +1074,7 @@ if ($action == 'create') { if (getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') || getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION_CLOSE')) { print ''.$langs->trans("BuyingPrice").''; } - if (isModEnabled('productbatch')) { + if (!isModEnabled('productbatch')) { print '
'.$langs->trans("Fill").''; print '     '.$langs->trans("Reset").'

'; } From a815c99d5320b1a1a611d07ec2a868e88b3d0c18 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 26 Oct 2023 12:48:40 +0200 Subject: [PATCH 028/323] FIX suggested end for membership can be before subscription start (#26351) * Fix wrong debug log * Fix suggested end for membership can be in the past MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR and MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH should be based on the subscription start date, not on the creation date * Fix typo --- htdocs/adherents/class/adherentstats.class.php | 2 +- htdocs/adherents/subscription.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 5075154c4c8..8ae8c77146c 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -282,7 +282,7 @@ class AdherentStats extends Stats $sql .= " GROUP BY c.rowid, c.label"; $sql .= " ORDER BY label ASC"; - dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG); + dol_syslog("box_members_by_tag::select nb of members per tag", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index eb07c7ab048..b9cd776c176 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -990,9 +990,9 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } if (!$dateto) { if (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_MONTH')) { - $dateto = dol_get_last_day($currentyear, $currentmonth); + $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); } elseif (getDolGlobalInt('MEMBER_SUBSCRIPTION_SUGGEST_END_OF_YEAR')) { - $dateto = dol_get_last_day($currentyear); + $dateto = dol_get_last_day(dol_print_date($datefrom, "%Y")); } else { $dateto = -1; // By default, no date is suggested } From e79f7706ade7a8a3ec649d615ae4b515025a569f Mon Sep 17 00:00:00 2001 From: Thibault Fiacre <57494317+atm-thibaultf@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:49:55 +0200 Subject: [PATCH 029/323] FIX_add_customer_ref_on_linked_shipment (#26349) Adding missing customer reference for shipment on linked object block --- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index b00d63eaba1..8c2b03ef085 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { trans("Shipment"); ?> getNomUrl(1); ?> - + ref_customer; ?> date_delivery, 'day'); ?> rights->expedition->lire) { From 2ad04a44468985d59eb424636fd928f3c20c52b3 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 26 Oct 2023 13:15:15 +0200 Subject: [PATCH 030/323] FIX public subscription page should not display acceptation for public register when it is not enabled (#26354) * FIX in public subscription page author to publish in the public register appear even if not enabled i * Fix typo --- htdocs/public/members/new.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2f2a3254a26..8eb591782d8 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -692,9 +692,11 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print ''.$langs->trans("URLPhoto").''."\n"; // Public - $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); - $publiclabel = $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist); - print ''.$publiclabel.''."\n"; + if (!empty($conf->global->MEMBER_PUBLIC_ENABLED)) { + $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); + $publiclabel = $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist); + print ''.$publiclabel.''."\n"; + } // Other attributes $parameters['tpl_context']='public'; // define template context to public From 3e146187ec1462b4c058a4bf572b3a8b256a2a0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 13:31:20 +0200 Subject: [PATCH 031/323] Doc --- htdocs/core/class/commoninvoice.class.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 5e2a3b71210..76420eae4b6 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -192,6 +192,7 @@ abstract class CommonInvoice extends CommonObject * * @param int $multicurrency Return multicurrency_amount instead of amount. -1=Return both. * @return float|int|array Amount of payment already done, <0 and set ->error if KO + * @see getSumDepositsUsed(), getSumCreditNotesUsed() */ public function getSommePaiement($multicurrency = 0) { @@ -236,12 +237,13 @@ abstract class CommonInvoice extends CommonObject } /** - * Return amount (with tax) of all deposits invoices used by invoice. - * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended), - * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended). + * Return amount (with tax) of all deposits invoices used by invoice. + * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended), + * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended). * - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return float <0 and set ->error if KO, Sum of deposits amount otherwise + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return float <0 and set ->error if KO, Sum of deposits amount otherwise + * @see getSommePaiement(), getSumCreditNotesUsed() */ public function getSumDepositsUsed($multicurrency = 0) { @@ -270,10 +272,11 @@ abstract class CommonInvoice extends CommonObject } /** - * Return amount (with tax) of all credit notes invoices + excess received used by invoice + * Return amount (with tax) of all credit notes invoices + excess received used by invoice * - * @param int $multicurrency Return multicurrency_amount instead of amount - * @return float <0 and set ->error if KO, Sum of credit notes and deposits amount otherwise + * @param int $multicurrency Return multicurrency_amount instead of amount + * @return float <0 and set ->error if KO, Sum of credit notes and deposits amount otherwise + * @see getSommePaiement(), getSumDepositsUsed() */ public function getSumCreditNotesUsed($multicurrency = 0) { From 3fa18325c610a87d90d84544d93cdfd6bf36ddde Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 26 Oct 2023 13:31:48 +0200 Subject: [PATCH 032/323] fix: On Object refrent tab on item, supplier invoice status is not correct (#26348) --- htdocs/product/stats/facture_fournisseur.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 20bb56a3c19..8c584349f91 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -264,7 +264,7 @@ if ($id > 0 || !empty($ref)) { print dol_print_date($db->jdate($objp->datef), 'dayhour').""; print ''.$objp->qty."\n"; print ''.price($objp->line_total_ht)."\n"; - print ''.$supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5).''; + print ''.$supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5, $supplierinvoicestatic->getSommePaiement()).''; print "\n"; $i++; } From 3fc0b88633af068b07ca9888be4d4730fc86e96c Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 26 Oct 2023 13:37:21 +0200 Subject: [PATCH 033/323] fix: if field is boolean in filedsarray, it bus be boolean as datatype fog PgSQL (#26335) --- htdocs/install/mysql/tables/llx_asset-asset.sql | 6 +++--- .../llx_asset_depreciation_options_economic-asset.sql | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_asset-asset.sql b/htdocs/install/mysql/tables/llx_asset-asset.sql index 2eed188bc14..65cb9d6b477 100644 --- a/htdocs/install/mysql/tables/llx_asset-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset-asset.sql @@ -43,13 +43,13 @@ CREATE TABLE llx_asset( acquisition_type smallint DEFAULT 0 NOT NULL, asset_type smallint DEFAULT 0 NOT NULL, - not_depreciated integer DEFAULT 0, + not_depreciated boolean DEFAULT false, disposal_date date, disposal_amount_ht double(24,8), fk_disposal_type integer, - disposal_depreciated integer DEFAULT 0, - disposal_subject_to_vat integer DEFAULT 0, + disposal_depreciated boolean DEFAULT false, + disposal_subject_to_vat boolean DEFAULT false, note_public text, note_private text, diff --git a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql index e23a2ed1414..95ac1dc1a1a 100644 --- a/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql +++ b/htdocs/install/mysql/tables/llx_asset_depreciation_options_economic-asset.sql @@ -27,7 +27,7 @@ CREATE TABLE llx_asset_depreciation_options_economic( fk_asset_model integer, depreciation_type smallint DEFAULT 0 NOT NULL, -- 0:linear, 1:degressive, 2:exceptional - accelerated_depreciation_option integer, -- activate accelerated depreciation mode (fiscal) + accelerated_depreciation_option boolean DEFAULT false, -- activate accelerated depreciation mode (fiscal) degressive_coefficient double(24,8), duration smallint NOT NULL, duration_type smallint DEFAULT 0 NOT NULL, -- 0:annual, 1:monthly, 2:daily From 96146fcb6a78a98663e8c1c0ab49509379e6ad3b Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:40:44 +0200 Subject: [PATCH 034/323] New add note for mailing (#26331) Co-authored-by: Hystepik Co-authored-by: Laurent Destailleur --- htdocs/comm/mailing/note.php | 159 ++++++++++++++++++ htdocs/core/lib/emailing.lib.php | 5 + .../install/mysql/migration/18.0.0-19.0.0.sql | 4 + .../mysql/tables/llx_mailing-mailing.sql | 4 +- 4 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 htdocs/comm/mailing/note.php diff --git a/htdocs/comm/mailing/note.php b/htdocs/comm/mailing/note.php new file mode 100644 index 00000000000..597ed1b15ca --- /dev/null +++ b/htdocs/comm/mailing/note.php @@ -0,0 +1,159 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/comm/mailing/note.php + * \ingroup mailing + * \brief Tab for notes on Mailings + */ + +// Load Dolibarr environment +require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("mailing", "companies")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object = new Mailing($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->mailing->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('mailingnote', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$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 // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || !empty($ref)) { + $upload_dir = $conf->mailing->multidir_output[$object->entity]."/".$object->id; +} + +$permissionnote = $user->hasRight('mailing', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('mailing', 'write'); // Used by the include of actions_addupdatedelete.inc.php + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +restrictedArea($user, $object->module, $object->id, $object->table_element, '', '', 'rowid', $isdraft); + + +/* + * Actions + */ + +$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} +if (empty($reshook)) { + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once +} + + +/* + * View + */ + +$form = new Form($db); + +//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$help_url = ''; +llxHeader('', $langs->trans('Mailing'), $help_url); + +if ($id > 0 || !empty($ref)) { + $object->fetch_thirdparty(); + + $head = emailing_prepare_head($object); + + print dol_get_fiche_head($head, 'note', $langs->trans("Mailing"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1); + + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (isModEnabled('project')) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + + $cssclass = "titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 746e3cf13fe..84198e81340 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -61,6 +61,11 @@ function emailing_prepare_head(Mailing $object) $head[$h][2] = 'info'; $h++; + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/note.php?id=".$object->id; + $head[$h][1] = $langs->trans("Note"); + $head[$h][2] = 'note'; + $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing', 'remove'); diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 436a0d7c953..9224bc5aa0f 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -150,6 +150,10 @@ ALTER TABLE llx_resource ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_count ALTER TABLE llx_resource ADD INDEX idx_resource_fk_state (fk_state); --ALTER TABLE llx_resource ADD CONSTRAINT fk_resource_fk_state FOREIGN KEY (fk_state) REFERENCES llx_c_departements (rowid); + +ALTER TABLE llx_mailing ADD COLUMN note_private text; +ALTER TABLE llx_mailing ADD COLUMN note_public text; + ALTER TABLE llx_user_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_bank_account ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_societe_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; diff --git a/htdocs/install/mysql/tables/llx_mailing-mailing.sql b/htdocs/install/mysql/tables/llx_mailing-mailing.sql index f8ee1c567b9..2632d1505c7 100644 --- a/htdocs/install/mysql/tables/llx_mailing-mailing.sql +++ b/htdocs/install/mysql/tables/llx_mailing-mailing.sql @@ -54,5 +54,7 @@ create table llx_mailing joined_file1 varchar(255), joined_file2 varchar(255), joined_file3 varchar(255), - joined_file4 varchar(255) + joined_file4 varchar(255), + note_private text, -- + note_public text, -- )ENGINE=innodb; From ceb78277495259111dac1af00206fe1cdeea410a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 13:43:58 +0200 Subject: [PATCH 035/323] Close #26311 --- htdocs/accountancy/admin/account.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9c15535d0c8..119d2c7a7c2 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -40,6 +40,7 @@ $rowid = GETPOST('rowid', 'int'); $massaction = GETPOST('massaction', 'aZ09'); $optioncss = GETPOST('optioncss', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $search_account = GETPOST('search_account', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); @@ -90,7 +91,7 @@ $arrayfields = array( 'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'), 'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'), 'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1), - 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1), + 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1, 'help'=>''), 'aa.active'=>array('label'=>"Activated", 'checked'=>1) ); From 091d50e809e386adfbbbb0e0ad7ff3ac73fe7c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:55:10 +0200 Subject: [PATCH 036/323] NEW : Add custom Text on footer total (#26334) * NEW : Add custom Text on footer total This function allows you to add a small text to each invoice below the total. Just add a miscellaneous parameter to activate it (to wish the happy new year or an indication of invoicing) * Update pdf_crabe.modules.php * Update pdf_crabe.modules.php --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 737323075c7..c57b948d5e4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -9,7 +9,8 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2017-2018 Ferran Marcet * Copyright (C) 2018-2020 Frédéric France - * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2022 Anthony Berton + * Copyright (C) 2022 Charlene Benke * * 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 @@ -1646,6 +1647,14 @@ class pdf_crabe extends ModelePDFFactures } $index++; + + if (getDolGlobalString("BILL_TEXT_TOTAL_FOOTER")) { + $index++; + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $conf->global->BILL_TEXT_TOTAL_FOOTER, 0, 'L', 0); + } + return ($tab2_top + ($tab2_hl * $index)); } From dc8d6f9ca2ece6d00eaf6ca7aa7e641cea45510d Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+BB2A-Anthony@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:57:40 +0200 Subject: [PATCH 037/323] FIX - Search product category on list det order (#26168) * FIX - Search product category on list det order * Search for tag/category * add search Operator * Clean --------- Co-authored-by: Anthony Berton Co-authored-by: Laurent Destailleur --- htdocs/commande/list_det.php | 80 +++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 23 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 50f6fd82e15..9029cb986ea 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2021-2022 Anthony Berton + * Copyright (C) 2021-2023 Anthony Berton * * 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 @@ -48,6 +48,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (isModEnabled('categorie')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); @@ -73,7 +78,16 @@ $search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_start_mo $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_month', 'int'), GETPOST('search_dateorder_end_day', 'int'), GETPOST('search_dateorder_end_year', 'int')); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_end_month', 'int'), GETPOST('search_datedelivery_end_day', 'int'), GETPOST('search_datedelivery_end_year', 'int')); -$search_product_category = GETPOST('search_product_category', 'int'); + +if (isModEnabled('categorie')) { + $search_product_category_array = GETPOST("search_category_".Categorie::TYPE_PRODUCT."_list", "array"); + $searchCategoryProductOperator = 0; + if (GETPOSTISSET('formfilteraction')) { + $searchCategoryProductOperator = GETPOSTINT('search_category_product_operator'); + } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { + $searchCategoryProductOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; + } +} // Détail commande $search_id = GETPOST('search_id', 'alpha'); @@ -159,7 +173,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( 'c.ref'=>'Ref', 'c.ref_client'=>'RefCustomerOrder', - 'pd.description'=>'Description', + 'cdet.description'=>'Description', 's.nom'=>"ThirdParty", 's.name_alias'=>"AliasNameShort", 's.zip'=>"Zip", @@ -257,7 +271,8 @@ if (empty($reshook)) { $search_categ = ''; $search_user = ''; $search_sale = ''; - $search_product_category = ''; + $search_product_category_array = array(); + $searchCategoryProductOperator = 0; $search_id = ''; $search_refProduct = ''; $search_descProduct = ''; @@ -404,12 +419,6 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as pr ON pr.rowid=cdet.fk_product' if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } -if ($sall || $search_product_category > 0) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande'; -} -if ($search_product_category > 0) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; -} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid'; @@ -421,7 +430,6 @@ if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } - // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -440,9 +448,6 @@ if (!empty($productonly)) { if (!empty($disablelinefree)) { $sql .= " AND cdet.fk_product IS NOT NULL"; } -if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); -} if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); } @@ -592,8 +597,39 @@ if ($search_fk_input_reason > 0) { $sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason); } +// Search for tag/category ($searchCategoryProductList is an array of ID) +$searchCategoryProductList = $search_product_category_array; +if (!empty($searchCategoryProductList)) { + $searchCategoryProjectSqlList = array(); + $listofcategoryid = ''; + foreach ($searchCategoryProductList as $searchCategoryProject) { + if (intval($searchCategoryProject) == -2) { + $searchCategoryProjectSqlList[] = "NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as cp WHERE cdet.fk_product = cp.fk_product)"; + } elseif (intval($searchCategoryProject) > 0) { + if ($searchCategoryProductOperator == 0) { + $searchCategoryProjectSqlList[] = " EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie = ".((int) $searchCategoryProject).")"; + } else { + $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProject); + } + } + } + if ($listofcategoryid) { + $searchCategoryProjectSqlList[] = " EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; + } + if ($searchCategoryProductOperator == 1) { + if (!empty($searchCategoryProjectSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryProjectSqlList).")"; + } + } else { + if (!empty($searchCategoryProjectSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryProjectSqlList).")"; + } + } +} + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook @@ -782,8 +818,10 @@ if ($resql) { if ($search_type_thirdparty && $search_type_thirdparty != '-1') { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } - if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); + if (!empty($search_product_category_array)) { + foreach ($search_product_category_array as $tmpval) { + $param .= '&search_categegory_product_list[]='.urlencode($tmpval); + } } if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $param .= '&search_categ_cus='.urlencode($search_categ_cus); @@ -894,14 +932,10 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } - // If the user can view prospects other than his' + // Filter on categories if (isModEnabled("categorie") && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) { - include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; - $moreforfilter .= '
'; - $tmptitle = $langs->trans('IncludingProductWithTag'); - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1); - $moreforfilter .= '
'; + $formcategory = new FormCategory($db); + $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array, 'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0); } if (isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; From 74609c90a8e7f6c6c7d43ce303a813e105eeae01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 14:03:13 +0200 Subject: [PATCH 038/323] Code comment --- htdocs/core/js/lib_head.js.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index cb54b1f4ef8..9e7e8841bb5 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -253,14 +253,15 @@ function dpChangeDay(dateFieldID, format) /* * ================================================================= - * Function: - * formatDate (javascript object Date(), format) Purpose: Returns a date in the - * output format specified. The format string can use the following tags: Field | - * Tags -------------+------------------------------- Year | yyyy (4 digits), yy - * (2 digits) Month | MM (2 digits) Day of Month | dd (2 digits) Hour (1-12) | - * hh (2 digits) Hour (0-23) | HH (2 digits) Minute | mm (2 digits) Second | ss - * (2 digits) Author: Laurent Destailleur Author: Matelli (see - * http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html) + * Function: formatDate(javascript object Date(), format) + * Purpose: Returns a date in the output format specified. The format string can use the following tags: + * Year | yyyy (4 digits), yy (2 digits) + * Month | MM (2 digits) + * Day of Month | dd (2 digits) + * Hour (1-12) | hh (2 digits) Hour (0-23) | HH (2 digits) + * Minute | mm (2 digits) + * Second | ss (2 digits) + * Author: Laurent Destailleur Author: Matelli (see http://matelli.fr/showcases/patchs-dolibarr/update-date-input-in-action-form.html) * Licence: GPL * ================================================================== */ From 990f9113fc15af7a128b9defd5e7211e29c39b6c Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Thu, 26 Oct 2023 14:03:21 +0200 Subject: [PATCH 039/323] FIX - Auto fill the field end of period with end of month when cloning a salary (#26263) * Auto fill the field end of period * Auto fill the field end of period without jsDate * using formatDate function to format displayed date --- htdocs/langs/en_US/salaries.lang | 1 + htdocs/langs/fr_FR/salaries.lang | 1 + htdocs/salaries/card.php | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index e94669516a8..0097e399d63 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -25,3 +25,4 @@ SalariesAndPayments=Salaries and payments ConfirmDeleteSalaryPayment=Do you want to delete this salary payment ? FillFieldFirst=Fill employee field first UpdateAmountWithLastSalary=Set amount of last salary +FillEndOfMonth=Fill with end of month \ No newline at end of file diff --git a/htdocs/langs/fr_FR/salaries.lang b/htdocs/langs/fr_FR/salaries.lang index c0b8541b1c4..c39763133ff 100644 --- a/htdocs/langs/fr_FR/salaries.lang +++ b/htdocs/langs/fr_FR/salaries.lang @@ -25,3 +25,4 @@ SalariesAndPayments=Salaires et paiements ConfirmDeleteSalaryPayment=Voulez-vous supprimer ce paiement de salaire ? FillFieldFirst=Remplissez d'abord le champ de l'employé UpdateAmountWithLastSalary=Définir sur le montant du dernier salaire +FillEndOfMonth=Remplir avec la fin du mois diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 0e133005ec3..ffdf4b1ebb7 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -738,6 +738,21 @@ if ($id > 0) { $formquestion[] = array('type' => 'text', 'name' => 'amount', 'label' => $langs->trans("Amount"), 'value' => price($object->amount), 'morecss' => 'width100 right'); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneSalary', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 280); + + //Add fill with end of month button + $formconfirm .= ""; } if ($action == 'paid') { From 3f75077f5ea6a81e3ccf3a908b27d551385baacc Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:11:27 +0200 Subject: [PATCH 040/323] NEW - Add edit line on MO (#26122) * Added the possibility of editing lines * Review code * add exit * Add same action * check Travis * Travis * Update mo_production.php --------- Co-authored-by: Laurent Destailleur --- htdocs/mrp/mo_production.php | 303 +++++++++++++++++++++++------------ 1 file changed, 202 insertions(+), 101 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 07e87f1004b..31eb7b2190a 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -456,6 +456,17 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } + + if ($action == 'confirm_editline' && $permissiontoadd) { + $moline = new MoLine($db); + $res = $moline->fetch(GETPOST('lineid', 'int')); + if ($result > 0) { + $moline->qty = GETPOST('qty_lineProduce', 'int'); + $moline->update($user); + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + } } @@ -728,7 +739,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } - if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline', 'addproduceline'))) { + if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline', 'addproduceline', 'editline'))) { print '
'; print ''; print ''; @@ -851,6 +862,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // SplitAll print ''; + //Edit Line + if ($object->status == Mo::STATUS_DRAFT) { + print ''; + } + print ''; if ($action == 'addconsumeline') { @@ -933,116 +949,186 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $alreadyconsumed += $line2['qty']; } - $suffix = '_'.$line->id; - print ''."\n"; - // hidden fields for js function - print ''; - print ''; + if ($action == 'editline' && $lineid == $line->id) { + $linecost = price2num($tmpproduct->pmp, 'MT'); - print ''; - // Product - print ''.$tmpproduct->getNomUrl(1); - print '
'.$tmpproduct->label.'
'; - print ''; - // Qty - print ''; - $help = ''; $picto = 'help'; - if ($line->qty_frozen) { - $help = ($help ? '
' : '').''.$langs->trans("QuantityFrozen").': '.yn(1).' ('.$langs->trans("QuantityConsumedInvariable").')'; - print $form->textwithpicto('', $help, -1, 'lock').' '; - } - if ($line->disable_stock_change) { - $help = ($help ? '
' : '').''.$langs->trans("DisableStockChange").': '.yn(1).' ('.(($tmpproduct->type == Product::TYPE_SERVICE && empty($conf->global->STOCK_SUPPORTS_SERVICES)) ? $langs->trans("NoStockChangeOnServices") : $langs->trans("DisableStockChangeHelp")).')'; - print $form->textwithpicto('', $help, -1, 'help').' '; - } - print price2num($line->qty, 'MS'); - print ''; - // Cost price - if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { - print ''; - print price($linecost); - print ''; - } - // Already consumed - print ''; - if ($alreadyconsumed) { - print ''; - if (empty($conf->use_javascript_ajax)) { - print 'id.'">'; - } - print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce'.$line->id.'"'); - if (empty($conf->use_javascript_ajax)) { - print ''; - } - } else { - if ($nblinetoconsume == $nblinetoconsumecursor) { // If it is the last line - print ''; - } - } - print ' '.price2num($alreadyconsumed, 'MS'); - print ''; - // Warehouse - print ''; - if (!empty($conf->global->STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE) && $tmpwarehouse->id > 0) { - print img_picto('', $tmpwarehouse->picto)." ".$tmpwarehouse->label; - } - print ''; - // Stock - if (isModEnabled('stock')) { - print ''; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $tmpproduct->type != Product::TYPE_SERVICE) { - if (!$line->disable_stock_change && $tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { - print img_warning($langs->trans('StockTooLow')) . ' '; + print ''; + if (empty($conf->use_javascript_ajax)) { + print 'id . '">'; } - if (empty($conf->global->STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE) || empty($tmpwarehouse->id)) { - print price2num($tmpproduct->stock_reel, 'MS'); // Available - } else { - // Print only the stock in the selected warehouse - $tmpproduct->load_stock(); - $wh_stock = $tmpproduct->stock_warehouse[$tmpwarehouse->id]; - if (!empty($wh_stock)) { - print price2num($wh_stock->real, 'MS'); + print img_picto($langs->trans("ShowDetails"), "chevron-down", 'id="expandtoproduce' . $line->id . '"'); + if (empty($conf->use_javascript_ajax)) { + print ''; + } + } else { + if ($nblinetoconsume == $nblinetoconsumecursor) { // If it is the last line + print ''; + } + } + print ' ' . price2num($alreadyconsumed, 'MS'); + print ''; + // Warehouse + print ''; + if (!empty($conf->global->STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE) && $tmpwarehouse->id > 0) { + print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; + } + print ''; + // Stock + if (isModEnabled('stock')) { + print ''; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $tmpproduct->type != Product::TYPE_SERVICE) { + if (!$line->disable_stock_change && $tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { + print img_warning($langs->trans('StockTooLow')) . ' '; + } + if (empty($conf->global->STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE) || empty($tmpwarehouse->id)) { + print price2num($tmpproduct->stock_reel, 'MS'); // Available } else { - print "0"; + // Print only the stock in the selected warehouse + $tmpproduct->load_stock(); + $wh_stock = $tmpproduct->stock_warehouse[$tmpwarehouse->id]; + if (!empty($wh_stock)) { + print price2num($wh_stock->real, 'MS'); + } else { + print "0"; + } } } + print ''; } - print ''; - } - // Lot - if (isModEnabled('productbatch')) { + // Lot + if (isModEnabled('productbatch')) { + print ''; + } + + // Split print ''; + + // Split All + print ''; + + // Action Edit line + if ($object->status == Mo::STATUS_DRAFT) { + $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line->id); + print ''; + print ''; + print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit'); + print ''; + print ''; + } + + // Action delete line + if ($permissiontodelete) { + $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=deleteline&token=' . newToken() . '&lineid=' . ((int) $line->id); + print ''; + print ''; + print img_picto($langs->trans('TooltipDeleteAndRevertStockMovement'), 'delete'); + print ''; + print ''; + } + + print ''; } - - // Split - print ''; - - // Split All - print ''; - - // Action delete line - if ($permissiontodelete) { - $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id); - print ''; - print ''; - print img_picto($langs->trans('TooltipDeleteAndRevertStockMovement'), 'delete'); - print ''; - print ''; - } - - print ''; - // Show detailed of already consumed with js code to collapse foreach ($arrayoflines as $line2) { print ''; @@ -1096,6 +1182,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Split All print ''; + // Action Edit line + if ($object->status == Mo::STATUS_DRAFT) { + $href = $_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id) . '&action=editline&token=' . newToken() . '&lineid=' . ((int) $line->id); + print ''; + print ''; + print img_picto($langs->trans('TooltipEditAndRevertStockMovement'), 'edit'); + print ''; + print ''; + } + // Action delete line if ($permissiontodelete) { $href = $_SERVER["PHP_SELF"].'?id='.((int) $object->id).'&action=deleteline&token='.newToken().'&lineid='.((int) $line->id).'&fk_movement='.((int) $line2['fk_stock_movement']); @@ -1130,7 +1226,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Qty - print ''; + print ''; // Cost if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { @@ -1183,6 +1279,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; + // Edit Line + if ($object->status == Mo::STATUS_DRAFT) { + print ''; + } + // Action delete line if ($permissiontodelete) { print ''; From 8fa8666735889a1323c8ba6688c5a56a917284fb Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:47:34 +0200 Subject: [PATCH 041/323] Fix mysql error in project time (#26375) Co-authored-by: Hystepik --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index eb8bfc29ad4..2876cadc9fb 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1586,7 +1586,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " WHERE elementtype = 'task'"; - $sql .= " ND p.entity IN (".getEntity('project').")"; + $sql .= " AND p.entity IN (".getEntity('project').")"; if (empty($projectidforalltimes) && empty($allprojectforuser)) { // Limit on one task $sql .= " AND t.fk_element =".((int) $object->id); From c3b3840f080b5ad7ff46c6286b9c3c748a974933 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Thu, 26 Oct 2023 16:30:38 +0200 Subject: [PATCH 042/323] QUAL Refactor merging companies and fix #26272 with Reception objects (#26320) * societe: add missing model_pdf field The field is used by the class but wasn't declared. * societe: expose Societe::mergeCompany The code is directly copied from societe/card.php with as less changes as possible. The original code came from deb91ad7c17490934c988b36823a21ba03354733. * societe: remove fields from property copy $phone_pro and $fk_project are not existing for societe. This was added from deb91ad7c17490934c988b36823a21ba03354733. * SocieteTest: test the merge functionality This test is a simple smoke test to check that the mergeCompany() will work correctly on simple case and actually merge the details of the company. More complex deduplication pattern with objects referencing the deleted Societe object, will be written for each of the different object class in their respective test file. * societe: card: use the new mergeCompany function Since the code is almost the same, there should be no differences in behaviour right now. * societe: api_thirdparties: use Societe::mergeCompany() * societe: fix issue when merging companies When a Societe object is merged against another, its related objects are supposed to reference the new Societe object so that the databse doesn't raise foreign key errors. The list references the objects that need to be transformed, and Reception objects weren't part of this list. Fix #26272 * ReceptionTest: check company merge hook Before a Societe object is destroyed from the database, every object referencing the FK should be destroyed or should reference another object. In the case of two companies being merged, the case arises and Reception objects need to be moved to the new company. This commit brings a non-regression test for this case. Refs #26272 * Update societe.class.php --------- Co-authored-by: Laurent Destailleur --- htdocs/societe/card.php | 169 +--------------- .../societe/class/api_thirdparties.class.php | 154 +------------- htdocs/societe/class/societe.class.php | 191 ++++++++++++++++++ test/phpunit/ReceptionTest.php | 30 +++ test/phpunit/SocieteTest.php | 36 ++++ 5 files changed, 264 insertions(+), 316 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8bb244ec2c6..4a9bec03360 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -15,6 +15,7 @@ * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022-2023 George Gkantinas * Copyright (C) 2023 Nick Fragoulis + * Copyright (C) 2023 Alexandre Janniaux * * 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 @@ -197,7 +198,6 @@ if (empty($reshook)) { } if ($action == 'confirm_merge' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) { - $error = 0; $soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin = new Societe($db); // The thirdparty that we will delete @@ -209,174 +209,13 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); $error++; } - if (!$error) { - // TODO Move the merge function into class of object. - - $db->begin(); - - // Recopy some data - $object->client = $object->client | $soc_origin->client; - $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; - $listofproperties = array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'socialnetworks', 'url', 'barcode', - 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', - 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', - 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', - 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', - 'model_pdf', 'fk_projet' - ); - foreach ($listofproperties as $property) { - if (empty($object->$property)) { - $object->$property = $soc_origin->$property; - } - } - - // Concat some data - $listofproperties = array( - 'note_public', 'note_private' - ); - foreach ($listofproperties as $property) { - $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); - } - - // Merge extrafields - if (is_array($soc_origin->array_options)) { - foreach ($soc_origin->array_options as $key => $val) { - if (empty($object->array_options[$key])) { - $object->array_options[$key] = $val; - } - } - } - - // If alias name is not defined on target thirdparty, we can store in it the old name of company. - if (empty($object->name_bis) && $object->name != $soc_origin->name) { - $object->name_bis = $soc_origin->name; - } - - // Merge categories - $static_cat = new Categorie($db); - - $custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id'); - $custcats = $static_cat->containing($object->id, 'customer', 'id'); - $custcats = array_merge($custcats, $custcats_ori); - $object->setCategories($custcats, 'customer'); - - $suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id'); - $suppcats = $static_cat->containing($object->id, 'supplier', 'id'); - $suppcats = array_merge($suppcats, $suppcats_ori); - $object->setCategories($suppcats, 'supplier'); - - // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. - if ($soc_origin->code_client == $object->code_client - || $soc_origin->code_fournisseur == $object->code_fournisseur - || $soc_origin->barcode == $object->barcode) { - dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); - $soc_origin->code_client = ''; - $soc_origin->code_fournisseur = ''; - $soc_origin->barcode = ''; - $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); - } - - // Update - $result = $object->update($object->id, $user, 0, 1, 1, 'merge'); - + $result = $object->mergeCompany($soc_origin_id); if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); $error++; - } - - // Move links - if (!$error) { - // This list is also into the api_thirdparties.class.php - // TODO Mutualise the list into object societe.class.php - $objects = array( - 'Adherent' => '/adherents/class/adherent.class.php', - 'Don' => array('file' => '/don/class/don.class.php', 'enabled' => isModEnabled('don')), - 'Societe' => '/societe/class/societe.class.php', - //'Categorie' => '/categories/class/categorie.class.php', - 'ActionComm' => '/comm/action/class/actioncomm.class.php', - 'Propal' => '/comm/propal/class/propal.class.php', - 'Commande' => '/commande/class/commande.class.php', - 'Facture' => '/compta/facture/class/facture.class.php', - 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', - 'Mo' => '/mrp/class/mo.class.php', - 'Contact' => '/contact/class/contact.class.php', - 'Contrat' => '/contrat/class/contrat.class.php', - 'Expedition' => '/expedition/class/expedition.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', - 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', - 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', - 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Delivery' => '/delivery/class/delivery.class.php', - 'Product' => '/product/class/product.class.php', - 'Project' => '/projet/class/project.class.php', - 'Ticket' => array('file' => '/ticket/class/ticket.class.php', 'enabled' => isModEnabled('ticket')), - 'User' => '/user/class/user.class.php', - 'Account' => '/compta/bank/class/account.class.php', - 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' - ); - - //First, all core objects must update their tables - foreach ($objects as $object_name => $object_file) { - if (is_array($object_file)) { - if (empty($object_file['enabled'])) { - continue; - } - $object_file = $object_file['file']; - } - - require_once DOL_DOCUMENT_ROOT.$object_file; - - if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } - } - } - - // External modules should update their ones too - if (!$error) { - $parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id); - $reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $object, $action); - - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $error++; - } - } - - - if (!$error) { - $object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id, 'mergefromname'=>$soc_origin->name); - - // Call trigger - $result = $object->call_trigger('COMPANY_MODIFY', $user); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - // End call triggers - } - - if (!$error) { - // We finally remove the old thirdparty - if ($soc_origin->delete($soc_origin->id, $user) < 1) { - setEventMessages($soc_origin->error, $soc_origin->errors, 'errors'); - $error++; - } - } - - if (!$error) { - setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); - $db->commit(); + setEventMessages($object->error, $object->errors, 'errors'); } else { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); - $db->rollback(); + setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); } } } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c89f2efa313..6daaa9529a1 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2018 Pierre Chéné * Copyright (C) 2019 Cedric Ancelin * Copyright (C) 2020-2021 Frédéric France + * Copyright (C) 2023 Alexandre Janniaux * * 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 @@ -330,7 +331,7 @@ class Thirdparties extends DolibarrApi */ public function merge($id, $idtodelete) { - global $hookmanager; + global $user; $error = 0; @@ -352,7 +353,6 @@ class Thirdparties extends DolibarrApi } $companytoremove = new Societe($this->db); - $result = $companytoremove->fetch($idtodelete); // include the fetch of extra fields if (!$result) { throw new RestException(404, 'Thirdparty not found'); @@ -362,158 +362,10 @@ class Thirdparties extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $soc_origin = $companytoremove; - $object = $this->company; $user = DolibarrApiAccess::$user; - - - // Call same code than into action 'confirm_merge' - - - $this->db->begin(); - - // Recopy some data - $object->client = $object->client | $soc_origin->client; - $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; - $listofproperties = array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'url', 'barcode', - 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', - 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', - 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', - 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', - 'model_pdf', 'fk_projet' - ); - foreach ($listofproperties as $property) { - if (empty($object->$property)) { - $object->$property = $soc_origin->$property; - } - } - - // Concat some data - $listofproperties = array( - 'note_public', 'note_private' - ); - foreach ($listofproperties as $property) { - $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); - } - - // Merge extrafields - if (is_array($soc_origin->array_options)) { - foreach ($soc_origin->array_options as $key => $val) { - if (empty($object->array_options[$key])) { - $object->array_options[$key] = $val; - } - } - } - - // Merge categories - $static_cat = new Categorie($this->db); - $custcats = $static_cat->containing($soc_origin->id, 'customer', 'id'); - $object->setCategories($custcats, 'customer'); - $suppcats = $static_cat->containing($soc_origin->id, 'supplier', 'id'); - $object->setCategories($suppcats, 'supplier'); - - // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. - if ($soc_origin->code_client == $object->code_client - || $soc_origin->code_fournisseur == $object->code_fournisseur - || $soc_origin->barcode == $object->barcode) { - dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); - $soc_origin->code_client = ''; - $soc_origin->code_fournisseur = ''; - $soc_origin->barcode = ''; - $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); - } - - // Update - $result = $object->update($object->id, $user, 0, 1, 1, 'merge'); + $result = $this->company->mergeCompany($companytoremove->id); if ($result < 0) { - $error++; - } - - // Move links - if (!$error) { - // This list is also into the societe/card.php file - // TODO Mutualise the list into object societe.class.php - $objects = array( - 'Adherent' => '/adherents/class/adherent.class.php', - 'Don' => '/don/class/don.class.php', - 'Societe' => '/societe/class/societe.class.php', - //'Categorie' => '/categories/class/categorie.class.php', - 'ActionComm' => '/comm/action/class/actioncomm.class.php', - 'Propal' => '/comm/propal/class/propal.class.php', - 'Commande' => '/commande/class/commande.class.php', - 'Facture' => '/compta/facture/class/facture.class.php', - 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', - 'Mo' => '/mrp/class/mo.class.php', - 'Contact' => '/contact/class/contact.class.php', - 'Contrat' => '/contrat/class/contrat.class.php', - 'Expedition' => '/expedition/class/expedition.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', - 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', - 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', - 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Delivery' => '/delivery/class/delivery.class.php', - 'Product' => '/product/class/product.class.php', - 'Project' => '/projet/class/project.class.php', - 'Ticket' => '/ticket/class/ticket.class.php', - 'User' => '/user/class/user.class.php', - 'Account' => '/compta/bank/class/account.class.php', - 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' - ); - - //First, all core objects must update their tables - foreach ($objects as $object_name => $object_file) { - require_once DOL_DOCUMENT_ROOT.$object_file; - - if (!$error && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $object->id)) { - $error++; - //setEventMessages($this->db->lasterror(), null, 'errors'); - } - } - } - - // External modules should update their ones too - if (!$error) { - $parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $object->id); - $action = ''; - $reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $object, $action); - - if ($reshook < 0) { - //setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $error++; - } - } - - - if (!$error) { - $object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id); - - // Call trigger - $result = $object->call_trigger('COMPANY_MODIFY', $user); - if ($result < 0) { - //setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - // End call triggers - } - - if (!$error) { - //We finally remove the old thirdparty - if ($soc_origin->delete($soc_origin->id, $user) < 1) { - $error++; - } - } - - // End of merge - - if ($error) { - $this->db->rollback(); - throw new RestException(500, 'Error failed to merged thirdparty '.$companytoremove->id.' into '.$id.'. Enable and read log file for more information.'); - } else { - $this->db->commit(); } return $this->get($id); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3bca12e7e31..e64ed76c3ff 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -18,6 +18,7 @@ * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 ButterflyOfFire + * Copyright (C) 2023 Alexandre Janniaux * * 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 @@ -5406,4 +5407,194 @@ class Societe extends CommonObject return -1; } } + + /** + * Merge a company with another one, deleting the given company. + * + * @param int $soc_origin_id Company to merge the data from + * @return int -1 if error + * + * @note The company given in parameter will be removed. + * + */ + public function mergeCompany($soc_origin_id) + { + global $langs, $hookmanager, $user; + + $error = 0; + $soc_origin = new Societe($this->db); // The thirdparty that we will delete + + if (!$error && $soc_origin->fetch($soc_origin_id) < 1) { + $this->error = $langs->trans('ErrorRecordNotFound'); + $error++; + } + + if (!$error) { + $this->db->begin(); + + // Recopy some data + $this->client = $this->client | $soc_origin->client; + $this->fournisseur = $this->fournisseur | $soc_origin->fournisseur; + $listofproperties = array( + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'fax', 'email', 'socialnetworks', 'url', 'barcode', + 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', + 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', + 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', + 'model_pdf', + ); + foreach ($listofproperties as $property) { + if (empty($this->$property)) { + $this->$property = $soc_origin->$property; + } + } + + // Concat some data + $listofproperties = array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) { + $this->$property = dol_concatdesc($this->$property, $soc_origin->$property); + } + + // Merge extrafields + if (is_array($soc_origin->array_options)) { + foreach ($soc_origin->array_options as $key => $val) { + if (empty($this->array_options[$key])) { + $this->array_options[$key] = $val; + } + } + } + + // If alias name is not defined on target thirdparty, we can store in it the old name of company. + if (empty($this->name_bis) && $this->name != $soc_origin->name) { + $this->name_bis = $this->name; + } + + // Merge categories + $static_cat = new Categorie($this->db); + + $custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id'); + $custcats = $static_cat->containing($this->id, 'customer', 'id'); + $custcats = array_merge($custcats, $custcats_ori); + $this->setCategories($custcats, 'customer'); + + $suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id'); + $suppcats = $static_cat->containing($this->id, 'supplier', 'id'); + $suppcats = array_merge($suppcats, $suppcats_ori); + $this->setCategories($suppcats, 'supplier'); + + // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. + if ($soc_origin->code_client == $this->code_client + || $soc_origin->code_fournisseur == $this->code_fournisseur + || $soc_origin->barcode == $this->barcode) { + dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); + $soc_origin->code_client = ''; + $soc_origin->code_fournisseur = ''; + $soc_origin->barcode = ''; + $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); + } + + // Update + $result = $this->update($this->id, $user, 0, 1, 1, 'merge'); + + if ($result < 0) { + $error++; + } + + // Move links + if (!$error) { + $objects = array( + 'Adherent' => '/adherents/class/adherent.class.php', + 'Don' => array('file' => '/don/class/don.class.php', 'enabled' => isModEnabled('don')), + 'Societe' => '/societe/class/societe.class.php', + //'Categorie' => '/categories/class/categorie.class.php', + 'ActionComm' => '/comm/action/class/actioncomm.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Commande' => '/commande/class/commande.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Mo' => '/mrp/class/mo.class.php', + 'Contact' => '/contact/class/contact.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Expedition' => '/expedition/class/expedition.class.php', + 'Fichinter' => '/fichinter/class/fichinter.class.php', + 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'Reception' => '/reception/class/reception.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'Delivery' => '/delivery/class/delivery.class.php', + 'Product' => '/product/class/product.class.php', + 'Project' => '/projet/class/project.class.php', + 'Ticket' => array('file' => '/ticket/class/ticket.class.php', 'enabled' => isModEnabled('ticket')), + 'User' => '/user/class/user.class.php', + 'Account' => '/compta/bank/class/account.class.php', + 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' + ); + + //First, all core objects must update their tables + foreach ($objects as $object_name => $object_file) { + if (is_array($object_file)) { + if (empty($object_file['enabled'])) { + continue; + } + $object_file = $object_file['file']; + } + + require_once DOL_DOCUMENT_ROOT.$object_file; + + if (!$error && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $this->id)) { + $error++; + $this->error = $this->db->lasterror(); + break; + } + } + } + + // External modules should update their ones too + if (!$error) { + $parameters = array('soc_origin' => $soc_origin->id, 'soc_dest' => $this->id); + $reshook = $hookmanager->executeHooks('replaceThirdparty', $parameters, $this, $action); + + if ($reshook < 0) { + $this->error = $hookmanager->error; + $this->errors = $hookmanager->errors; + $error++; + } + } + + + if (!$error) { + $this->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id, 'mergefromname'=>$soc_origin->name); + + // Call trigger + $result = $this->call_trigger('COMPANY_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$error) { + // We finally remove the old thirdparty + if ($soc_origin->delete($soc_origin->id, $user) < 1) { + $this->error = $soc_origin->error; + $this->errors = $soc_origin->errors; + $error++; + } + } + + if (!$error) { + $this->db->commit(); + return 0; + } else { + $langs->load("errors"); + $this->error = $langs->trans('ErrorsThirdpartyMerge'); + $this->db->rollback(); + return -1; + } + } + } } diff --git a/test/phpunit/ReceptionTest.php b/test/phpunit/ReceptionTest.php index 01034f397ce..c861c433cdb 100644 --- a/test/phpunit/ReceptionTest.php +++ b/test/phpunit/ReceptionTest.php @@ -356,6 +356,36 @@ class ReceptionTest extends PHPUnit\Framework\TestCase return $obj; } + /** + * testReceptionMergeCompanies + * + * Check that a Reception referencing a Societe object being merged into + * another is correctly migrated to use the new Societe object. + * + * @param $localobject An existing validated Reception object to mark as Draft. + * + * @depends testReceptionSetDraft + * @return Reception a Reception object with data fetched + */ + public function testReceptionMergeCompanies($localobject) + { + global $db, $user; + $soc2 = new Societe($db); + $soc2->name = "Test reception"; + $soc2_id = $soc2->create($user); + $this->assertLessThanOrEqual($soc2_id, 0, "Cannot create second Societe object:\n". + $soc2->errorsToString()); + + $result = $soc2->mergeCompany($localobject->id); + $this->assertLessThanOrEqual($result, 0, "Cannot merge Societe object:\n". + $soc2->errorsToString()); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThanOrEqual($result, 0); + + return $result; + } + /** * testReceptionDelete * diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index ce086f179cc..9933d47fb56 100644 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -500,4 +500,40 @@ class SocieteTest extends PHPUnit\Framework\TestCase return $localobjectadd->id; } + + /** + * testSocieteMerge + * + * Check that we can merge two companies together. In this test, + * no other object is referencing the companies. + * + * @return int the result of the merge and fetch operation + */ + public function testSocieteMerge() + { + global $user, $db; + + $soc1 = new Societe($db); + $soc1->initAsSpecimen(); + $soc1_id = $soc1->create($user); + $this->assertLessThanOrEqual($soc1_id, 0); + + $soc2 = new Societe($db); + $soc2->entity = 1; + $soc2->name = "Copy of ".$soc1->name; + $soc2->code_client = 'CC-0002'; + $soc2->code_fournisseur = 'SC-0002'; + $soc2_id = $soc2->create($user); + $this->assertLessThanOrEqual($soc2_id, 0, implode('\n', $soc2->errors)); + + $result = $soc1->mergeCompany($soc2_id); + $this->assertLessThanOrEqual($result, 0, implode('\n', $soc1->errors)); + + $result = $soc1->fetch($soc1_id); + $this->assertLessThanOrEqual($result, 0); + + print __METHOD__." result=".$result."\n"; + + return $result; + } } From 145cfcbb2674508b1e164af17f366d2b37c298e3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 26 Oct 2023 16:34:17 +0200 Subject: [PATCH 043/323] NEW : Allow to have products not managed in stocks - SQL Part (#26190) * NEW : Allow to have products not managed in stocks - SQL Part * Update as proposed --- .../install/mysql/migration/18.0.0-19.0.0.sql | 4 +++ htdocs/install/mysql/tables/llx_product.sql | 36 ++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 9224bc5aa0f..ad26c25766b 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -134,6 +134,10 @@ insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALU insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '5.2', 'Πιστωτικό Τιμολόγιο / Μη Συσχετιζόμενο', 1); insert into llx_c_invoice_subtype (entity, fk_country, code, label, active) VALUES (1, 102, '11.4', 'Πιστωτικό Στοιχ. Λιανικής', 1); +-- Product/service managed in stock +ALTER TABLE llx_product ADD COLUMN stockable_product integer DEFAULT 1 NOT NULL; +UPDATE llx_product set stockable_product = 0 WHERE type = 1; + ALTER TABLE llx_prelevement_lignes ADD COLUMN fk_user integer NULL; ALTER TABLE llx_hrm_evaluationdet ADD COLUMN comment TEXT; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 2267113e987..bbe9af415d7 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -1,10 +1,11 @@ -- ============================================================================ --- Copyright (C) 2002-2006 Rodolphe Quiedeville --- Copyright (C) 2008-2017 Laurent Destailleur --- Copyright (C) 2005-2010 Regis Houssin --- Copyright (C) 2010 Juanjo Menent --- Copyright (C) 2012-2013 Cédric Salvador --- Copyright (C) 2014 Marcos García +-- Copyright (C) 2002-2006 Rodolphe Quiedeville +-- Copyright (C) 2008-2017 Laurent Destailleur +-- Copyright (C) 2005-2010 Regis Houssin +-- Copyright (C) 2010 Juanjo Menent +-- Copyright (C) 2012-2013 Cédric Salvador +-- Copyright (C) 2014 Marcos García +-- Copyright (C) 2023 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 @@ -37,9 +38,9 @@ create table llx_product description text, note_public text, note text, - customcode varchar(32), -- Optionnal custom code - fk_country integer DEFAULT NULL, -- Optionnal id of original country - fk_state integer DEFAULT NULL, -- Optionnal id of original state/province + customcode varchar(32), -- Optional custom code + fk_country integer DEFAULT NULL, -- Optional id of original country + fk_state integer DEFAULT NULL, -- Optional id of original state/province price double(24,8) DEFAULT 0, -- price without tax price_ttc double(24,8) DEFAULT 0, -- price inc vat (but not localtax1 nor localtax2) price_min double(24,8) DEFAULT 0, @@ -68,10 +69,10 @@ create table llx_product barcode varchar(180) DEFAULT NULL, -- barcode fk_barcode_type integer DEFAULT NULL, -- barcode type accountancy_code_sell varchar(32), -- Selling accountancy code - accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intracommunity + accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intra-community accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export accountancy_code_buy varchar(32), -- Buying accountancy code - accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intracommunity + accountancy_code_buy_intra varchar(32), -- Buying accountancy code for vat intra-community accountancy_code_buy_export varchar(32), -- Buying accountancy code for vat export partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode. net_measure float DEFAULT NULL, @@ -88,24 +89,25 @@ create table llx_product surface_units tinyint DEFAULT NULL, volume float DEFAULT NULL, volume_units tinyint DEFAULT NULL, - stock real, -- Current physical stock (dernormalized field) + stockable_product integer DEFAULT 1 NOT NULL, + stock real, -- Current physical stock (denormalized field) pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. fk_default_warehouse integer DEFAULT NULL, canvas varchar(32) DEFAULT NULL, - finished tinyint DEFAULT NULL, -- see dictionnary c_product_nature + finished tinyint DEFAULT NULL, -- see dictionary c_product_nature lifetime integer DEFAULT NULL, qc_frequency integer DEFAULT NULL, -- Quality control periodicity hidden tinyint DEFAULT 0, -- Not used. Deprecated. import_key varchar(14), -- Import key - model_pdf varchar(255), -- model save dodument used + model_pdf varchar(255), -- model save document used fk_price_expression integer, -- Link to the rule for dynamic price calculation - desiredstock float DEFAULT 0, + desiredstock float DEFAULT 0, fk_unit integer DEFAULT NULL, price_autogen tinyint DEFAULT 0, - fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project - mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) + fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specific to a project + mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action) fk_default_bom integer DEFAULT NULL, fk_default_workstation integer DEFAULT NULL From 40fb7c5fa7ce338511b9eb79907d61401616f85b Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Thu, 26 Oct 2023 17:12:57 +0200 Subject: [PATCH 044/323] FIX Payement infos for Fournisseur add change company condition for get default infos (#26305) * add change company condition for get default infos * fix it for compta/facture also --- htdocs/compta/facture/card.php | 35 +++++++++++++++++++++++----------- htdocs/fourn/facture/card.php | 24 ++++++++++++++++++++--- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 32dd9d686df..a93a66854e7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3182,9 +3182,9 @@ if ($action == 'create') { } } } else { - $cond_reglement_id = $soc->cond_reglement_id; - $mode_reglement_id = $soc->mode_reglement_id; - $fk_account = $soc->fk_account; + $cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id; + $mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id; + $fk_account = empty($soc->fk_account) ? $fk_account : $soc->fk_account; //$remise_percent = $soc->remise_percent; //$remise_absolue = 0; $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970) @@ -3194,6 +3194,19 @@ if ($action == 'create') { } } + // If form was posted (but error returned), we must reuse the value posted in priority (standard Dolibarr behaviour) + if (!GETPOST('changecompany')) { + if (GETPOSTISSET('cond_reglement_id')) { + $cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + } + if (GETPOSTISSET('mode_reglement_id')) { + $mode_reglement_id = GETPOST('mode_reglement_id', 'int'); + } + if (GETPOSTISSET('cond_reglement_id')) { + $fk_account = GETPOST('fk_account', 'int'); + } + } + // when payment condition is empty (means not override by payment condition form a other object, like third-party), try to use default value if (empty($cond_reglement_id)) { $cond_reglement_id = GETPOST("cond_reglement_id", 'int'); @@ -3205,11 +3218,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account - $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company - } else { // No company forced - $fk_account = GETPOST("fk_account", 'int'); - } + // if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + // $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + // } else { // No company forced + // $fk_account = GETPOST("fk_account", 'int'); + // } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); @@ -3776,7 +3789,7 @@ if ($action == 'create') { // Payment term print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx'); + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx'); print ''; @@ -3833,14 +3846,14 @@ if ($action == 'create') { // Payment mode print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); - print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); + print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print ''; // Bank Account if (isModEnabled("banque")) { print ''.$langs->trans('BankAccount').''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(($fk_account < 0 ? '' : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print ''; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3f5e2ece7eb..3cc3764464e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2196,12 +2196,27 @@ if ($action == 'create') { $mode_reglement_id = GETPOST("mode_reglement_id"); } + // If form was posted (but error returned), we must reuse the value posted in priority (standard Dolibarr behaviour) + if (!GETPOST('changecompany')) { + if (GETPOSTISSET('cond_reglement_id')) { + $cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + } + if (GETPOSTISSET('mode_reglement_id')) { + $mode_reglement_id = GETPOST('mode_reglement_id', 'int'); + } + if (GETPOSTISSET('cond_reglement_id')) { + $fk_account = GETPOST('fk_account', 'int'); + } + } + $note_public = $object->getDefaultCreateValueFor('note_public', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_public : null)); $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc) && !empty($conf->global->FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM)) ? $objectsrc->note_private : null)); print ''; print ''; print ''; + print ''; // will be set to 1 by javascript so we know post is done after a company change + if (!empty($societe->id) && $societe->id > 0) { print ''."\n"; } @@ -2244,6 +2259,7 @@ if ($action == 'create') { console.log("We have changed the company - Reload page"); // reload page $("input[name=action]").val("create"); + $("input[name=changecompany]").val("1"); $("form[name=add]").submit(); }); }); @@ -2592,7 +2608,8 @@ if ($action == 'create') { // Payment term print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ?GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1); + print ''; // Due date @@ -2604,13 +2621,14 @@ if ($action == 'create') { // Payment mode print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); - $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ?GETPOST('mode_reglement_id', 'int') : $mode_reglement_id, 'mode_reglement_id', 'DBIT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'DBIT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account if (isModEnabled("banque")) { print ''.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOSTISSET('fk_account') ?GETPOST('fk_account', 'alpha') : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print ''; } From 9bfeb5e4245243539bcc3f4794e6712938b2601d Mon Sep 17 00:00:00 2001 From: atm-lena <52402938+atm-lena@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:13:36 +0200 Subject: [PATCH 045/323] Add Hook "printFieldListFrom" in supplier order list (#26376) Co-authored-by: atm-lena --- htdocs/fourn/commande/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4b2d08f18d8..7c8cdeb2dfd 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -531,6 +531,9 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cf.fk_projet"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= ' WHERE cf.fk_soc = s.rowid'; $sql .= ' AND cf.entity IN ('.getEntity('supplier_order').')'; if ($socid > 0) $sql .= " AND s.rowid = ".$socid; From 9d25ea418fff3ea4c703167f6160392257846187 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 17:45:03 +0200 Subject: [PATCH 046/323] Clean code to use getDolGlobalInt --- htdocs/takepos/pay.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 22d161a4bec..57ab0b4fb0e 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -261,7 +261,7 @@ if ($invoice->id > 0) { } $alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0); -if (getDolGlobalInt('TAKEPOS_NUMPAD') == 0) { +if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { print "var received='';"; } else { print "var received=0;"; @@ -273,7 +273,7 @@ if (getDolGlobalInt('TAKEPOS_NUMPAD') == 0) { function addreceived(price) { global->TAKEPOS_NUMPAD)) { + if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { print 'received+=String(price);'."\n"; } else { print 'received+=parseFloat(price);'."\n"; @@ -348,7 +348,7 @@ if (getDolGlobalInt('TAKEPOS_NUMPAD') == 0) { parent.$.colorbox.close(); } else { - console.log("Amount is not comple, so we do NOT close popup and reload it."); + console.log("Amount is not complete, so we do NOT close popup and reload it."); location.reload(); } }); @@ -680,7 +680,7 @@ if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && !empty($conf-> } $keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]; -if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { +if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP")) { if (getDolGlobalString($keyforsumupbank)) { print ''; } else { From 11c1094b76a0b23d57a5b6a33a48463cfc3bf7c9 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 26 Oct 2023 17:49:19 +0200 Subject: [PATCH 047/323] FIX : TakePOS - fix option TAKEPOS_PRODUCT_IN_STOCK must read on the POS warehouse (#24809) * fix stock displayed * fix php8 * fix php8 * fix * php8 * fix group by * fix empty --------- Co-authored-by: Christophe Battarel --- htdocs/takepos/ajax/ajax.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 709c3ad42ef..4afe70c42c1 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -262,7 +262,11 @@ if ($action == 'getProducts') { $sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price, p.price_ttc' ; if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) { - $sql .= ', ps.reel'; + if (getDolGlobalInt('CASHDESK_ID_WAREHOUSE'.$_SESSION['takeposterminal'])) { + $sql .= ', ps.reel'; + } else { + $sql .= ', SUM(ps.reel) as reel'; + } } /* this will be possible when field archive will be supported into llx_product_price if (getDolGlobalString('PRODUIT_MULTIPRICES')) { @@ -284,7 +288,9 @@ if ($action == 'getProducts') { if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_stock as ps'; $sql .= ' ON (p.rowid = ps.fk_product'; - $sql .= " AND ps.fk_entrepot = ".((int) getDolGlobalInt("CASHDESK_ID_WAREHOUSE".$_SESSION['takeposterminal'])); + if (getDolGlobalString('CASHDESK_ID_WAREHOUSE'.$_SESSION['takeposterminal'])) { + $sql .= " AND ps.fk_entrepot = ".((int) getDolGlobalInt("CASHDESK_ID_WAREHOUSE".$_SESSION['takeposterminal'])); + } $sql .= ')'; } @@ -300,7 +306,7 @@ if ($action == 'getProducts') { $sql .= ' AND EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN ('.$db->sanitize($filteroncategids).'))'; } $sql .= ' AND p.tosell = 1'; - if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) { + if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1 && getDolGlobalInt('CASHDESK_ID_WAREHOUSE'.$_SESSION['takeposterminal'])) { $sql .= ' AND ps.reel > 0'; } $sql .= natural_search(array('ref', 'label', 'barcode'), $term); @@ -311,6 +317,17 @@ if ($action == 'getProducts') { $sql .= $hookmanager->resPrint; } + if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1 && !getDolGlobalInt('CASHDESK_ID_WAREHOUSE'.$_SESSION['takeposterminal'])) { + $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price, p.price_ttc'; + // Add fields from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); + if ($reshook >= 0) { + $sql .= $hookmanager->resPrint; + } + $sql .= ' HAVING SUM(ps.reel) > 0'; + } + // load only one page of products $sql.= $db->plimit($search_limit, $search_start); From 4761d70cd9e0f52ed3afd8b5e476d042143de352 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Thu, 26 Oct 2023 17:58:42 +0200 Subject: [PATCH 048/323] NEW Default customer, category and product when enable TakePOS (#25031) * Default customer, category and product when enable TakePOS * Update cashdesk.lang * Default category and product when enable TakePOS Easy setup for TakePOS. Create a category and product when TakePOS is enabled. It checks if TakePOS has already been configured to avoid recreating the category and productif it has already been created. * Update modTakePos.class.php * Update modTakePos.class.php * Update cashdesk.lang --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/modTakePos.class.php | 48 +++++++++++++++++++++++- htdocs/langs/en_US/cashdesk.lang | 3 ++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index ff8b0c80516..25bd1c37d80 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -25,6 +25,7 @@ * \brief Description and activation file for the module TakePos */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; /** @@ -266,9 +267,54 @@ class modTakePos extends DolibarrModules */ public function init($options = '') { - global $conf, $db; + global $conf, $db, $langs, $user; + $langs->load("cashdesk"); dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); + + //Default customer for Point of sale + if (empty(getDolGlobalInt('CASHDESK_ID_THIRDPARTY1'))) { + $societe = new Societe($db); + + $societe->name = $langs->trans("DefaultPOSThirdLabel"); + $societe->client = 1; + $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer." + + $result = $societe->create($user); + if ($result > 0) { + dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY1", $result, 'chaine', 0, '', $conf->entity); + } else { + setEventMessages($societe->error, $societe->errors, 'errors'); + } + } + + //Create category if not exists + $categories = new Categorie($this->db); + $cate_arbo = $categories->get_full_arbo('product', 0, 1); + if (is_array($cate_arbo)) { + if (!count($cate_arbo)) { + $category = new Categorie($db); + + $category->label = $langs->trans("DefaultPOSCatLabel"); + $category->type = Categorie::TYPE_PRODUCT; + + $result = $category->create($user); + + if ($result > 0) { + /* TODO Create a generic product only if there is no product in category $result yet */ + /* + $product = new Product($db); + $product->status = 1; + $product->ref = "takepos"; + $product->label = $langs->trans("DefaultPOSProductLabel"); + $product->create($user); + $product->setCategories($result); + */ + } else { + setEventMessages($category->error, $category->errors, 'errors'); + } + } + } $result = $this->_load_tables('/install/mysql/', 'takepos'); if ($result < 0) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 8222a1415a0..8cce6064d01 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -145,6 +145,9 @@ ShowProductReference=Show reference or label of products UsePriceHT=Use price excl. taxes and not price incl. taxes TerminalName=Terminal %s TerminalNameDesc=Terminal name +DefaultPOSThirdLabel=TakePOS generic customer +DefaultPOSCatLabel=Category for Point Of Sale products +DefaultPOSProductLabel=Product example for TakePOS TakeposNeedsPayment=TakePOS needs a payment method to work, do you want to create the payment method 'Cash'? LineDiscount=Line discount LineDiscountShort=Line disc. From 3403f357538268deb35f571e42cabad00c427934 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 18:00:23 +0200 Subject: [PATCH 049/323] Code comment --- htdocs/core/modules/modTakePos.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 25bd1c37d80..e3957456934 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -271,15 +271,15 @@ class modTakePos extends DolibarrModules $langs->load("cashdesk"); dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - + //Default customer for Point of sale if (empty(getDolGlobalInt('CASHDESK_ID_THIRDPARTY1'))) { $societe = new Societe($db); $societe->name = $langs->trans("DefaultPOSThirdLabel"); $societe->client = 1; - $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer." - + $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; + $result = $societe->create($user); if ($result > 0) { dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY1", $result, 'chaine', 0, '', $conf->entity); @@ -287,21 +287,21 @@ class modTakePos extends DolibarrModules setEventMessages($societe->error, $societe->errors, 'errors'); } } - + //Create category if not exists $categories = new Categorie($this->db); $cate_arbo = $categories->get_full_arbo('product', 0, 1); if (is_array($cate_arbo)) { if (!count($cate_arbo)) { $category = new Categorie($db); - + $category->label = $langs->trans("DefaultPOSCatLabel"); $category->type = Categorie::TYPE_PRODUCT; - + $result = $category->create($user); if ($result > 0) { - /* TODO Create a generic product only if there is no product in category $result yet */ + /* TODO Create a generic product only if there is no product yet. If 0 product, we create 1. If there is already product, it is better to show a message to ask to add product in the category */ /* $product = new Product($db); $product->status = 1; @@ -309,7 +309,7 @@ class modTakePos extends DolibarrModules $product->label = $langs->trans("DefaultPOSProductLabel"); $product->create($user); $product->setCategories($result); - */ + */ } else { setEventMessages($category->error, $category->errors, 'errors'); } From a4218a142c5e9caf886d46a6c968bc2d676d615f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 18:11:34 +0200 Subject: [PATCH 050/323] Look and feel v19 --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/admin/terminal.php | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 8cce6064d01..f9d444bb9ec 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -146,7 +146,7 @@ UsePriceHT=Use price excl. taxes and not price incl. taxes TerminalName=Terminal %s TerminalNameDesc=Terminal name DefaultPOSThirdLabel=TakePOS generic customer -DefaultPOSCatLabel=Category for Point Of Sale products +DefaultPOSCatLabel=Point Of Sale (POS) products DefaultPOSProductLabel=Product example for TakePOS TakeposNeedsPayment=TakePOS needs a payment method to work, do you want to create the payment method 'Cash'? LineDiscount=Line discount diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 39699100941..35557b91c09 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -159,8 +159,9 @@ print ''; print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; +print img_picto('', 'company', 'class="pictofixedwidth"'); $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; -print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminaltouse), 'socid', $filter, 1, 0, 0, array(), 0); +print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminaltouse), 'socid', $filter, 1, 0, 0, array(), 0, 'maxwidth500 widthcentpercentminusx'); print ''; $atleastonefound = 0; @@ -168,7 +169,7 @@ if (isModEnabled("banque")) { print ''.$langs->trans("CashDeskBankAccountForSell").''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1, '', 0, '', 1); + print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); print ' '; if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse)) { $atleastonefound++; @@ -177,7 +178,7 @@ if (isModEnabled("banque")) { print ''.$langs->trans("CashDeskBankAccountForCheque").''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1, '', 0, '', 1); + print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); print ' '; if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse)) { $atleastonefound++; @@ -186,7 +187,7 @@ if (isModEnabled("banque")) { print ''.$langs->trans("CashDeskBankAccountForCB").''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1, '', 0, '', 1); + print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); print ' '; if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse)) { $atleastonefound++; @@ -234,7 +235,7 @@ if (isModEnabled("banque")) { print ''.$langs->trans("CashDeskBankAccountForSumup").''; print ''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1, '', 0, '', 1); + print $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); print ' '; if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse)) { $atleastonefound++; @@ -254,7 +255,7 @@ if (isModEnabled("banque")) { } $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, '', 1); + print $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1, '', 0, 'maxwidth500 widthcentpercentminusxx', 1); print ' '; print ''; } @@ -287,8 +288,8 @@ if (isModEnabled('stock')) { print ''; // Force warehouse (this is not a default value) print ''; if (!$disabled) { - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $formproduct->selectWarehouses(getDolGlobalString('CASHDESK_ID_WAREHOUSE'.$terminal), 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth250'); + print img_picto('', 'stock', 'class="pictofixedwidth"'); + print $formproduct->selectWarehouses(getDolGlobalString('CASHDESK_ID_WAREHOUSE'.$terminal), 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print ' '; } else { print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; @@ -359,7 +360,7 @@ if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") { print ''; print $langs->trans("BillsNumberingModule"); print ''; - $array = array(0=>$langs->trans("Default")); + $array = array(0 => $langs->trans("Default")); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/facture/"); From 197f0a19ec207914f359e8ee6d23adb698a59a35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 21:05:37 +0200 Subject: [PATCH 051/323] NEW Add more param on fetch() to prepare perf optimization --- .../facture/class/facture-rec.class.php | 29 +++++++---- htdocs/contrat/class/contrat.class.php | 52 ++++++++++++------- htdocs/core/class/commonobject.class.php | 23 ++++++-- .../template/class/myobject.class.php | 23 ++++---- 4 files changed, 83 insertions(+), 44 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ce297c63f5f..4ce63e0161e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -534,9 +534,11 @@ class FactureRec extends CommonInvoice * @param int $rowid Id of object to load * @param string $ref Reference of recurring invoice * @param string $ref_ext External reference of invoice + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields + * @param int $nolines 0=Default to load lines, 1=No lines * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($rowid, $ref = '', $ref_ext = '') + public function fetch($rowid, $ref = '', $ref_ext = '', $noextrafields = 0, $nolines = 0) { dol_syslog('FactureRec::fetch', LOG_DEBUG); @@ -620,16 +622,23 @@ class FactureRec extends CommonInvoice // Retrieve all extrafield // fetch optionals attributes and labels - $this->fetch_optionals(); - - /* - * Lines - */ - $result = $this->fetch_lines(); - if ($result < 0) { - $this->error = $this->db->lasterror(); - return -3; + if (empty($noextrafields)) { + $result = $this->fetch_optionals(); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -4; + } } + + // Retreive lines + if (empty($nolines)) { + $result = $this->fetch_lines(); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -3; + } + } + return 1; } else { $this->error = 'Bill with id '.$rowid.' or ref '.$ref.' not found'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index bb01930b9e0..490548926b2 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -660,15 +660,17 @@ class Contrat extends CommonObject } /** - * Load a contract from database + * Load a contract from database * - * @param int $id Id of contract to load - * @param string $ref Ref - * @param string $ref_customer Customer ref - * @param string $ref_supplier Supplier ref - * @return int <0 if KO, 0 if not found or if two records found for same ref, Id of contract if OK + * @param int $id Id of contract to load + * @param string $ref Ref + * @param string $ref_customer Customer ref + * @param string $ref_supplier Supplier ref + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields + * @param int $nolines 0=Default to load lines, 1=No lines + * @return int <0 if KO, 0 if not found or if two records found for same ref, Id of contract if OK */ - public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '') + public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '', $noextrafields = 0, $nolines = 0) { $sql = "SELECT rowid, statut as status, ref, fk_soc as thirdpartyid,"; $sql .= " ref_supplier, ref_customer,"; @@ -740,16 +742,23 @@ class Contrat extends CommonObject // Retrieve all extrafields // fetch optionals attributes and labels - $result = $this->fetch_optionals(); - - // Lines - if ($result >= 0 && !empty($this->table_element_line)) { - $result = $this->fetch_lines(); + if (empty($noextrafields)) { + $result = $this->fetch_optionals(); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -4; + } } - if ($result < 0) { - $this->error = $this->db->lasterror(); - return -3; + // Lines + if (empty($nolines)) { + if ($result >= 0 && !empty($this->table_element_line)) { + $result = $this->fetch_lines(); + if ($result < 0) { + $this->error = $this->db->lasterror(); + return -3; + } + } } return $this->id; @@ -775,11 +784,12 @@ class Contrat extends CommonObject * Load lines array into this->lines. * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * - * @param int $only_services 0=Default, 1=Force only services (depending on setup, we may also have physical products in a contract) - * @param int $loadalsotranslation 0=Default, 1=Load also translations of product descriptions - * @return array|int Return array of contract lines + * @param int $only_services 0=Default for all, 1=Force only services (depending on setup, we may also have physical products in a contract) + * @param int $loadalsotranslation 0=Default to not load translations, 1=Load also translations of product descriptions + * @param int $noextrafields 0=Default to load extrafields, 1=Do not load the extrafields of lines + * @return array|int Return array of contract lines */ - public function fetch_lines($only_services = 0, $loadalsotranslation = 0) + public function fetch_lines($only_services = 0, $loadalsotranslation = 0, $noextrafields = 0) { // phpcs:enable $this->nbofservices = 0; @@ -895,7 +905,9 @@ class Contrat extends CommonObject // Retrieve all extrafields for contract line // fetch optionals attributes and labels - $line->fetch_optionals(); + if (empty($noextrafields)) { + $line->fetch_optionals(); + } // multilangs if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($objp->fk_product) && !empty($loadalsotranslation)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index cada5c083ac..d81afcf87fe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9584,14 +9584,15 @@ abstract class CommonObject /** - * Load object in memory from the database + * Load object in memory from the database. This does not load line. This is done by parent fetch() that call fetchCommon * * @param int $id Id object * @param string $ref Ref * @param string $morewhere More SQL filters (' AND ...') + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetchCommon($id, $ref = null, $morewhere = '') + public function fetchCommon($id, $ref = null, $morewhere = '', $noextrafields = 0) { if (empty($id) && empty($ref) && empty($morewhere)) { return -1; @@ -9628,7 +9629,14 @@ abstract class CommonObject // Retrieve all extrafield // fetch optionals attributes and labels - $this->fetch_optionals(); + if (empty($noextrafields)) { + $result = $this->fetch_optionals(); + if ($result < 0) { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + return -4; + } + } return $this->id; } else { @@ -9645,9 +9653,10 @@ abstract class CommonObject * Load object in memory from the database * * @param string $morewhere More SQL filters (' AND ...') + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetchLinesCommon($morewhere = '') + public function fetchLinesCommon($morewhere = '', $noextrafields = 0) { $objectlineclassname = get_class($this).'Line'; if (!class_exists($objectlineclassname)) { @@ -9677,6 +9686,12 @@ abstract class CommonObject $newline = new $objectlineclassname($this->db); $newline->setVarsFromFetchObj($obj); + // Note: extrafields load of line not yet supported + /* + if (empty($noextrafields)) { + // Load extrafields of line + }*/ + $this->lines[] = $newline; } $i++; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 8201a34c5f7..adabd501c6e 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -401,15 +401,17 @@ class MyObject extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $ref Ref + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields + * @param int $nolines 0=Default to load extrafields, 1=No extrafields + * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null) + public function fetch($id, $ref = null, $noextrafields = 0, $nolines = 0) { - $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); + $result = $this->fetchCommon($id, $ref, '', $noextrafields); + if ($result > 0 && !empty($this->table_element_line) && empty($nolines)) { + $this->fetchLines($noextrafields); } return $result; } @@ -417,13 +419,14 @@ class MyObject extends CommonObject /** * Load object lines in memory from the database * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $noextrafields 0=Default to load extrafields, 1=No extrafields + * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetchLines() + public function fetchLines($noextrafields = 0) { $this->lines = array(); - $result = $this->fetchLinesCommon(); + $result = $this->fetchLinesCommon('', $noextrafields); return $result; } From e68d5ebc3578a8ea11988c906511bc631cb85339 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 21:11:36 +0200 Subject: [PATCH 052/323] Debug v19 --- htdocs/core/modules/modTakePos.class.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index e3957456934..f8a4f77ebec 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -272,17 +272,22 @@ class modTakePos extends DolibarrModules dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - //Default customer for Point of sale - if (empty(getDolGlobalInt('CASHDESK_ID_THIRDPARTY1'))) { + // Default customer for Point of sale + if (!getDolGlobalInt('CASHDESK_ID_THIRDPARTY1')) { // If a customer has already ben set into the TakePos setup page $societe = new Societe($db); + $nametouse = $langs->trans("DefaultPOSThirdLabel"); - $societe->name = $langs->trans("DefaultPOSThirdLabel"); - $societe->client = 1; - $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; + $searchcompanyid = $societe->fetch(0, $nametouse); + if ($searchcompanyid == 0) { + $societe->name = $nametouse; + $societe->client = 1; + $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; - $result = $societe->create($user); - if ($result > 0) { - dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY1", $result, 'chaine', 0, '', $conf->entity); + $searchcompanyid = $societe->create($user); + } + if ($searchcompanyid > 0) { + // We already have or we have create a thirdparty with id = $searchcompanyid, so we link use it into setup + dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY1", $searchcompanyid, 'chaine', 0, '', $conf->entity); } else { setEventMessages($societe->error, $societe->errors, 'errors'); } From e5da68b3bd8101af8742a96dd578ecbfcc9a1ce1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2023 21:16:04 +0200 Subject: [PATCH 053/323] Debug v19 --- htdocs/core/modules/modTakePos.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index f8a4f77ebec..228daac173a 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -281,6 +281,8 @@ class modTakePos extends DolibarrModules if ($searchcompanyid == 0) { $societe->name = $nametouse; $societe->client = 1; + $societe->code_client = -1; + $societe->code_fournisseur = -1; $societe->note_private = "Default customer automaticaly created by Point Of Sale module activation. Can be used as the default generic customer in the Point Of Sale setup. Can also be edited or removed if you don't need a generic customer."; $searchcompanyid = $societe->create($user); From 9138486c5949b8bb47f6c24da8dae4816a0a0041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Fri, 27 Oct 2023 12:47:11 +0200 Subject: [PATCH 054/323] NEW filter on from/to period rather than month/year (#26378) --- htdocs/product/stats/facture.php | 50 +++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 366681eeea8..001c36c0a6a 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -75,12 +75,42 @@ if (!$sortfield) { $sortfield = "f.datef"; } -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); +$search_date_startday = GETPOSTINT('search_date_startday'); +if (!empty($search_date_startday)) { + $option .= '&search_date_startday='.$search_date_startday; +} +$search_date_startmonth = GETPOSTINT('search_date_startmonth'); +if (!empty($search_date_startmonth)) { + $option .= '&search_date_startmonth='.$search_date_startmonth; +} +$search_date_startyear = GETPOSTINT('search_date_startyear'); +if (!empty($search_date_startyear)) { + $option .= '&search_date_startyear='.$search_date_startyear; +} +$search_date_endday = GETPOSTINT('search_date_endday'); +if (!empty($search_date_endday)) { + $option .= '&search_date_endday='.$search_date_endday; +} +$search_date_endmonth = GETPOSTINT('search_date_endmonth'); +if (!empty($search_date_endmonth)) { + $option .= '&search_date_endmonth='.$search_date_endmonth; +} +$search_date_endyear = GETPOSTINT('search_date_endyear'); +if (!empty($search_date_endyear)) { + $option .= '&search_date_endyear='.$search_date_endyear; +} +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { - $search_month = ''; - $search_year = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; } $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -196,11 +226,11 @@ if ($id > 0 || !empty($ref)) { $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND d.fk_facture = f.rowid"; $sql .= " AND d.fk_product = ".((int) $product->id); - if (!empty($search_month)) { - $sql .= ' AND MONTH(f.datef) IN ('.$db->sanitize($search_month).')'; + if ($search_date_start) { + $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'"; } - if (!empty($search_year)) { - $sql .= ' AND YEAR(f.datef) IN ('.$db->sanitize($search_year).')'; + if ($search_date_end) { + $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'"; } if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); @@ -276,8 +306,8 @@ if ($id > 0 || !empty($ref)) { print '
'; print '
'; print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - '; - print $langs->trans('Month').': '; - print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5); + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From ad1c363aa6fcbd874aff8a056815fadad512f9f8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 27 Oct 2023 12:53:03 +0200 Subject: [PATCH 055/323] FIX Supplier card - VAT Reserve Charge - Undefined function isInEEC() (#26379) --- htdocs/fourn/facture/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9b808ebedcb..4bf4be6e76a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2596,6 +2596,7 @@ if ($action == 'create') { // Vat reverse-charge by default if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; print '' . $langs->trans('VATReverseCharge') . ''; // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) { From 05718dd43e2497515166c8e8337ecf0a82e8badf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Oct 2023 15:00:26 +0200 Subject: [PATCH 056/323] Add performance index --- htdocs/install/mysql/migration/18.0.0-19.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_facture_rec.key.sql | 1 + 2 files changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index ad26c25766b..679b27f84d0 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -163,3 +163,5 @@ ALTER TABLE llx_bank_account ADD COLUMN bic_intermediate varchar(11) AFTER bic; ALTER TABLE llx_societe_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment'; + +ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_datec(datec); diff --git a/htdocs/install/mysql/tables/llx_facture_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_rec.key.sql index c17163317c4..e9214a7f564 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.key.sql @@ -24,6 +24,7 @@ ALTER TABLE llx_facture_rec ADD UNIQUE INDEX idx_facture_rec_uk_titre (titre, en ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_soc (fk_soc); ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_user_author (fk_user_author); ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_fk_projet (fk_projet); +ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_datec(datec); ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_facture_rec ADD CONSTRAINT fk_facture_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); From d8116b8ce4d35e38814fbc8dfb838d68ff27237e Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:40:34 +0200 Subject: [PATCH 057/323] Fix recruitement candidature cancel pre-action (#26386) * Fix recruitement candidature cancel pre-action * fix lang file --------- Co-authored-by: Hystepik --- htdocs/langs/en_US/recruitment.lang | 2 ++ htdocs/recruitment/recruitmentcandidature_card.php | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang index 686722a48c5..515e8960cba 100644 --- a/htdocs/langs/en_US/recruitment.lang +++ b/htdocs/langs/en_US/recruitment.lang @@ -77,3 +77,5 @@ ExtrafieldsApplication=Complementary attributes (job applications) MakeOffer=Make an offer WeAreRecruiting=We are recruiting. This is a list of open positions to be filled... NoPositionOpen=No positions open at the moment +ConfirmClose=Confirm cancelation +ConfirmCloseAsk=Are you sure you want to cancel this recruitment candidature diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 9494c9d59cd..a9f40045f7a 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -396,6 +396,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); } + if ($action == 'close') { + $langs->load("propal"); + + //Form to close proposal (signed or not) + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ConfirmClose'), $langs->trans('ConfirmCloseAsk'), 'confirm_close', $formquestion, '', 1, 250); + } + // Confirm create user if ($action == 'create_user') { $login = (GETPOSTISSET('login') ? GETPOST('login', 'alphanohtml') : $object->login); From a7619ecc929c6b42a052f82c249ec0807020021a Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Fri, 27 Oct 2023 19:17:27 +0200 Subject: [PATCH 058/323] Workflow: code quality with early return (#26365) * workflow: use setErrorsFromObject when suitable * workflow: shipping: use early return in for loop * workflow: shipping: combine to previous early return * workflow: shipping: reindent after last changes No functional changes. * workflow: reception: use early return when suitable * workflow: reception: use early return * workflow: reception: reindent after last changes No functional changes. * workflow: ticket: use early return * workflow: ticket: combine condition through an early return * workflow: ticket: reindent after last changes No functional changes. * workflow: propal: remove else condition after terminal if * Update interface_20_modWorkflow_WorkflowManager.class.php * Update interface_20_modWorkflow_WorkflowManager.class.php * Update interface_20_modWorkflow_WorkflowManager.class.php * Update interface_20_modWorkflow_WorkflowManager.class.php --------- Co-authored-by: Laurent Destailleur --- ...e_20_modWorkflow_WorkflowManager.class.php | 128 +++++++++--------- 1 file changed, 63 insertions(+), 65 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 03449f96f2a..d1c5dd066e0 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2017 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2023 Alexandre Janniaux * * 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 @@ -79,25 +80,24 @@ class InterfaceWorkflowManager extends DolibarrTriggers $langs->load("orders"); setEventMessages($langs->trans("OrderExists"), null, 'warnings'); } - return $ret; - } else { - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $newobject = new Commande($this->db); - - $newobject->context['createfrompropal'] = 'createfrompropal'; - $newobject->context['origin'] = $object->element; - $newobject->context['origin_id'] = $object->id; - - $ret = $newobject->createFromProposal($object, $user); - if ($ret < 0) { - $this->error = $newobject->error; - $this->errors[] = $newobject->error; - } - - $object->clearObjectLinkedCache(); - return $ret; } + + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $newobject = new Commande($this->db); + + $newobject->context['createfrompropal'] = 'createfrompropal'; + $newobject->context['origin'] = $object->element; + $newobject->context['origin_id'] = $object->id; + + $ret = $newobject->createFromProposal($object, $user); + if ($ret < 0) { + $this->setErrorsFromObject($newobject); + } + + $object->clearObjectLinkedCache(); + + return $ret; } } @@ -114,10 +114,9 @@ class InterfaceWorkflowManager extends DolibarrTriggers $ret = $newobject->createFromOrder($object, $user); if ($ret < 0) { - $this->error = $newobject->error; - $this->errors[] = $newobject->error; + $this->setErrorsFromObject($newobject); } - + $object->clearObjectLinkedCache(); return $ret; @@ -375,30 +374,28 @@ class InterfaceWorkflowManager extends DolibarrTriggers $order = new Commande($this->db); $ret = $order->fetch($object->origin_id); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } $ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping'); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } //Build array of quantity shipped by product for an order if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) { foreach ($order->linkedObjects as $type => $shipping_array) { - if ($type == 'shipping' && is_array($shipping_array) && count($shipping_array) > 0) { - /** @var Expedition[] $shipping_array */ - foreach ($shipping_array as $shipping) { - if ($shipping->status <= 0) { - continue; - } - if (is_array($shipping->lines) && count($shipping->lines) > 0) { - foreach ($shipping->lines as $shippingline) { - $qtyshipped[$shippingline->fk_product] += $shippingline->qty; - } - } + if ($type != 'shipping' || !is_array($shipping_array) || count($shipping_array) == 0) { + continue; + } + /** @var Expedition[] $shipping_array */ + foreach ($shipping_array as $shipping) { + if ($shipping->status <= 0 || !is_array($shipping->lines) || count($shipping->lines) == 0) { + continue; + } + + foreach ($shipping->lines as $shippingline) { + $qtyshipped[$shippingline->fk_product] += $shippingline->qty; } } } @@ -422,8 +419,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers //No diff => mean everythings is shipped $ret = $order->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } } @@ -448,26 +444,28 @@ class InterfaceWorkflowManager extends DolibarrTriggers $order = new CommandeFournisseur($this->db); $ret = $order->fetch($object->origin_id); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } $ret = $order->fetchObjectLinked($order->id, $order->element, null, 'reception'); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } //Build array of quantity received by product for a purchase order if (is_array($order->linkedObjects) && count($order->linkedObjects) > 0) { foreach ($order->linkedObjects as $type => $shipping_array) { - if ($type == 'reception' && is_array($shipping_array) && count($shipping_array) > 0) { - foreach ($shipping_array as $shipping) { - if (is_array($shipping->lines) && count($shipping->lines) > 0) { - foreach ($shipping->lines as $shippingline) { - $qtyshipped[$shippingline->fk_product] += $shippingline->qty; - } - } + if ($type != 'reception' || !is_array($shipping_array) || count($shipping_array) == 0) { + continue; + } + + foreach ($shipping_array as $shipping) { + if (!is_array($shipping->lines) || count($shipping->lines) == 0) { + continue; + } + + foreach ($shipping->lines as $shippingline) { + $qtyshipped[$shippingline->fk_product] += $shippingline->qty; } } } @@ -491,8 +489,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers //No diff => mean everythings is received $ret = $order->setStatut(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY, null, null, 'SUPPLIER_ORDER_CLOSE'); if ($ret < 0) { - $this->error = $order->error; - $this->errors = $order->errors; + $this->setErrorsFromObject($order); return $ret; } } @@ -511,22 +508,23 @@ class InterfaceWorkflowManager extends DolibarrTriggers foreach ($company_ids as $company_id) { $contrat->socid = $company_id; $list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]); - if (is_array($list) && !empty($list)) { - $number_contracts_found = count($list); - if ($number_contracts_found == 1) { - foreach ($list as $linked_contract) { - $object->setContract($linked_contract->id); - } - break; - } elseif ($number_contracts_found > 1) { - foreach ($list as $linked_contract) { - $object->setContract($linked_contract->id); - // don't set '$contractid' so it is not used when creating an intervention. - } - if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); - break; - } + if (!is_array($list) || empty($list)) { + continue; } + $number_contracts_found = count($list); + if ($number_contracts_found == 0) { + continue; + } + + foreach ($list as $linked_contract) { + $object->setContract($linked_contract->id); + // don't set '$contractid' so it is not used when creating an intervention. + } + + if ($number_contracts_found > 1 && !defined('NOLOGIN')) { + setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); + } + break; } if ($number_contracts_found == 0) { if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); From 46bfae63a37848d7106c0042335f1338c8257bea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 00:06:06 +0200 Subject: [PATCH 059/323] Responsive --- htdocs/societe/tpl/linesalesrepresentative.tpl.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index ded3ff21af9..97ab6e75cca 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -25,7 +25,7 @@ print ''; // Sale representative print ''; -print ''; - - // Margin Infos - if (isModEnabled('margin')) { - $formmargin->displayMarginInfos($object); - } - - - print ''; - print ''; // Close fichecenter - - print '

'; - - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - /* - * Lines - */ - - // Get object lines - $result = $object->getLinesArray(); - - // Add products/services form - //$forceall = 1; - global $inputalsopricewithtax; - $inputalsopricewithtax = 1; - - print ' - - - - - - - '; - - if (!empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - print '
'; +print ''; if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) { @@ -47,7 +47,7 @@ if ($action == 'editsalesrepresentatives') { $arrayselected = $object->getSalesRepresentatives($user, 1); } print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); - print ''; + print ''; print ''; } else { $listsalesrepresentatives = $object->getSalesRepresentatives($user); @@ -59,7 +59,7 @@ if ($action == 'editsalesrepresentatives') { $userstatic->login = $val['login']; $userstatic->lastname = $val['lastname']; $userstatic->firstname = $val['firstname']; - $userstatic->statut = $val['statut']; + $userstatic->status = $val['statut']; $userstatic->photo = $val['photo']; $userstatic->email = $val['email']; $userstatic->office_phone = $val['office_phone']; @@ -67,7 +67,7 @@ if ($action == 'editsalesrepresentatives') { $userstatic->job = $val['job']; $userstatic->entity = $val['entity']; $userstatic->gender = $val['gender']; - print $userstatic->getNomUrl(-1); + print $userstatic->getNomUrl(-1, '', 0, 0, ($nbofsalesrepresentative > 1 ? 16 : (empty($conf->dol_optimize_smallscreen) ? 24 : 20))); print ' '; } } else { From 939cf8b200365c92f03c1c1419ef09079b319555 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 00:59:31 +0200 Subject: [PATCH 060/323] FIX Popup on service ref when product module not enabled --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c156b44bc08..b45cf290423 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5255,7 +5255,7 @@ class Product extends CommonObject } $params = [ 'id' => $this->id, - 'objecttype' => $this->element, + 'objecttype' => (isset($this->type) ? ($this->type == 1 ? 'service' : 'product') : $this->element), 'option' => $option, 'nofetch' => 1, ]; From 6d7d698371c14c1fe397b2d5907ce345dae27067 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 02:06:07 +0200 Subject: [PATCH 061/323] Debug v19 --- htdocs/asset/class/asset.class.php | 6 ++---- htdocs/contrat/card.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/projet/class/project.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index a09d415a1f8..606aaa9b60c 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1466,12 +1466,10 @@ class Asset extends CommonObject $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - $this->user_creation_id = $obj->fk_user_author; - $this->user_validation_id = $obj->fk_user_valid; - $this->user_closing_id = $obj->fk_user_cloture; + $this->user_creation_id = $obj->fk_user_creat; + $this->user_modification_id = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); } $this->db->free($result); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 4907c57774a..21419bd3843 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -777,7 +777,7 @@ if (empty($reshook)) { $objectline->date_start_real = $date_start_real_update; $objectline->date_end = $date_end_update; $objectline->date_end_real = $date_end_real_update; - $objectline->fk_user_cloture = $user->id; + $objectline->user_closing_id = $user->id; //$objectline->fk_fournprice = $fk_fournprice; $objectline->pa_ht = $pa_ht; $objectline->rang = $objectline->rang; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 490548926b2..06a857ed910 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -455,7 +455,7 @@ class Contrat extends CommonObject if ($contratline->statut != ContratLigne::STATUS_CLOSED) { $contratline->date_end_real = $now; $contratline->date_cloture = $now; // For backward compatibility - $contratline->fk_user_cloture = $user->id; + $contratline->user_closing_id = $user->id; $contratline->statut = ContratLigne::STATUS_CLOSED; $result = $contratline->close_line($user, $now, $comment, $notrigger); if ($result < 0) { @@ -3784,7 +3784,7 @@ class ContratLigne extends CommonObjectLine // Update object $this->date_cloture = $date_end_real; $this->date_end_real = $date_end_real; - $this->fk_user_cloture = $user->id; + $this->user_closing_id = $user->id; $this->commentaire = $comment; $error = 0; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1756289e2cd..470c940f10f 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2329,7 +2329,7 @@ class Project extends CommonObject { $sql = 'SELECT c.rowid, datec as datec, tms as datem,'; $sql .= ' date_close as datecloture,'; - $sql .= ' fk_user_creat as fk_user_author, fk_user_close as fk_use_cloture'; + $sql .= ' fk_user_creat as fk_user_author, fk_user_close as fk_user_cloture'; $sql .= ' FROM '.MAIN_DB_PREFIX.'projet as c'; $sql .= ' WHERE c.rowid = '.((int) $id); $result = $this->db->query($sql); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 9bfb28e2a6f..4c01c62d832 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1616,7 +1616,7 @@ class SupplierProposal extends CommonObject if (!empty($note)) { $sql .= " note_private = '".$this->db->escape($note)."',"; } - $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; + $sql .= " date_cloture = NULL, fk_user_cloture = NULL"; $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); From cca296c3abffeb77c20428bc2305a1901fafb508 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 02:10:34 +0200 Subject: [PATCH 062/323] Clean code --- htdocs/projet/messaging.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index cf58a2a3813..113889bdcc5 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -36,6 +36,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ09'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", "aZ09comma"); @@ -180,15 +181,15 @@ if (!empty($object->id)) { print '
'; //print '
'; - $morehtmlcenter = ''; + $morehtmlright = ''; // Show link to change view in message $messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); // Show link to change view in agenda $messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; - $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); // // Show link to send an email (if read and not closed) @@ -204,7 +205,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); } $param = '&id='.$object->id; @@ -221,7 +222,7 @@ if (!empty($object->id)) { $titlelist = $langs->trans("ActionsOnProject").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); - print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 0); + print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); // List of all actions $filters = array(); From 20f4051a4b8bee852b165086d8126ab72f50cdee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 02:14:47 +0200 Subject: [PATCH 063/323] Clean code --- htdocs/societe/messaging.php | 207 ++++++++++++++++++----------------- 1 file changed, 107 insertions(+), 100 deletions(-) diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index b84c6b233dd..2ac17c2f04f 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -32,10 +32,13 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartyagenda'; if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -49,13 +52,6 @@ if (GETPOST('actioncode', 'array')) { $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'societe', $socid, '&societe'); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -73,8 +69,25 @@ if (!$sortorder) { $sortorder = 'DESC,DESC'; } +// Initialize technical objects +$object = new Societe($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('agendathirdparty')); +$hookmanager->initHooks(array('agendathirdparty', 'globalcard')); + +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} + +$result = $object->fetch($socid); +if ($result <= 0) { + accessforbidden('Third party not found'); +} + +$result = restrictedArea($user, 'societe', $socid, '&societe'); + /* @@ -109,112 +122,106 @@ if (empty($reshook)) { $form = new Form($db); -if ($socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +$title = $langs->trans("Agenda"); +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + $title = $object->name." - ".$title; +} +llxHeader('', $title); - $object = new Societe($db); - $result = $object->fetch($socid); +if (isModEnabled('notification')) { + $langs->load("mails"); +} +$head = societe_prepare_head($object); - $title = $langs->trans("Agenda"); - if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { - $title = $object->name." - ".$title; +print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto); + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = ''; + +dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref); + +print '
'; + +print '
'; + +$object->info($socid); +dol_print_object_info($object, 1); + +print '
'; + +print dol_get_fiche_end(); + + + +// Actions buttons + +$objthirdparty = $object; +$objcon = new stdClass(); + +$out = ''; +$permok = $user->hasRight('agenda', 'myactions', 'create'); +if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { + if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { + $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); } - llxHeader('', $title); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); +} - if (isModEnabled('notification')) { - $langs->load("mails"); +$morehtmlright = ''; + +$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); +$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; +$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); + +// // Show link to send an email (if read and not closed) +// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; +// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; +// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + +// // Show link to add a private message (if read and not closed) +// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; +// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; +// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + +if (isModEnabled('agenda')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } - $head = societe_prepare_head($object); +} - print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); +if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { + print '
'; - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); - - print '
'; - - print '
'; - - $object->info($socid); - dol_print_object_info($object, 1); - - print '
'; - - print dol_get_fiche_end(); - - - - // Actions buttons - - $objthirdparty = $object; - $objcon = new stdClass(); - - $out = ''; - $permok = $user->hasRight('agenda', 'myactions', 'create'); - if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { - if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { - $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); - } - $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); - $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); + $param = '&socid='.urlencode($socid); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); } - $morehtmlright = ''; + // Try to know count of actioncomm from cache + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_thirdparty_'.$object->id; + $nbEvent = dol_getcache($cachekey); - $messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; - $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); - $messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; - $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); - - // // Show link to send an email (if read and not closed) - // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - // $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); - - // // Show link to add a private message (if read and not closed) - // $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; - // $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - // $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); - - if (isModEnabled('agenda')) { - if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); - } + $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); + if (!empty($conf->dol_optimize_smallscreen)) { + $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); } - if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { - print '
'; + print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); - $param = '&socid='.urlencode($socid); - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.((int) $limit); - } + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; - // Try to know count of actioncomm from cache - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $cachekey = 'count_events_thirdparty_'.$object->id; - $nbEvent = dol_getcache($cachekey); - - $titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); - if (!empty($conf->dol_optimize_smallscreen)) { - $titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''); - } - - print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0); - - // List of all actions - $filters = array(); - $filters['search_agenda_label'] = $search_agenda_label; - $filters['search_rowid'] = $search_rowid; - - // TODO Replace this with same code than into list.php - show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); - } + // TODO Replace this with same code than into list.php + show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } // End of page From 00e706120d46da03ef7a27dee782c2462ce94d87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Oct 2023 02:17:48 +0200 Subject: [PATCH 064/323] Fix warning --- htdocs/core/lib/functions.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 412a3c89be7..33e3df9cb74 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11374,8 +11374,10 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = // If $url is an array, we must build a dropdown button if (is_array($url)) { + $out = ''; + if (count($url) > 1) { - $out = '
'; print $langs->trans('SalesRepresentatives'); print '
'; print ''; - print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center tdsticky tdstickygray '); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center'); print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); @@ -5039,10 +5050,11 @@ if ($module == 'initmodule') { print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('')); print "\n"; + $r = count($menus)+1; // for adding menu on module print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -5174,7 +5183,7 @@ if ($module == 'initmodule') { print ''; // Enabled print ''; + // Target print ''; print ''; print ''; // Enabled - print ''; // Perms - print ''; + // Target print ''; @@ -5311,13 +5318,15 @@ if ($module == 'initmodule') { print '
'; print '
'; - print ''; + print ''; $htmltext = ''.$langs->trans("Examples").':
'; $htmltext .= '1 (always enabled)
'; $htmltext .= '0 (always disabled)
'; @@ -5218,6 +5227,7 @@ if ($module == 'initmodule') { print ''; }*/ print '
'; @@ -5267,19 +5277,16 @@ if ($module == 'initmodule') { print ''; + print ''; print dol_escape_htmltag($menu['enabled']); print ''; - if (strpos($menu['perms'], "\$user->hasRight") !== 0) { - print ''; - } else { - print (dol_escape_htmltag($langs->trans($crud[$valPerms])) ); - } + print ''; + print dol_escape_htmltag($langs->trans($menu['perms'])); print ''; print dol_escape_htmltag($menu['target']); print '
'; print ''; print ''; + + print ''; // display permissions for each object } else { @@ -6453,6 +6462,7 @@ if ($module == 'initmodule') { print dol_get_fiche_end(); // End modules + // End of page llxFooter(); $db->close(); From 0158c3ff685b16e42264dfedc7a5598f5b09915c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2023 17:36:00 +0100 Subject: [PATCH 070/323] Debug v19 --- htdocs/langs/en_US/modulebuilder.lang | 2 +- htdocs/modulebuilder/index.php | 60 ++++++++++++++++----------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index bed3def3c38..75f1de02de2 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -107,7 +107,7 @@ PermissionsDefDesc=Define here the new permissions provided by your module MenusDefDescTooltip=The menus provided by your module/application are defined into the array $this->menus into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and the module re-activated), the menus are also visible into the menu editor available to administrator users on %s. DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array $this->dictionaries into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s. PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array $this->rights into the module descriptor file. You can edit manually this file or use the embedded editor.

Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s. -HooksDefDesc=Define in the module_parts['hooks'] property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on 'initHooks(' in core code).
Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on 'executeHooks' in core code). +HooksDefDesc=Define in the property module_parts['hooks'], in the module descriptor file, the list of contexts when your hook must be executed (the list of possible contexts can be found by a search on 'initHooks(' in core code).
Then edit the file with hooks code with the code of your hooked functions (the list of hookable functions can be found by a search on 'executeHooks' in core code). TriggerDefDesc=Define in the trigger file the code that you want to execute when a business event external to your module is executed (events triggered by other modules). SeeIDsInUse=See IDs in use in your installation SeeReservedIDsRangeHere=See range of reserved IDs diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index c54394687ca..8c5168725c8 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -5033,22 +5033,29 @@ if ($module == 'initmodule') { print '
'; print ''; + $htmltextenabled = ''.$langs->trans("Examples").':
'; + $htmltextenabled .= '1 (module always enabled)
'; + $htmltextenabled .= '0 (module always disabled)
'; + $htmltextenabled .= 'isModEnabled(\''.dol_escape_htmltag(strtolower($module)).'\') (enabled when module is enabled)'; + $htmltextperms = ''.$langs->trans("Examples").':
'; + $htmltextperms .= '1 (access always allowed)
'; + $htmltextperms .= '$user->hasright(\''.dol_escape_htmltag(strtolower($module)).'\', \'myobject\', \'read\') (access allowed if user has permission module->object->read)'; + print ''; print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center tdsticky tdstickygray '); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center'); - print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'minwidth100 '); print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->transnoentitiesnoconv('DetailUrl')); print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailEnabled')); - print_liste_field_titre("Rights", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailRight')); + print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailEnabled').'

'.$htmltextenabled); + print_liste_field_titre("Rights", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailRight').'

'.$htmltextperms); print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailTarget')); - print_liste_field_titre("MenuForUsers", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailUser')); + print_liste_field_titre("MenuForUsers", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center minwidth100 ', $langs->trans('DetailUser')); print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('')); - print "\n"; $r = count($menus)+1; @@ -5072,18 +5079,14 @@ if ($module == 'initmodule') { print ''; print ''; print ''; - print ''; + // URL + print ''; print ''; // Position print ''; // Enabled print ''; - print ''; + // Position (top, left) print ''; - print ''; - print ''; + // Parent menu + print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + // URL + print ''; + print ''; // Position print ''; // Enabled @@ -5198,7 +5206,7 @@ if ($module == 'initmodule') { */ print ''; // Permissions - print ''; - print ''; + // Title print ''; - print ''; print ''; - print ''; From c13d1abd0c068649d68967d2e9e5b0fae6a6cc85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Oct 2023 17:53:16 +0100 Subject: [PATCH 071/323] Debug v19 --- htdocs/langs/en_US/modulebuilder.lang | 3 ++- htdocs/modulebuilder/index.php | 16 ++++++++++++++-- htdocs/modulebuilder/template/admin/setup.php | 6 +++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 75f1de02de2..4e95865ee17 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -181,4 +181,5 @@ FailedToAddCodeIntoDescriptor=Failed to add code into descriptor. Check that the DictionariesCreated=Dictionary %s created successfully DictionaryDeleted=Dictionary %s removed successfully PropertyModuleUpdated=Property %s has been update successfully -InfoForApiFile=* When you generate file for the first time then all methods will be created for each object.
* When you click in remove you just remove all methods for the selected object. \ No newline at end of file +InfoForApiFile=* When you generate file for the first time then all methods will be created for each object.
* When you click in remove you just remove all methods for the selected object. +SetupFile=Page for module setup \ No newline at end of file diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8c5168725c8..1cd5325dd31 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3400,10 +3400,12 @@ if ($module == 'initmodule') { $pathtofilereadme = $modulelowercase.'/README.md'; $pathtochangelog = $modulelowercase.'/ChangeLog.md'; + $realpathofmodule = realpath($dirread.'/'.$modulelowercase); + if ($action != 'editfile' || empty($file)) { $morehtmlright = ''; - if (realpath($dirread.'/'.$modulelowercase) != $dirread.'/'.$modulelowercase) { - $morehtmlright = '
'.$form->textwithpicto('', ''.$langs->trans("RealPathOfModule").' : '.realpath($dirread.'/'.$modulelowercase).'').'
'; + if ($realpathofmodule != $dirread.'/'.$modulelowercase) { + $morehtmlright = '
'.$form->textwithpicto('', ''.$langs->trans("RealPathOfModule").' : '.$realpathofmodule.'').'
'; } print dol_get_fiche_head($head2, $tab, '', -1, '', 0, $morehtmlright, '', $MAXTABFOROBJECT, 'formodulesuffix'); // Description - level 2 @@ -3418,6 +3420,16 @@ if ($module == 'initmodule') { print '
'; + // List of setup pages + $listofsetuppages = dol_dir_list($realpathofmodule.'/admin', 'files', 0, '\.php$'); + foreach ($listofsetuppages as $setuppage) { + //var_dump($setuppage); + print ''; + } + print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 2c244494f55..c7e20a479d4 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -170,7 +170,7 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); */ // For retrocompatibility Dolibarr < 15.0 -if ( versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) { +if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) { $formSetup->saveConfFromPost(); } @@ -455,8 +455,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { dol_print_error($db); } - print "
'; print ''; - $htmltext = ''.$langs->trans("Examples").':
'; - $htmltext .= '1 (always enabled)
'; - $htmltext .= '0 (always disabled)
'; - $htmltext .= 'isModEnabled(\''.dol_escape_htmltag($module).'\') (enabled when module is enabled)
'; - print $form->textwithpicto('', $htmltext); /* print ''; print ''; print ''; + print ''; //print ''; print '
'; print $i; print ' '; - print ''; + /*print ''; + print '';*/ + print ''; print ''; + print ''; print ''; /* if (!empty($objPerms)) { @@ -5243,16 +5251,18 @@ if ($module == 'initmodule') { print $i; print ''; + print ''; print dol_escape_htmltag($menu['type']); print ''; print dol_escape_htmltag($menu['titre']); print ''; - print ($value == strtolower($module) ? '/' : $value); + // Parent menu + print ''; + print dol_escape_htmltag($menu['fk_menu']); print ''; @@ -5263,7 +5273,7 @@ if ($module == 'initmodule') { print dol_escape_htmltag($menu['leftmenu']); print ''; + print ''; print dol_escape_htmltag($menu['url']); print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
'; + print ' '.$langs->trans("SetupFile").' : '.$modulelowercase.'/admin/'.$setuppage['relativename'].''; + print ''.img_picto($langs->trans("Edit"), 'edit').''; + print '
'.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; print ''.img_picto($langs->trans("Edit"), 'edit').''; print '
\n"; - print "\n"; + print '
'."\n"; + print ''."\n"; print ''; print ''; print '\n"; From 16ea13ecb81136cd247c305f76285a838cd1fc32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 01:38:20 +0100 Subject: [PATCH 072/323] NEW Allow sync of currency rates with currency layer by default. --- htdocs/admin/multicurrency.php | 94 ++++++++++--------- .../core/modules/modMultiCurrency.class.php | 2 +- .../class/multicurrency.class.php | 17 +++- 3 files changed, 62 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 2b3263efbde..5afd1ce8c85 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -215,7 +215,7 @@ if ($conf->use_javascript_ajax) { print ''; // Online payment with currency on document. This option should be on by default. -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print ''; print ''; print ''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."
'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT").''; @@ -260,51 +260,6 @@ print '
'; print '
'; -print '
'; - -if (getDolGlobalString('MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION')) { - print '
'; - print ''; - print ''; - - print '
'; - print ''; - - $urlforapilayer = 'https://currencylayer.com'; //https://apilayer.net - - print ''; - print ''."\n"; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - /*print ''; - print ''; - print '';*/ - - print '
'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).''; - print ''; - print ''; - print ''; - print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").''; - print ' '; - print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").''; - print ' '; // Default: USD - print ''; - print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").''; - print ' '; // Example: EUR - print '
'; - print '
'; - print '
'; - - print ''; -} print '
'; print ''; @@ -377,6 +332,53 @@ print ' '; + +print '
'; + +if (!getDolGlobalString('MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER')) { + print ''; + print ''; + print ''; + + print '
'; + print '
'; + + $urlforapilayer = 'https://currencylayer.com'; //https://apilayer.net + + print ''; + print ''."\n"; + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + /*print ''; + print ''; + print '';*/ + + print '
'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).''; + print ''; + print ''; + print ''; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").''; + print ' '; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").''; + print ' '; // Default: USD + print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").''; + print ' '; // Example: EUR + print '
'; + print '
'; + print '
'; + + print ''; +} + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index c1e1a3a795a..2abcf240310 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -150,7 +150,7 @@ class modMultiCurrency extends DolibarrModules $datestart=dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( - 0 =>array('priority'=>61, 'label'=>'MutltiCurrencyAutoUpdateCurrencies', 'jobtype'=>'method', 'class'=>'multicurrency/class/multicurrency.class.php', 'objectname'=>'MultiCurrency', 'method'=>'syncRates', 'parameters'=>'0,0,cron', 'comment'=>'Update all the currencies using the currencylayer API. An APi key needs to be given in the multi-currency module config on constant MULTICURRENCY_APP_ID', 'frequency'=>1, 'unitfrequency'=>2678400, 'status'=>$statusatinstall, 'test'=>'isModEnabled("cron")', 'datestart'=>$datestart), + 0 =>array('priority'=>61, 'label'=>'MutltiCurrencyAutoUpdateCurrencies', 'jobtype'=>'method', 'class'=>'multicurrency/class/multicurrency.class.php', 'objectname'=>'MultiCurrency', 'method'=>'syncRates', 'parameters'=>'0,0,cron', 'comment'=>'Update all the currencies using the currencylayer API. An APi key needs to be given in the multi-currency module config page', 'frequency'=>1, 'unitfrequency'=>2678400, 'status'=>$statusatinstall, 'test'=>'isModEnabled("cron")', 'datestart'=>$datestart), ); // Permissions diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index bee9aa4eced..a895c830d7e 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -638,15 +638,24 @@ class MultiCurrency extends CommonObject /** * Sync rates from API * - * @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID. + * @param string $key Key to use. Come from getDolGlobalString("MULTICURRENCY_APP_ID") * @param int $addifnotfound Add if not found * @param string $mode "" for standard use, "cron" to use it in a cronjob - * @return int <0 if KO, >0 if OK, if mode = "cron" OK is + * @return int <0 if KO, >0 if OK, if mode = "cron" OK is 0 */ public function syncRates($key, $addifnotfound = 0, $mode = "") { global $conf, $db, $langs; + if (!getDolGlobalString('MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER')) { + if ($mode == "cron") { + $this->output = $langs->trans('Use of API for currency update is disabled by option MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER'); + } else { + setEventMessages($langs->trans('Use of API for currency update is disabled by option MULTICURRENCY_DISABLE_SYNC_CURRENCYLAYER'), null, 'errors'); + } + return -1; + } + if (empty($key)) { $key = getDolGlobalString("MULTICURRENCY_APP_ID"); } @@ -688,9 +697,9 @@ class MultiCurrency extends CommonObject dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); if ($mode == "cron") { $this->output = $langs->trans('multicurrency_syncronize_error', $response->error->info); + } else { + setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); } - setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); - return -1; } } else { From 26674ba5d1c75feefc397e89b988167f90b43138 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Mon, 30 Oct 2023 03:24:22 +0200 Subject: [PATCH 073/323] fix typo (#26389) --- htdocs/langs/en_US/eventorganization.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index e3dfddf3aef..2487fa2a4e0 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -156,7 +156,7 @@ VoteOk = Your vote has been accepted. AlreadyVoted = You have already voted for this event. VoteError = An error has occurred during the vote, please try again. SubscriptionOk=Your registration has been recorded -AmountOfRegistrationPaid=Amount of resitration paid +AmountOfRegistrationPaid=Amount of registration paid ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an event Attendee = Attendee PaymentConferenceAttendee = Conference attendee payment @@ -177,4 +177,4 @@ ConfirmModifyStatus=Confirm status modification ConfirmModifyStatusQuestion=Are you sure you want to modify the %s selected record(s)? RecordsUpdated = %s Records updated RecordUpdated = Record updated -NoRecordUpdated = No Record updated \ No newline at end of file +NoRecordUpdated = No Record updated From 9567c3fd23c3d59d41aeccad6538ada0a4249f73 Mon Sep 17 00:00:00 2001 From: Vaibhav <100083207+vaibhav-009@users.noreply.github.com> Date: Mon, 30 Oct 2023 06:56:09 +0530 Subject: [PATCH 074/323] Update README.md (#26388) --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e90fdca7a6c..761b952983b 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. - Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommended if you know git as it makes it easier if you want to upgrade later): - `git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is main version like 3.6, 9.0, ...) + `git clone https://github.com/dolibarr/dolibarr -b x.y` (where x.y is the main version like 3.6, 9.0, ...) - Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to. @@ -57,7 +57,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. - From your browser, go to the dolibarr "install/" page - The URL will depends on how you web setup was setup to point to your dolibarr installation. It may looks like: + The URL will depends on how your web setup was set up to point to your dolibarr installation. It may look like: `http://localhost/dolibarr/htdocs/install/` @@ -71,7 +71,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr. - Follow the installer instructions -### Saas/Cloud setup +### SaaS/Cloud setup If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free. @@ -81,7 +81,7 @@ Dolibarr supports upgrading, usually without the need for any (commercial) suppo - At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases). -- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. +- Overwrite all old files from the 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). @@ -141,7 +141,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) Collaboration -- Shared calendar/agenda (with ical and vcal import/export for third party tools integration) +- Shared calendar/agenda (with ical and vcal import/export for third-party tools integration) - Projects & Tasks management - Ticket System - Surveys @@ -168,20 +168,20 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Payment platforms integration (PayPal, Stripe, Paybox...) - Email-Collector -(around 100 modules available by default, 1000+ on the addon market place) +(around 100 modules available by default, 1000+ on the addon marketplace) ### Other general features - Multi-Language Support (Localization in most major languages) -- Multi-Users and groups with finely grained rights +- Multi-users and groups with finely-grained rights - Multi-Currency - Multi-Company (by adding of an external module) -- Very user friendly and easy to use +- Very user-friendly and easy to use - Customizable dashboards - Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one) - APIs (REST, SOAP) - Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture) -- Support a lot of country specific features: +- Support a lot of country-specific features: - Spanish Tax RE and ISPF - French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM) - Canadian double taxes (federal/province) and other countries using cumulative VAT @@ -189,7 +189,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Argentina invoice numbering using A,B,C... - ZATCA e-invoicing QR-Code - Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE) - - Compatible with data privacy rules (europe GDPR, ...) + - Compatible with data privacy rules (Europe GDPR, ...) - ... - Flexible PDF & ODT generation for invoices, proposals, orders... - ... @@ -204,7 +204,7 @@ See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequ ### Extending -Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com). +Dolibarr can be extended with a lot of other external applications or modules from third-party developers available at the [DoliStore](https://www.dolistore.com). ## WHAT DOLIBARR CAN'T DO YET @@ -212,19 +212,19 @@ These are features that Dolibarr does **not** yet fully support: - Tasks dependencies in projects - Payroll module -- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc. +- No native embedded Webmail, but you can send emails to contacts in Dolibarr with e.g. offers, invoices, etc. - Dolibarr can't do coffee (yet) ## DOCUMENTATION -Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org). +Administrator, user, developer and translator's documentation are available along with other community resources in the [Wiki](https://wiki.dolibarr.org). ## CONTRIBUTING This project exists thanks to all the people who contribute. -Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)] +Please read the instructions on how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)] -A view on Contributors: +A View on Contributors: [![Dolibarr](https://opencollective.com/dolibarr/contributors.svg?width=890&button=false)](https://github.com/Dolibarr/dolibarr/graphs/contributors) From c064893f802681b30fe17c66d6ef56a18ef9d4ed Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 30 Oct 2023 02:30:35 +0100 Subject: [PATCH 075/323] NEW : add new hook OrderCard (#26380) Co-authored-by: Christophe Battarel --- htdocs/commande/card.php | 772 ++++++++++++++++++++------------------- 1 file changed, 388 insertions(+), 384 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5b3449ea5df..206ffd030fe 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2451,431 +2451,435 @@ if ($action == 'create' && $usercancreate) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + // Call Hook OrderCard + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('OrderCard', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; + print '
'; + print ''; - print '
'; - print '
'; - print '
'; - - print '
'; - - if ($soc->outstanding_limit) { - // Outstanding Bill - print ''; - print ''; - } - - // Relative and absolute discounts - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; - } - - $addrelativediscount = ''.$langs->trans("EditRelativeDiscounts").''; - $addabsolutediscount = ''.$langs->trans("EditGlobalDiscounts").''; - $addcreditnote = ''.$langs->trans("AddCreditNote").''; - - print ''; - - // Date - print ''; + print ''; } - } - print ''; - print ''; - // Delivery date planed - print ''; - print ''; - - // Delivery delay - print ''; - - // Shipping Method - if (isModEnabled('expedition')) { - print ''; - print ''; - } - // Warehouse - if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - $langs->load('stocks'); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); + $addrelativediscount = ''.$langs->trans("EditRelativeDiscounts").''; + $addabsolutediscount = ''.$langs->trans("EditGlobalDiscounts").''; + $addcreditnote = ''.$langs->trans("AddCreditNote").''; + + print ''; + + // Date print ''; - print ''; - } - - // Source reason (why we have an order) - print ''; - - // Terms of payment - print ''; - - print ''; - - // Mode of payment - print ''; - - // Multicurrency - if (isModEnabled("multicurrency")) { - // Multicurrency code - print ''; - print ''; + print ''; + + // Delivery date planed + print ''; + print ''; + + // Delivery delay + print ''; - // Multicurrency rate - if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + // Shipping Method + if (isModEnabled('expedition')) { + print ''; + print ''; + } + + // Warehouse + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + $langs->load('stocks'); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print ''; + print ''; + } + + // Source reason (why we have an order) + print ''; + + // Terms of payment + print ''; + + print ''; + + // Mode of payment + print ''; + + // Multicurrency + if (isModEnabled("multicurrency")) { + // Multicurrency code print ''; print ''; + + // Multicurrency rate + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + } + } + + // TODO Order mode (how we receive order). Not yet implemented + /* + print ''; + */ + + $tmparray = $object->getTotalWeightVolume(); + $totalWeight = $tmparray['weight']; + $totalVolume = $tmparray['volume']; + if ($totalWeight) { + print ''; + print ''; + } + if ($totalVolume) { + print ''; + print ''; + } + + // TODO How record was recorded OrderMode (llx_c_input_method) + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; } - } - // TODO Order mode (how we receive order). Not yet implemented - /* - print ''; - */ - - $tmparray = $object->getTotalWeightVolume(); - $totalWeight = $tmparray['weight']; - $totalVolume = $tmparray['volume']; - if ($totalWeight) { - print ''; - print ''; - } - if ($totalVolume) { - print ''; - print ''; - } - - // TODO How record was recorded OrderMode (llx_c_input_method) - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; + print ''; } - print ''; - } - // Bank Account - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { - print '
'; - print $langs->trans('OutstandingBill'); - print ''; - $arrayoutstandingbills = $soc->getOutstandingBills(); - print price($arrayoutstandingbills['opened']).' / '; - print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); - print '
'.$langs->trans('Discounts').''; - - $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - - $thirdparty = $soc; - $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'; - $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; - print $form->editfieldkey("Date", 'date', '', $object, $editenable); - print ''; - if ($action == 'editdate') { - print '
'; - print ''; - print ''; - print ''; - print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); - print ''; - print '
'; - } else { - print $object->date ? dol_print_date($object->date, 'day') : ' '; - if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + if ($soc->outstanding_limit) { + // Outstanding Bill + print '
'; + print $langs->trans('OutstandingBill'); + print ''; + $arrayoutstandingbills = $soc->getOutstandingBills(); + print price($arrayoutstandingbills['opened']).' / '; + print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); + print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); - print ''; - if ($action == 'editdate_livraison') { - print '
'; - print ''; - print ''; - print ''; - print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); - print ''; - print '
'; - } else { - print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->delivery_date)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); - } - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); - print ''; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); - print ''; - if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + // Relative and absolute discounts + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; } - print '
'.$langs->trans('Discounts').''; + + $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); + $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + + $thirdparty = $soc; + $discount_type = 0; + $backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); - print ''; - if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); - } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable); - print ''; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); - print ''; - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent); - } - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); - print ''; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print '
'; $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; - print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); + print $form->editfieldkey("Date", 'date', '', $object, $editenable); print ''; - if ($action == 'editmulticurrencycode') { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); + if ($action == 'editdate') { + print '
'; + print ''; + print ''; + print ''; + print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); + print ''; + print '
'; } else { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + print $object->date ? dol_print_date($object->date, 'day') : ' '; + if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable); + print ''; + if ($action == 'editdate_livraison') { + print '
'; + print ''; + print ''; + print ''; + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print ''; + print '
'; + } else { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable); + print ''; + if ($action == 'editavailability') { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + } else { + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); } print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable); + print ''; + if ($action == 'editshippingmethod') { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + } else { + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); + print ''; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); + } else { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("Source", 'demandreason', '', $object, $editenable); + print ''; + if ($action == 'editdemandreason') { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); + } else { + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable); + print ''; + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent); + } else { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent); + } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable); + print ''; + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); + } + print '
'; - $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == $object::STATUS_DRAFT; - print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); + $editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT; + print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable); print ''; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if ($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + if ($action == 'editmulticurrencycode') { + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + } + print '
'; + $editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == $object::STATUS_DRAFT; + print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable); + print ''; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if ($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } } + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); + print ''; + if ($action == 'editinputmode') { + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); + } else { + $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none'); + } + print '
'.$langs->trans("CalculatedWeight").''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); + print '
'.$langs->trans("CalculatedVolume").''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); + print ''; + if ($action != 'editincoterm') { + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); + } else { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable); - print ''; - if ($action == 'editinputmode') { - $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); - } else { - $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none'); - } - print '
'.$langs->trans("CalculatedWeight").''; - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); - print '
'.$langs->trans("CalculatedVolume").''; - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); - print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable); - print ''; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { + print '
'; + $editenable = $usercancreate; + print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); + print ''; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print '
'; - $editenable = $usercancreate; - print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable); - print ''; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'; + + print '
'; + print '
'; + print '
'; + + print ''; + + $alert = ''; + if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) { + $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->order_min_amount)); } - print ''; - print ''; - } - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; - - print '
'; - print '
'; - print '
'; - - print ''; - - $alert = ''; - if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->order_min_amount) { - $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->order_min_amount)); - } - - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount HT - print ''; - } - print ''; - - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount VAT - print ''; - } - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { print ''; - print ''; - print ''; + print ''; + print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + // Multicurrency Amount HT + print ''; + } + print ''; + + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount VAT + print ''; } print ''; // Amount Local Taxes - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { print ''; - print ''; - print ''; + print ''; + print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + print ''; } print ''; + + // Amount Local Taxes + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print ''; + } + print ''; + } } - } - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount TTC - print ''; - } - print ''."\n"; - - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '
'; - - // Statut - //print '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; - - // Show object lines - if (!empty($object->lines)) { - $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); - } - - $numlines = count($object->lines); - - /* - * Form to add new line - */ - if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { - if ($action != 'editline') { - // Add free products/services - - $parameters = array(); - // Note that $action and $object may be modified by hook - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $mysoc, $soc); - } else { - $parameters = array(); - $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount TTC + print ''; } - } - print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '
'; - print '
'; + print ''."\n"; - print "\n"; + print ''; + + // Statut + //print '' . $langs->trans('Status') . '' . $object->getLibStatut(4) . ''; + + // Margin Infos + if (isModEnabled('margin')) { + $formmargin->displayMarginInfos($object); + } + + + print '
'; + print ''; // Close fichecenter + + print '

'; + + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + /* + * Lines + */ + + // Get object lines + $result = $object->getLinesArray(); + + // Add products/services form + //$forceall = 1; + global $inputalsopricewithtax; + $inputalsopricewithtax = 1; + + print '
+ + + + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + print ''; + + // Show object lines + if (!empty($object->lines)) { + $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + } + + $numlines = count($object->lines); + + /* + * Form to add new line + */ + if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { + if ($action != 'editline') { + // Add free products/services + + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $mysoc, $soc); + } else { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); + } + } + print '
'; + print '
'; + + print "
\n"; + } print dol_get_fiche_end(); From b8728b5d075472c23e6e7b77e9ce458768a337c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 02:39:06 +0100 Subject: [PATCH 076/323] Use a more explicit name for new hook --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 206ffd030fe..90d28f50418 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2454,7 +2454,7 @@ if ($action == 'create' && $usercancreate) { // Call Hook OrderCard $parameters = array(); // Note that $action and $object may be modified by hook - $reshook = $hookmanager->executeHooks('OrderCard', $parameters, $object, $action); + $reshook = $hookmanager->executeHooks('tabContentViewOrder', $parameters, $object, $action); if (empty($reshook)) { print '
'; print '
'; From 636f9eacedcfcd439fcb756ee9f582bb45afddd7 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Mon, 30 Oct 2023 02:59:52 +0100 Subject: [PATCH 077/323] Add column sales representative third party list (#26387) Co-authored-by: Laurent Destailleur --- htdocs/societe/list.php | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 7096f5a3b32..9eaf5ab79d1 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -283,6 +283,9 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ $arrayfields['s.price_level'] = array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0); } +// Add non object fields to fields for list +$arrayfields['sales.representative'] = array('label'=>$langs->trans("SalesRepresentatives"), 'checked'=>1, 'position'=>12); + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -1272,6 +1275,11 @@ if (!empty($arrayfields['s.address']['checked'])) { print ''; print ''; } +// Sales representatives +if (!empty($arrayfields['sales.representative']['checked'])) { + print ''; + print ''; +} // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; @@ -1516,6 +1524,10 @@ if (!empty($arrayfields['s.address']['checked'])) { print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } +if (!empty($arrayfields['sales.representative']['checked'])) { + print_liste_field_titre($arrayfields['sales.representative']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} if (!empty($arrayfields['s.zip']['checked'])) { print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; @@ -1787,6 +1799,44 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // Sales Representative + if (!empty($arrayfields['sales.representative']['checked'])) { + print ''; + $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); + $nbofsalesrepresentative = count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 6) { + // We print only number + print $nbofsalesrepresentative; + } elseif ($nbofsalesrepresentative > 0) { + $userstatic = new User($db); + $j = 0; + foreach ($listsalesrepresentatives as $val) { + $userstatic->id = $val['id']; + $userstatic->lastname = $val['lastname']; + $userstatic->firstname = $val['firstname']; + $userstatic->email = $val['email']; + $userstatic->entity = $val['entity']; + $userstatic->photo = $val['photo']; + $userstatic->login = $val['login']; + $userstatic->office_phone = $val['office_phone']; + $userstatic->office_fax = $val['office_fax']; + $userstatic->user_mobile = $val['user_mobile']; + $userstatic->job = $val['job']; + $userstatic->gender = $val['gender']; + print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2); + $j++; + if ($j < $nbofsalesrepresentative) { + print ' '; + } + } + } else { + print ' '; + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Zip if (!empty($arrayfields['s.zip']['checked'])) { print "".dol_escape_htmltag($companystatic->zip)."\n"; From 08ef416958a740a974556308da8d8cfbf79d9b58 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Mon, 30 Oct 2023 03:13:12 +0100 Subject: [PATCH 078/323] New: Adding the PDF option displaying the product's barcode number (#26345) * Add a PDF option to show barcode number of product * Add space before and after IF keyword * fix error phpcs * add barcode label before barcode number * Use outputlangs and not langs --------- Co-authored-by: Laurent Destailleur --- htdocs/admin/pdf.php | 16 ++++++++++++++++ htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/core/lib/pdf.lib.php | 5 +++++ htdocs/expedition/class/expedition.class.php | 3 ++- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + 7 files changed, 29 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 9195c6e69ec..d999b91d32f 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -132,6 +132,10 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); } + if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE')) { + dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE"), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) { dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); } @@ -532,6 +536,18 @@ if ($conf->use_javascript_ajax) { } print ''; +// Barcode + +if (isModEnabled('barcode')) { + print ''.$langs->trans("ShowProductBarcodeOnPDF").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE'); + } else { + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE : 0, 1); + } + print ''; +} + // Desc print ''.$langs->trans("HideDescOnPDF").''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0f7facb6e26..a5471adf907 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2286,7 +2286,7 @@ class Facture extends CommonInvoice $sql .= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql .= ' l.fk_unit,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; + $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc, p.barcode as product_barcode'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql .= ' WHERE l.fk_facture = '.((int) $this->id); @@ -2312,6 +2312,7 @@ class Facture extends CommonInvoice $line->product_ref = $objp->product_ref; // Ref product $line->libelle = $objp->product_label; // deprecated $line->product_label = $objp->product_label; // Label product + $line->product_barcode = $objp->product_barcode; // Barcode number product $line->product_desc = $objp->product_desc; // Description product $line->fk_product_type = $objp->fk_product_type; // Type of product $line->qty = $objp->qty; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 779c4c2ebcc..4b52b0cd384 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1459,6 +1459,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $idprod = (!empty($object->lines[$i]->fk_product) ? $object->lines[$i]->fk_product : false); $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : (!empty($object->lines[$i]->product_label) ? $object->lines[$i]->product_label : '')); + $product_barcode = (!empty($object->lines[$i]->product_barcode) ? $object->lines[$i]->product_barcode : ""); $desc = (!empty($object->lines[$i]->desc) ? $object->lines[$i]->desc : (!empty($object->lines[$i]->description) ? $object->lines[$i]->description : '')); $ref_supplier = (!empty($object->lines[$i]->ref_supplier) ? $object->lines[$i]->ref_supplier : (!empty($object->lines[$i]->ref_fourn) ? $object->lines[$i]->ref_fourn : '')); // TODO Not yet saved for supplier invoices, only supplier orders $note = (!empty($object->lines[$i]->note) ? $object->lines[$i]->note : ''); @@ -1546,6 +1547,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } } + if (isModEnabled('barcode') && getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE') && !empty($product_barcode)) { + $libelleproduitservice = dol_concatdesc($libelleproduitservice, $outputlangs->trans("BarCode")." ".$product_barcode); + } + // Description long of product line if (!empty($desc) && ($desc != $label)) { if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 76cb942b4cd..fa0916c2501 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1561,7 +1561,7 @@ class Expedition extends CommonObject $sql .= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang"; $sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; - $sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; + $sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type, p.barcode as product_barcode"; $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch"; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; @@ -1623,6 +1623,7 @@ class Expedition extends CommonObject $line->product_ref = $obj->product_ref; $line->product_label = $obj->product_label; $line->libelle = $obj->product_label; // TODO deprecated + $line->product_barcode = $obj->product_barcode; // Barcode number product $line->product_tosell = $obj->product_tosell; $line->product_tobuy = $obj->product_tobuy; $line->product_tobatch = $obj->product_tobatch; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ec0cd58f01d..7340e847217 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1025,7 +1025,7 @@ class FactureFournisseur extends CommonInvoice $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; $sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn, f.fk_remise_except'; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; - $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; + $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.barcode as product_barcode, p.description as product_desc'; $sql .= ', f.fk_code_ventilation, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; @@ -1054,6 +1054,7 @@ class FactureFournisseur extends CommonInvoice $line->ref_supplier = $obj->ref_supplier; $line->libelle = $obj->label; $line->label = $obj->label; + $line->product_barcode = $obj->product_barcode; $line->product_desc = $obj->product_desc; $line->subprice = $obj->pu_ht; $line->pu_ht = $obj->pu_ht; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 116800098d4..eff66bdcdac 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -417,6 +417,7 @@ PDFLocaltax=Rules for %s HideLocalTaxOnPDF=Hide %s rate in column Sale Tax / VAT HideDescOnPDF=Hide products description HideRefOnPDF=Hide products ref. +ShowProductBarcodeOnPDF=Display the barcode number of the products HideDetailsOnPDF=Hide product lines details PlaceCustomerAddressToIsoLocation=Use french standard position (La Poste) for customer address position Library=Library diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 614be43d6a6..7e6986239de 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -417,6 +417,7 @@ PDFLocaltax=Règles pour %s HideLocalTaxOnPDF=Cacher le taux de %s dans la colonne Taxe HideDescOnPDF=Cacher la description des produits HideRefOnPDF=Cacher la référence des produits +ShowProductBarcodeOnPDF=Affiche le numéro de code-barre des produits HideDetailsOnPDF=Cacher les détails des prix sur lignes de produits PlaceCustomerAddressToIsoLocation=Utiliser la position standard française (La Poste) pour la position de l'adresse client Library=Bibliothèque From 3c874233646e040ef5a81c1e96da4b35f24a1141 Mon Sep 17 00:00:00 2001 From: William Mead Date: Mon, 30 Oct 2023 04:12:43 +0100 Subject: [PATCH 079/323] Qual cleaner code for InterfaceLogevents (#26347) * Renamed text variable to label * Added label variable * Fixed typos * Fixed PHPDoc * Added runTrigger method return type * Refactored to use super class constructor * Added contributor details. Cleaned indentation. * Added user login failed string * Added label & description localized strings * Converted event label, description & date variables to class properties. Added class method to initialize event data. Refactored & cleaned code. * Added user string parameter * Cleaned code * Moved langs loading * Added code comment * Cleaned code * Added code comment * Fixed PHPDoc comments * Refactored event label & description assignment * Deleted unneeded empty lines * Added event action text dictionary. Refactored event data initialization. Added static class method for dynamic localization to check if event text has an event action key n. * Updated string parameter placement * Added condition to check if event description has an event action key in order to do dynamic frontend translation * Updated code comments. Renamed event action array. * Added user status key * Cleaned code * Update interface_20_all_Logevents.class.php --------- Co-authored-by: William Mead Co-authored-by: Laurent Destailleur --- htdocs/admin/tools/listevents.php | 5 + htdocs/core/class/events.class.php | 10 +- .../interface_20_all_Logevents.class.php | 180 +++++++----------- htdocs/langs/en_US/users.lang | 6 +- 4 files changed, 91 insertions(+), 110 deletions(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 3cff615d9dc..75ffcc781d7 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_20_all_Logevents.class.php'; if (!$user->admin) { accessforbidden(); @@ -477,6 +478,10 @@ if ($result) { // Description $text = $langs->trans($obj->description); $reg = array(); + if (InterfaceLogevents::isEventActionTextKey($obj->description)) { + $val = explode(' : ', $obj->description); + $text = $langs->trans($val[0], isset($val[1]) ? $val[1] : '', isset($val[2]) ? $val[2] : '', isset($val[3]) ? $val[3] : '', isset($val[4]) ? $val[4] : ''); + } if (preg_match('/\((.*)\)(.*)/i', $obj->description, $reg)) { $val = explode(',', $reg[1]); $text = $langs->trans($val[0], isset($val[1]) ? $val[1] : '', isset($val[2]) ? $val[2] : '', isset($val[3]) ? $val[3] : '', isset($val[4]) ? $val[4] : ''); diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 2ae88d9b219..aaf37f40f62 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2005-2009 Regis Houssin +/* Copyright (C) 2007-2019 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2023 William Mead * * 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 @@ -80,6 +81,11 @@ class Events // extends CommonObject */ public $user_agent; + /** + * @var string label + */ + public $label; + /** * @var string description */ diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index acfb2318712..2b196413cb4 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -27,47 +27,64 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; - /** * Class of triggers for security audit events */ class InterfaceLogevents extends DolibarrTriggers { + const EVENT_ACTION_DICT = [ // TODO reduce number of events to CREATE, UPDATE & DELETE. Use object properties to pinpoint precise action. + 'USER_LOGIN' => 'UserLogged', + 'USER_LOGIN_FAILED' => 'UserLoginFailed', + 'USER_LOGOUT' => 'UserLogoff', + 'USER_CREATE' => 'NewUserCreated', + 'USER_MODIFY' => 'EventUserModified', + 'USER_NEW_PASSWORD' => 'NewUserPassword', + 'USER_ENABLEDISABLE' => 'UserEnabledDisabled', + 'USER_DELETE' => 'UserDeleted', + 'USERGROUP_CREATE' => 'NewGroupCreated', + 'USERGROUP_MODIFY' => 'GroupModified', + 'USERGROUP_DELETE' => 'GroupDeleted' + ]; + private string $event_label; + private string $event_desc; + private int $event_date; + /** * Constructor - * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { - $this->db = $db; + parent::__construct($db); - $this->name = preg_replace('/^Interface/i', '', get_class($this)); $this->family = "core"; $this->description = "Triggers of this module allows to add security event records inside Dolibarr."; - $this->version = self::VERSION_DOLIBARR; // VERSION_ 'DEVELOPMENT' or 'EXPERMENTAL' or 'DOLIBARR' + $this->version = self::VERSION_DOLIBARR; // VERSION_ 'DEVELOPMENT' or 'EXPERIMENTAL' or 'DOLIBARR' $this->picto = 'technic'; + $this->event_label = ''; + $this->event_desc = ''; + $this->event_date = 0; } /** - * Function called when a Dolibarrr security audit event is done. + * Function called when a Dolibarr security audit event is done. * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int if KO: <0, if no trigger ran: 0, if OK: >0 + * @throws Exception dol_syslog can throw Exceptions */ - public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf): int { if (!empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) { return 0; // Log events is disabled (hidden features) } $key = 'MAIN_LOGEVENTS_'.$action; - //dol_syslog("xxxxxxxxxxx".$key); if (empty($conf->global->$key)) { return 0; // Log events not enabled for this action } @@ -76,103 +93,18 @@ class InterfaceLogevents extends DolibarrTriggers $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) } - $date = dol_now(); - - /* Actions */ - - $text = ''; - $desc = ''; - $langs->load("users"); - // Actions - switch ($action) { - case 'USER_LOGIN': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = "(UserLogged," . $object->login . ")"; - $desc = "(UserLogged," . $object->login . ")"; - break; - case 'USER_LOGIN_FAILED': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - break; - case 'USER_LOGOUT': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = "(UserLogoff," . $object->login . ")"; - $desc = "(UserLogoff," . $object->login . ")"; - break; - case 'USER_CREATE': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("NewUserCreated", $object->login); - $desc = $langs->transnoentities("NewUserCreated", $object->login); - break; - case 'USER_MODIFY': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("EventUserModified", $object->login); - $desc = $langs->transnoentities("EventUserModified", $object->login); - break; - case 'USER_NEW_PASSWORD': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("NewUserPassword", $object->login); - $desc = $langs->transnoentities("NewUserPassword", $object->login); - break; - case 'USER_ENABLEDISABLE': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - if ($object->statut == 0) { - $text = $langs->transnoentities("UserEnabled", $object->login); - $desc = $langs->transnoentities("UserEnabled", $object->login); - } - if ($object->statut == 1) { - $text = $langs->transnoentities("UserDisabled", $object->login); - $desc = $langs->transnoentities("UserDisabled", $object->login); - } - break; - case 'USER_DELETE': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("UserDeleted", $object->login); - $desc = $langs->transnoentities("UserDeleted", $object->login); - break; - case 'USERGROUP_CREATE': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("NewGroupCreated", $object->name); - $desc = $langs->transnoentities("NewGroupCreated", $object->name); - break; - case 'USERGROUP_MODIFY': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("GroupModified", $object->name); - $desc = $langs->transnoentities("GroupModified", $object->name); - break; - case 'USERGROUP_DELETE': - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - // Initialize data (date,duree,text,desc) - $text = $langs->transnoentities("GroupDeleted", $object->name); - $desc = $langs->transnoentities("GroupDeleted", $object->name); - break; - default: - dol_syslog("Unknown action. Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); - break; - } - - // Add more information into desc from the context property - if (!empty($object->context['audit'])) { - $desc .= (empty($desc) ? '' : ' - ').$object->context['audit']; - } + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + $this->initEventData(InterfaceLogevents::EVENT_ACTION_DICT[$action], $object); // Add entry in event table include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; $event = new Events($this->db); $event->type = $action; - $event->dateevent = $date; - $event->label = $text; - $event->description = $desc; + $event->dateevent = $this->event_date; + $event->label = $this->event_label; + $event->description = $this->event_desc; $event->user_agent = (empty($_SERVER["HTTP_USER_AGENT"]) ? '' : $_SERVER["HTTP_USER_AGENT"]); $event->authentication_method = (empty($object->context['authentication_method']) ? '' : $object->context['authentication_method']); @@ -188,4 +120,40 @@ class InterfaceLogevents extends DolibarrTriggers return -1; } } + + /** + * Method called by runTrigger to initialize date, label & description data for event + * + * @param string $key_text Action string + * @param Object $object Object + * @return void + */ + private function initEventData(string $key_text, Object $object): void + { + $this->event_date = dol_now(); + $this->event_label = $this->event_desc = $key_text . ' : ' . $object->login; + if ($key_text == InterfaceLogevents::EVENT_ACTION_DICT['USER_ENABLEDISABLE']) { // TODO should be refactored using an object property for event data. + $object->statut ? $this->event_desc .= ' - disabled' : $this->event_desc .= ' - enabled'; + } + // Add more information into event description from the context property + if (!empty($object->context['audit'])) { + $this->event_desc .= (empty($this->event_desc) ? '' : ' - ').$object->context['audit']; + } + } + + /** + * Check if text contains an event action key. Used for dynamic localization on frontend events list. + * + * @param string $event_text input event text + * @return bool + */ + public static function isEventActionTextKey(string $event_text): bool + { + foreach (InterfaceLogevents::EVENT_ACTION_DICT as $value) { + if (str_contains($event_text, $value)) { + return true; + } + } + return false; + } } diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 93bb0442de6..1d88843dd34 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,8 +109,9 @@ ExpectedWorkedHours=Expected hours worked per week ColorUser=Color of the user DisabledInMonoUserMode=Disabled in maintenance mode UserAccountancyCode=User accounting code -UserLogoff=User logout -UserLogged=User logged +UserLogoff=User logout: %s +UserLogged=User logged: %s +UserLoginFailed=User login failed: %s DateOfEmployment=Employment date DateEmployment=Employment DateEmploymentStart=Employment Start Date @@ -131,3 +132,4 @@ ShowAllPerms=Show all permission rows HideAllPerms=Hide all permission rows UserPublicPageDesc=You can enable a virtual card for this user. An url with the user profile and a barcode will be available to allow anybody with a smartphone to scan it and add your contact to its address book. EnablePublicVirtualCard=Enable the user's virtual business card +UserEnabledDisabled=User status changed: %s From 24e043934a8b7118166a059bee4aeb4f375a5332 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 13:23:46 +0100 Subject: [PATCH 080/323] Debug delete evaluation --- htdocs/core/actions_addupdatedelete.inc.php | 10 ++++++++++ htdocs/core/class/commonobject.class.php | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 07136bd760a..b6a02aac7f1 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -382,17 +382,27 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) { exit; } + $db->begin(); + $result = $object->delete($user); if ($result > 0) { + $db->commit(); + // Delete OK setEventMessages("RecordDeleted", null, 'mesgs'); if (empty($noback)) { + if (empty($backurlforlist)) { + print 'Error backurlforlist is not defined'; + exit; + } header("Location: " . $backurlforlist); exit; } } else { + $db->rollback(); + $error++; if (!empty($object->errors)) { setEventMessages(null, $object->errors, 'errors'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d81afcf87fe..76f75239ee8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9854,9 +9854,8 @@ abstract class CommonObject $filePath = $deleteFromObject[1]; $columnName = $deleteFromObject[2]; $TMoreSQL = array(); - $more_sql = $deleteFromObject[3]; - if (!empty($more_sql)) { - $TMoreSQL['customsql'] = $more_sql; + if (!empty($deleteFromObject[3])) { + $TMoreSQL['customsql'] = $deleteFromObject[3]; } if (dol_include_once($filePath)) { $childObject = new $className($this->db); From 26490938159cd9c8d89c7f759d5594c6d76ffb67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 14:06:25 +0100 Subject: [PATCH 081/323] Fix php 7.1 compatibility --- .../interface_20_all_Logevents.class.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 2b196413cb4..6fe26a0cef5 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceLogevents extends DolibarrTriggers { - const EVENT_ACTION_DICT = [ // TODO reduce number of events to CREATE, UPDATE & DELETE. Use object properties to pinpoint precise action. + const EVENT_ACTION_DICT = array( // TODO reduce number of events to CREATE, UPDATE & DELETE. Use object properties to pinpoint precise action. 'USER_LOGIN' => 'UserLogged', 'USER_LOGIN_FAILED' => 'UserLoginFailed', 'USER_LOGOUT' => 'UserLogoff', @@ -44,10 +44,20 @@ class InterfaceLogevents extends DolibarrTriggers 'USERGROUP_CREATE' => 'NewGroupCreated', 'USERGROUP_MODIFY' => 'GroupModified', 'USERGROUP_DELETE' => 'GroupDeleted' - ]; - private string $event_label; - private string $event_desc; - private int $event_date; + ); + /** + * @var string Label + */ + private $event_label; + /** + * @var string Description + */ + private $event_desc; + /** + * @var int Date + */ + private $event_date; + /** * Constructor From 173fea5554f89fb848005c4971c3aeae25d361e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 14:23:27 +0100 Subject: [PATCH 082/323] FIX badge on user skills tab --- htdocs/hrm/skill_tab.php | 13 +++++-- htdocs/user/class/user.class.php | 58 ++++++++++++++++++++------------ htdocs/user/param_ihm.php | 2 +- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 0ffd89181f2..167d8c3baac 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -77,15 +77,22 @@ $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hoo // Load object include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +$object->loadPersonalConf(); // Permissions $permissiontoread = $user->hasRight('hrm', 'all', 'read'); $permissiontoadd = $user->hasRight('hrm', 'all', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Security check (enable the most restrictive one) -if ($user->socid > 0) accessforbidden(); -if (empty($conf->hrm->enabled)) accessforbidden(); -if (!$permissiontoread) accessforbidden(); +if ($user->socid > 0) { + accessforbidden(); +} +if (!isModEnabled('hrm')) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} /* diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fd7336ed9ac..fc9610762f8 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -620,28 +620,7 @@ class User extends CommonObject // To get back the global configuration unique to the user if ($loadpersonalconf) { - // Load user->conf for user - $sql = "SELECT param, value FROM ".$this->db->prefix()."user_param"; - $sql .= " WHERE fk_user = ".((int) $this->id); - $sql .= " AND entity = ".((int) $conf->entity); - //dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - $p = (!empty($obj->param) ? $obj->param : ''); - if (!empty($p)) { - $this->conf->$p = $obj->value; - } - $i++; - } - $this->db->free($resql); - } else { - $this->error = $this->db->lasterror(); - return -2; - } + $result = $this->loadPersonalConf(); $result = $this->loadDefaultValues(); @@ -654,6 +633,40 @@ class User extends CommonObject return 1; } + + /** + * Load const values from database table user_param and set it into user->conf->XXX + * + * @return int > 0 if OK, < 0 if KO + */ + public function loadPersonalConf() + { + global $conf; + + // Load user->conf for user + $sql = "SELECT param, value FROM ".$this->db->prefix()."user_param"; + $sql .= " WHERE fk_user = ".((int) $this->id); + $sql .= " AND entity = ".((int) $conf->entity); + //dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $p = (!empty($obj->param) ? $obj->param : ''); + if (!empty($p)) { + $this->conf->$p = $obj->value; + } + $i++; + } + $this->db->free($resql); + } else { + $this->error = $this->db->lasterror(); + return -2; + } + } + /** * Load default values from database table into property ->default_values * @@ -662,6 +675,7 @@ class User extends CommonObject public function loadDefaultValues() { global $conf; + if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { // Load user->default_values for user. TODO Save this in memcached ? require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php'; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index b5b9e52f60c..df51727ffec 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -264,7 +264,7 @@ if ($reshook < 0) { } foreach ($tmparray as $key => $val) { - $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']); + $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), empty($val['picto']) ? 'generic' : $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']); $tmparray[$key]['label'] = $langs->trans($val['label']); } From 858e0dbf11d3a2d53d4fb1a5855b74fc48111508 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 14:26:21 +0100 Subject: [PATCH 083/323] Fix php7.1 --- htdocs/core/triggers/interface_20_all_Logevents.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index 6fe26a0cef5..55b3a6866cb 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -134,11 +134,11 @@ class InterfaceLogevents extends DolibarrTriggers /** * Method called by runTrigger to initialize date, label & description data for event * - * @param string $key_text Action string + * @param string $key_text Action string * @param Object $object Object * @return void */ - private function initEventData(string $key_text, Object $object): void + private function initEventData($key_text, $object): void { $this->event_date = dol_now(); $this->event_label = $this->event_desc = $key_text . ' : ' . $object->login; @@ -154,10 +154,10 @@ class InterfaceLogevents extends DolibarrTriggers /** * Check if text contains an event action key. Used for dynamic localization on frontend events list. * - * @param string $event_text input event text + * @param string $event_text Input event text * @return bool */ - public static function isEventActionTextKey(string $event_text): bool + public static function isEventActionTextKey($event_text): bool { foreach (InterfaceLogevents::EVENT_ACTION_DICT as $value) { if (str_contains($event_text, $value)) { From b713ef80ff142510366b6042650493483ac16bbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 16:32:35 +0100 Subject: [PATCH 084/323] Debug v19 --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index db7cdd34d67..0d3e8285c32 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -589,7 +589,7 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { From 1558772d83ede31c0f980ef174cfeb1a26467493 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Oct 2023 17:14:46 +0100 Subject: [PATCH 085/323] Debug v19 --- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index b5ba8bd2114..9f6d806e8f4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -821,7 +821,7 @@ class FormCompany extends Form $out = ''; if (is_object($object) && method_exists($object, 'liste_type_contact')) { - $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); + $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); // List of types into c_type_contact for element=$object->element $out .= ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; print '"; @@ -2020,7 +2023,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print ''; print "\n"; - print ''.$langs->trans("BankAccountOwnerAddress").''; + print ''.$langs->trans("BankAccountOwnerAddress").''; print '"; @@ -2182,7 +2185,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; } - print ''.$langs->trans("BankAccountDomiciliation").''; + print ''.$langs->trans("BankAccountDomiciliation").''; print '"; @@ -2191,7 +2194,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; print "\n"; - print ''.$langs->trans("BankAccountOwnerAddress").''; + print ''.$langs->trans("BankAccountOwnerAddress").''; print '"; @@ -2204,8 +2207,8 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; // RUM - print ''; - print ''; + print ''; + print ''; $date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 61408f562e2..519c96d8a73 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -837,21 +837,22 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print $stringescaped; print ''; // IBAN - print ''; // BIC - print ''; // Currency @@ -898,15 +899,15 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin); - //print '
'; - print '
'; + print '
'; + print '
'.$langs->trans("RUM").'
'.$langs->trans("RUMWillBeGenerated").'
'.$form->textwithpicto($langs->trans("RUM"), $langs->trans("RUMLong").'
'.$langs->trans("RUMWillBeGenerated")).'
'.getIbanHumanReadable($account); + print ''; if (!empty($account->iban)) { if (!checkIbanForAccount($account)) { print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); } } + print getIbanHumanReadable($account); print ''; - print dol_escape_htmltag($account->bic); + print ''; if (!empty($account->bic)) { if (!checkSwiftForAccount($account)) { print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning'); } } + print dol_escape_htmltag($account->bic); print '
'; - print ''; - print ''; + print ''; + print ''; - print ''; + print ''; print ''; // Currency @@ -950,38 +951,58 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', } print ''; + // Show fields of bank account - foreach ($account->getFieldsToShow() as $val) { + $bankaccount = $account; + // Code here is similare than into paymentmodes.php for third-parties + foreach ($bankaccount->getFieldsToShow(1) as $val) { + $require = false; + $tooltip = ''; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; - $content = $account->code_banque; + $content = $bankaccount->code_banque; } elseif ($val == 'DeskCode') { $name = 'code_guichet'; $size = 8; - $content = $account->code_guichet; + $content = $bankaccount->code_guichet; } elseif ($val == 'BankAccountNumber') { $name = 'number'; $size = 18; - $content = $account->number; + $content = $bankaccount->number; } elseif ($val == 'BankAccountNumberKey') { $name = 'cle_rib'; $size = 3; - $content = $account->cle_rib; + $content = $bankaccount->cle_rib; + } elseif ($val == 'IBAN') { + $name = 'iban'; + $size = 30; + $content = $bankaccount->iban; + if ($bankaccount->needIBAN()) { + $require = true; + } + $tooltip = $langs->trans("Example").':
CH93 0076 2011 6238 5295 7
LT12 1000 0111 0100 1000
FR14 2004 1010 0505 0001 3M02 606
LU28 0019 4006 4475 0000
DE89 3704 0044 0532 0130 00'; + } elseif ($val == 'BIC') { + $name = 'bic'; + $size = 12; + $content = $bankaccount->bic; + if ($bankaccount->needIBAN()) { + $require = true; + } + $tooltip = $langs->trans("Example").': LIABLT2XXXX'; } - - print ''; + print ''; + print ''; + if ($tooltip) { + print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); + } else { + print $langs->trans($val); + } + print ''; print ''; print ''; } - // IBAN - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - //print ''; - print ''; - - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; - - $newclassname = $classname; - print ''; - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 RE - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 IRPF - print '"; - } - - print '"; - - if (isModEnabled("multicurrency")) { - print ''; - print ''; - print ''; - } - } - - // Other options + // Call Hook tabContentCreateSupplierOrder $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateSupplierOrder', $parameters, $object, $action); if (empty($reshook)) { - print $object->showOptionals($extrafields, 'create'); + print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("Label").'
'.$langs->trans("BankName").'
'.$langs->trans("BankName").'
'.$langs->trans($val).'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; print ''; - print '
'.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1, 'supplier').'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva).'
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc).'
'; + + // Ref + print ''; + + // Third party + print ''; + print ''; + + if (!empty($societe->id) && $societe->id > 0) { + // Discounts for third party + print ''; + } + + // Ref supplier + print ''; + print ''; + + // Payment term + print ''; + + // Payment mode + print ''; + + // Planned delivery date + print ''; + print ''; + + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && isModEnabled("banque")) { + $langs->load("bank"); + print ''; + } + + // Project + if (isModEnabled('project')) { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + $fkincoterms = (!empty($object->fk_incoterms) ? $object->fk_incoterms : ($socid > 0 ? $societe->fk_incoterms : '')); + $locincoterms = (!empty($object->location_incoterms) ? $object->location_incoterms : ($socid > 0 ? $societe->location_incoterms : '')); + print ''; + print ''; + print ''; + } + + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''; + print ''; + } + + print ''; + print ''; + //print ''; + print ''; + + print ''; + print ''; + //print ''; + print ''; + + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + + $newclassname = $classname; + print ''; + print ''; + print '"; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 RE + print '"; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 IRPF + print '"; + } + + print '"; + + if (isModEnabled("multicurrency")) { + print ''; + print ''; + print ''; + } + } + + // Other options + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'create'); + } + + // Bouton "Create Draft" + print "
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Supplier').''; + + if (!empty($societe->id) && $societe->id > 0) { + print $societe->getNomUrl(1, 'supplier'); + print ''; + } else { + $filter = '((s.fournisseur:=:1) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company((empty($socid) ? '' : $socid), 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); + // reload page to retrieve customer informations + if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) { + print ''; + } + print ' '; + } + print '
'.$langs->trans('Discounts').''; + + $absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1); + + $thirdparty = $societe; + $discount_type = 1; + $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$langs->trans('RefSupplier').'
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0) ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); + print '
'; + print $langs->trans('DateDeliveryPlanned'); + print ''; + $usehourmin = 0; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { + $usehourmin = 1; + } + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($datelivraison ? $datelivraison : -1, 'liv_', $usehourmin, $usehourmin, '', "set"); + print '
'.$langs->trans('BankAccount').''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); + $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + print '
'.$langs->trans('Project').''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print '   id) ? '&socid='.$societe->id : "")).'">'; + print '
'; + print img_picto('', 'incoterm', 'class="pictofixedwidth"'); + print $form->select_incoterms($fkincoterms, $locincoterms); + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); + print '
'.$langs->trans('NotePublic').''; + $doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + print '
'.$langs->trans('NotePrivate').''; + $doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private', 'restricthtml'), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1, 'supplier').'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva).'
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc).'
\n"; } - - // Bouton "Create Draft" - print "\n"; - print dol_get_fiche_end(); print $form->buttonsSaveCancel("CreateDraft"); From 13072a1df2432a4c7e2a209c9d38105a11c398bd Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 Nov 2023 14:24:31 +0100 Subject: [PATCH 123/323] add hook tabContentViewSupplierOrder (#26417) Co-authored-by: Christophe Battarel --- htdocs/fourn/commande/card.php | 629 +++++++++++++++++---------------- 1 file changed, 317 insertions(+), 312 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9b712bce3ca..d00cb01f02b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2100,371 +2100,376 @@ if ($action == 'create') { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + // Call Hook tabContentViewSupplierOrder + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentViewSupplierOrder', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; + print '
'; - print '
'; - print '
'; - print '
'; + print ''; - print '
'; + // Date + if ($object->methode_commande_id > 0) { + $usehourmin = 0; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { + $usehourmin = 1; + } + print '"; - // Date - if ($object->methode_commande_id > 0) { - $usehourmin = 0; - if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { - $usehourmin = 1; + if ($object->methode_commande) { + print ''; + } } - print ''; + print ''; + print ''; + + // Relative and absolute discounts + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } else { + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')"; + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; } - print ""; - if ($object->methode_commande) { - print ''; - } - } + $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); + $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - // Author - print ''; - print ''; - print ''; + print ''; - print ''; - - // Default terms of the settlement - $langs->load('bills'); - print '"; - print ''; - - // Mode of payment - $langs->load('bills'); - print ''; - - // Multicurrency - if (isModEnabled("multicurrency")) { - // Multicurrency code - print ''; + // Default terms of the settlement + $langs->load('bills'); + print ''; - print ''; - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 - print '"; - } - print '"; - - if (isModEnabled('multicurrency')) { - print ''; - print '"; - print '"; - } - } - - print "
'.$langs->trans("Date").''; + print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; + if ($object->hasDelay() && !empty($object->delivery_date) && !empty($object->date_commande)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } + print "
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("Date").''; - print $object->date_commande ? dol_print_date($object->date_commande, $usehourmin ? 'dayhour' : 'day') : ''; - if ($object->hasDelay() && !empty($object->delivery_date) && !empty($object->date_commande)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + + // Author + print '
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(-1, '', 0, 0, 0).'
'.$langs->trans("Method").''.$object->getInputMethod().'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(-1, '', 0, 0, 0).'
'.$langs->trans('Discounts').''; - // Relative and absolute discounts - if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { - $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - } else { - $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')"; - $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; - } + $thirdparty = $societe; + $discount_type = 1; + $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - $absolute_discount = $societe->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); - $absolute_creditnote = $societe->getAvailableDiscounts('', $filtercreditnote, 0, 1); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + print '
'.$langs->trans('Discounts').''; - - $thirdparty = $societe; - $discount_type = 1; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'; - print ''; - } - print '
'; - print $langs->trans('PaymentConditions'); - print ''; - if ($action != 'editconditions') { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; - print '
'; - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); - } - print "
'; - print ''; - if ($action != 'editmode') { - print ''; - } - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; - print '
'; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print '
'; + print '"; + print ''; + + // Mode of payment + $langs->load('bills'); + print ''; - // Multicurrency rate - if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + // Multicurrency + if (isModEnabled("multicurrency")) { + // Multicurrency code print ''; print '
'; + print $langs->trans('PaymentConditions'); print ''; - print ''; - if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { - print ''; + if ($action != 'editconditions') { + print ''; } print '
'; - print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; - if ($action == 'editmulticurrencycode') { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); + } + print "
'; + print ''; + if ($action != 'editmode') { + print ''; + } + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; + print '
'; + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print '
'; - print ''; - print ''; - } - } - // Bank Account - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && isModEnabled("banque")) { - print '
'; - print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); + print ''; - if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print ''; + if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { + print ''; } print '
'; + print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; print '
'; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if ($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + if ($action == 'editmulticurrencycode') { + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; - } + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); } print '
'; - print ''; + // Multicurrency rate + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + } + } + + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && isModEnabled("banque")) { + print ''; + print ''; + } + + // Delivery delay (in days) + print ''; + print ''; + print ''; + print ''; + + // Delivery date planed + print ''; - print ''; - } - - // Delivery delay (in days) - print ''; - print ''; - print ''; - print ''; - - // Delivery date planed - print ''; - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - } - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + } - print '
'; - print $langs->trans('BankAccount'); - print ''; - if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; + print ''; + print ''; + if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print ''; + } + print '
'; + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; + print '
'; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if ($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } + } + print '
'; + print ''; + } + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $usercancreate) { + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; + print '
'; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print '
'.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''.$object->getMaxDeliveryTimeDay($langs).'
'; + print ''; + if ($action != 'editdate_livraison') { + print ''; } print '
'; + print $langs->trans('DateDeliveryPlanned'); + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print '
'; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + if ($action == 'editdate_livraison') { + print '
'; + print ''; + print ''; + $usehourmin = 0; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { + $usehourmin = 1; + } + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print ''; + print '
'; } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print '
'.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''.$object->getMaxDeliveryTimeDay($langs).'
'; - print ''; - if ($action != 'editdate_livraison') { - print ''; - } - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; - print '
'; - if ($action == 'editdate_livraison') { - print '
'; - print ''; - print ''; - $usehourmin = 0; - if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { - $usehourmin = 1; - } - print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); - print ''; - print '
'; - } else { - $usehourmin = 'day'; - if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { - $usehourmin = 'dayhour'; - } - print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->delivery_date) && ($object->statut == $object::STATUS_ORDERSENT || $object->statut == $object::STATUS_RECEIVED_PARTIALLY)) { - print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); - } - } - print '
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($usercancreate) { - print ''.img_edit().''; - } else { - print ' '; - } - print '
'; - print '
'; - if ($action != 'editincoterm') { - print $form->textwithpicto(dol_escape_htmltag($object->display_incoterms()), $object->label_incoterms, 1); - } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + $usehourmin = 'day'; + if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) { + $usehourmin = 'dayhour'; + } + print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; + if ($object->hasDelay() && !empty($object->delivery_date) && ($object->statut == $object::STATUS_ORDERSENT || $object->statut == $object::STATUS_RECEIVED_PARTIALLY)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); + } } print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($usercancreate) { + print ''.img_edit().''; + } else { + print ' '; + } + print '
'; + print '
'; + if ($action != 'editincoterm') { + print $form->textwithpicto(dol_escape_htmltag($object->display_incoterms()), $object->label_incoterms, 1); + } else { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print ''; - print '
'; - print '
'; + print '
'; - print ''; + print ''; + print '
'; + print '
'; - print '
'; - // Amount HT - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount HT - print ''; - } - print ''; + print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - print ''; - // Amount VAT - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount VAT - print ''; - } - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { print ''; - print ''; - print ''; + // Amount HT + print ''; + print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + // Multicurrency Amount HT + print ''; } print ''; - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + // Amount VAT + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount VAT + print ''; + } + print ''; + + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { print ''; - print ''; - print ''; + print ''; + print ''; if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + print ''; } print ''; + + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print ''; + } + print ''; + } } - } - $alert = ''; - if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) { - $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->supplier_order_min_amount)); - } - - print ''; - // Amount TTC - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount TTC - print ''; - } - print ''; - - print '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . $alert . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - - // Margin Infos - /*if (isModEnabled('margin')) { - $formmargin->displayMarginInfos($object); - }*/ - - - print ''; - print ''; - - print '

'; - - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - /* - * Lines - */ - //$result = $object->getLinesArray(); - - - print '
- - - - - - - '; - - if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - print ''; - - // Add free products/services form - global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; - $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; - $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. - if (!empty($conf->global->SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY)) { - $senderissupplier = 1; - } - - // Show object lines - if (!empty($object->lines)) { - $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 1); - } - - $num = count($object->lines); - - // Form to add new line - if ($object->statut == CommandeFournisseur::STATUS_DRAFT && $usercancreate) { - if ($action != 'editline') { - // Add free products/services - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + $alert = ''; + if (!empty($conf->global->ORDER_MANAGE_MIN_AMOUNT) && $object->total_ht < $object->thirdparty->supplier_order_min_amount) { + $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->supplier_order_min_amount)); } + + print ''; + // Amount TTC + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount TTC + print ''; + } + print ''; + + print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . $alert . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; + + // Margin Infos + /*if (isModEnabled('margin')) { + $formmargin->displayMarginInfos($object); + }*/ + + + print '
'; + print ''; + + print '

'; + + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + /* + * Lines + */ + //$result = $object->getLinesArray(); + + + print ' + + + + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + print ''; + + // Add free products/services form + global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; + $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; + $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. + if (!empty($conf->global->SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY)) { + $senderissupplier = 1; + } + + // Show object lines + if (!empty($object->lines)) { + $object->printObjectLines($action, $object->thirdparty, $mysoc, $lineid, 1); + } + + $num = count($object->lines); + + // Form to add new line + if ($object->statut == CommandeFournisseur::STATUS_DRAFT && $usercancreate) { + if ($action != 'editline') { + // Add free products/services + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); + } + } + print '
'; + print '
'; + print '
'; } - print '
'; - print ''; - print ''; print dol_get_fiche_end(); From de0fe8ee85a72d9f20c18d92c7fc645d5057a36a Mon Sep 17 00:00:00 2001 From: manavb2214 <131509907+manavb2214@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:54:56 +0530 Subject: [PATCH 124/323] Update CONTRIBUTING.md (#26415) Fixed Typo Error. --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e9a65cbed64..c3cc2bbd538 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -107,7 +107,7 @@ NEW|New|QUAL|Qual|PERF|Perf Short description (In upper case to appear into Chan or Short description (when the commit is not introducing feature nor closing a bug) -Long description (Can span accross multiple lines). +Long description (Can span across multiple lines). ### Pull Requests From 3afaa266c38dd8f0dc38f05d570aff7faf039948 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 Nov 2023 14:25:14 +0100 Subject: [PATCH 125/323] add hook tabContentCreateInvoice (#26413) Co-authored-by: Christophe Battarel --- htdocs/compta/facture/card.php | 1441 ++++++++++++++++---------------- 1 file changed, 723 insertions(+), 718 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e2decaa1aef..c99bea286f6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3269,783 +3269,788 @@ if ($action == 'create') { print dol_get_fiche_head(''); - print ''; + // Call Hook tabContentCreateInvoice + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateInvoice', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - // Ref - //print ''; + // Ref + //print ''; - $exampletemplateinvoice = new FactureRec($db); - $invoice_predefined = new FactureRec($db); - if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { - $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); - } + $exampletemplateinvoice = new FactureRec($db); + $invoice_predefined = new FactureRec($db); + if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { + $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); + } - // Thirdparty - if ($soc->id > 0 && (!GETPOST('fac_rec', 'int') || !empty($invoice_predefined->frequency))) { - // If thirdparty known and not a predefined invoiced without a recurring rule - print ''; - print ''; + print ''; - print ''."\n"; - } else { - print ''; - print ''; - print ''."\n"; - } - - // Overwrite some values if creation of invoice is from a predefined invoice - if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { - $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); - - $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later - if (empty($projectid)) { - $projectid = $invoice_predefined->fk_project; - } - $cond_reglement_id = $invoice_predefined->cond_reglement_id; - $mode_reglement_id = $invoice_predefined->mode_reglement_id; - $fk_account = $invoice_predefined->fk_account; - $note_public = $invoice_predefined->note_public; - $note_private = $invoice_predefined->note_private; - - if (!empty($invoice_predefined->multicurrency_code)) { - $currency_code = $invoice_predefined->multicurrency_code; - } - if (!empty($invoice_predefined->multicurrency_tx)) { - $currency_tx = $invoice_predefined->multicurrency_tx; - } - - $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r'; - $sql .= ' WHERE r.fk_soc = '.((int) $invoice_predefined->socid); - - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - if ($num > 0) { - print ''; - } - $db->free($resql); - } else { - dol_print_error($db); - } - } - - print ''; + print ''."\n"; } - // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { - // Type de facture - $facids = $facturestatic->list_replacable_invoices($soc->id); - if ($facids < 0) { - dol_print_error($db, $facturestatic->error, $facturestatic->errors); - exit(); + // Overwrite some values if creation of invoice is from a predefined invoice + if (empty($origin) && empty($originid) && GETPOST('fac_rec', 'int') > 0) { + $invoice_predefined->fetch(GETPOST('fac_rec', 'int')); + + $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later + if (empty($projectid)) { + $projectid = $invoice_predefined->fk_project; } - $options = ""; - if (is_array($facids)) { - foreach ($facids as $facparam) { - $options .= ''; - } + $cond_reglement_id = $invoice_predefined->cond_reglement_id; + $mode_reglement_id = $invoice_predefined->mode_reglement_id; + $fk_account = $invoice_predefined->fk_account; + $note_public = $invoice_predefined->note_public; + $note_private = $invoice_predefined->note_private; + + if (!empty($invoice_predefined->multicurrency_code)) { + $currency_code = $invoice_predefined->multicurrency_code; + } + if (!empty($invoice_predefined->multicurrency_tx)) { + $currency_tx = $invoice_predefined->multicurrency_tx; } - print ''; - print '
'; - $tmp = 'id > 0) { - $tmp .= ' disabled'; - } - $tmp .= '> '; - print ''; - $text = $tmp.''; - $text .= '
'; + } + $db->free($resql); } else { - $text .= ''; + dol_print_error($db); } - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); - print $desc; - print ''; - } - } else { - if (!empty($conf->global->INVOICE_USE_SITUATION)) { - print '
'; - $tmp = ' '; - $text = $tmp.' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); - print $desc; - print '
'; } + print ''; + // pre-filled extra fields with selected credit note + $newinvoice_static->fetch_optionals($key); + $object->array_options = $newinvoice_static->array_options; + } + $optionsav .= '>'; + $optionsav .= $newinvoice_static->ref; + $optionsav .= ' ('.$newinvoice_static->getLibStatut(1, $valarray ['paymentornot']).')'; + $optionsav .= ''; + } - // Invoice Subtype - if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { - print ''; - } + print '
'; + $tmp = 'global->INVOICE_CREDIT_NOTE_STANDALONE)) || $invoice_predefined->id > 0) { + $tmp .= ' disabled'; + } + $tmp .= '> '; + // Show credit note options only if we checked credit note and disable standard invoice if "create credit note" button is pressed + print ''; + $text = ' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; - if ($socid > 0) { - // Discounts for third party - print '
'; - } - - $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); - $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); - - // Date invoice - print ''; - - // Date point of tax - if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { - print ''; - } - - // Payment term - print ''; - - - if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { - $rwStyle = 'display:none;'; - if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) { - $rwStyle = ''; - } - - $retained_warranty = GETPOST('retained_warranty', 'int'); - if (empty($retained_warranty)) { - if (!empty($objectsrc->retained_warranty)) { // use previous situation value - $retained_warranty = $objectsrc->retained_warranty; - } - } - $retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; - - print ''; + + // Invoice Subtype + if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { + print ''; + } + + if ($socid > 0) { + // Discounts for third party + print ''; + } + + $newdateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); + $date_pointoftax = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'), 'tzserver'); + + // Date invoice + print ''; + + // Date point of tax + if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { + print ''; + } + + // Payment term + print ''; + + + if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { + $rwStyle = 'display:none;'; + if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) { + $rwStyle = ''; + } + + $retained_warranty = GETPOST('retained_warranty', 'int'); + if (empty($retained_warranty)) { + if (!empty($objectsrc->retained_warranty)) { // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + } + } + $retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + + print ''; + print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); + print ''; - print ''; - } - - // Payment mode - print ''; - - // Bank Account - if (isModEnabled("banque")) { - print ''; - } - - // Project - if (isModEnabled('project')) { - $langs->load('projects'); - print ''; - } - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - print ''; - } - // Other attributes - $parameters = array('objectsrc' => !empty($objectsrc) ? $objectsrc : 0, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) { - if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE) && !empty($soc->id)) { - // copy from thirdparty - $tpExtrafields = new ExtraFields($db); - $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); - if ($soc->fetch_optionals() > 0) { - $object->array_options = array_merge($object->array_options, $soc->array_options); + // Payment mode + print ''; + + // Bank Account + if (isModEnabled("banque")) { + print ''; + } + + // Project + if (isModEnabled('project')) { + $langs->load('projects'); + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + print ''; } - print $object->showOptionals($extrafields, 'create', $parameters); - } + // Other attributes + $parameters = array('objectsrc' => !empty($objectsrc) ? $objectsrc : 0, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE) && !empty($soc->id)) { + // copy from thirdparty + $tpExtrafields = new ExtraFields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + } - // Template to use by default - print ''; - print '"; - - // Multicurrency - if (isModEnabled('multicurrency')) { - print ''; - print ''; - print ''; - } - - // Help of substitution key - $htmltext = ''; - if (GETPOST('fac_rec', 'int') > 0) { - $dateexample = ($newdateinvoice ? $newdateinvoice : $dateinvoice); - if (empty($dateexample)) { - $dateexample = dol_now(); + print $object->showOptionals($extrafields, 'create', $parameters); } - $substitutionarray = array( - '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', - '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', - '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')', - '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')', - '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')', - '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')', - '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')', - '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', - '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', - '__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', - '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')' - ); - $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; - foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.' = '.$langs->trans($val).'
'; + // Template to use by default + print '
'; + print '"; - // Public note - print ''; - print ''; - print ''; + print ''; + print ''; + } - // Private note - if (empty($user->socid)) { + // Help of substitution key + $htmltext = ''; + if (GETPOST('fac_rec', 'int') > 0) { + $dateexample = ($newdateinvoice ? $newdateinvoice : $dateinvoice); + if (empty($dateexample)) { + $dateexample = dol_now(); + } + $substitutionarray = array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', + '__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach ($substitutionarray as $key => $val) { + $htmltext .= $key.' = '.$langs->trans($val).'
'; + } + $htmltext .= '
'; + } + + // Public note print '
'; print ''; print ''; + + // Private note + if (empty($user->socid)) { + print ''; + print ''; + print ''; + } + + // Lines from source (TODO Show them also when creating invoice from template invoice) + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + $langs->loadLangs(array('orders', 'propal')); + + // TODO for compatibility + if ($origin == 'contrat') { + // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva + //$objectsrc->remise_absolue = $remise_absolue; + //$objectsrc->remise_percent = $remise_percent; + $objectsrc->update_price(1, 'auto', 1); + } + + print "\n\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + // The commented lines below are fields already added as hidden parameters before + //print ''; + //print ''; + + switch (get_class($objectsrc)) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + case 'Fichinter': + $newclassname = 'Intervention'; + break; + default: + $newclassname = get_class($objectsrc); + } + + // Ref of origin + print ''; + print ''; + print ''; + print '"; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 + print '"; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 + print '"; + } + print '"; + + if (isModEnabled('multicurrency')) { + print ''; + print '"; + print '"; + } + } + + print "
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; - print $soc->getNomUrl(1, 'customer'); - print ''; - // Outstanding Bill - $arrayoutstandingbills = $soc->getOutstandingBills(); - $outstandingBills = $arrayoutstandingbills['opened']; - print ' - '.$langs->trans('CurrentOutstandingBill').': '; - print ''.price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency).''; - if ($soc->outstanding_limit != '') { - if ($outstandingBills > $soc->outstanding_limit) { - print img_warning($langs->trans("OutstandingBillReached")); + // Thirdparty + if ($soc->id > 0 && (!GETPOST('fac_rec', 'int') || !empty($invoice_predefined->frequency))) { + // If thirdparty known and not a predefined invoiced without a recurring rule + print '
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1, 'customer'); + print ''; + // Outstanding Bill + $arrayoutstandingbills = $soc->getOutstandingBills(); + $outstandingBills = $arrayoutstandingbills['opened']; + print ' - '.$langs->trans('CurrentOutstandingBill').': '; + print ''.price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency).''; + if ($soc->outstanding_limit != '') { + if ($outstandingBills > $soc->outstanding_limit) { + print img_warning($langs->trans("OutstandingBillReached")); + } + print ' / '.price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); } - print ' / '.price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency); - } - print '
'.$langs->trans('Customer').''; - $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); - // Option to reload page to retrieve customer informations. - if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { - print ''; - } - if (!GETPOST('fac_rec', 'int')) { - print ' '; - } - print '
'.$langs->trans('CreateFromRepeatableInvoice').''; - //print ''; - print ''; - - print ajax_combobox("fac_rec"); - - // Option to reload page to retrieve customer informations. Note, this clear other input - if (empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED)) { - print ''; - } - print '
'.$langs->trans('Type').''; - print '
'."\n"; - - // Standard invoice - print '
'; - $tmp = ' '; - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3, 'standardonsmartphone'); - print ''; - print ''; - if ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid))) { - /*print '';*/ - print ''; - } - print '
'; - print $desc; - print ''; - $arraylist = array( - //'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), - //'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), - 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') - ); - print $form->selectarray('typestandard', $arraylist, GETPOST('typestandard', 'aZ09'), 0, 0, 0, '', 1); - print ''; - print ''.$langs->trans('PercentOfOriginalObject').':'; - print '
'; - print '
'; - - if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) { - // Deposit - Down payment - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { - print '
'; - $tmp = ' '; - print ''; - - print ''; - print ''; - if (($origin == 'propal') || ($origin == 'commande')) { - print ''; - print ''; + print ''."\n"; + } else { + print ''; + print '
'; - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone'); - print $desc; print ''; - $arraylist = array( - 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), - 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), - 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') - ); - $typedeposit = GETPOST('typedeposit', 'aZ09'); - $valuedeposit = GETPOST('valuedeposit', 'int'); - if (empty($typedeposit) && !empty($objectsrc->deposit_percent)) { - $origin_payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id); - if (!empty($origin_payment_conditions_deposit_percent)) { - $typedeposit = 'variable'; - } - } - if (empty($valuedeposit) && $typedeposit == 'variable' && !empty($objectsrc->deposit_percent)) { - $valuedeposit = $objectsrc->deposit_percent; - } - print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1); - print ''; - print ''.$langs->trans("AmountOrPercent").''; - print '
'.$langs->trans('Customer').''; + $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); + // Option to reload page to retrieve customer informations. + if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { + print ''; } - print '
'; - - print '
'; - } - } - - if ($socid > 0) { - if (!empty($conf->global->INVOICE_USE_SITUATION)) { - // First situation invoice - print '
'; - $tmp = ' '; - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); - print $desc; - print '
'; - - // Next situation invoice - $opt = $form->selectSituationInvoices(GETPOST('originid', 'int'), $socid); - - print '
'; - $tmp = ''.$langs->trans('NoSituations').'') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) { - $tmp .= ' disabled'; + if (!GETPOST('fac_rec', 'int')) { + print ' '; } - $tmp .= '> '; - $text = $tmp.' '; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; + print '
'.$langs->trans('CreateFromRepeatableInvoice').''; + //print ''; + print ''; + + print ajax_combobox("fac_rec"); + + // Option to reload page to retrieve customer informations. Note, this clear other input + if (empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED)) { + print ''; + } + print '
'.$langs->trans('Type').''; + print '
'."\n"; + + // Standard invoice print '
'; - $tmp = ' '; - $text = $tmp.' '; - //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'replacementonsmartphone'); + $tmp = ' '; + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3, 'standardonsmartphone'); + print ''; + print ''; + if ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid))) { + /*print '';*/ + print ''; + } + print '
'; print $desc; + print ''; + $arraylist = array( + //'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), + //'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), + 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') + ); + print $form->selectarray('typestandard', $arraylist, GETPOST('typestandard', 'aZ09'), 0, 0, 0, '', 1); + print ''; + print ''.$langs->trans('PercentOfOriginalObject').':'; + print '
'; print '
'; - } - - if (empty($origin)) { - if ($socid > 0) { - // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { - // Show link for credit note - $facids = $facturestatic->list_qualified_avoir_invoices($soc->id); - if ($facids < 0) { - dol_print_error($db, $facturestatic->error, $facturestatic->errors); - exit; - } - $optionsav = ""; - $newinvoice_static = new Facture($db); - foreach ($facids as $key => $valarray) { - $newinvoice_static->id = $key; - $newinvoice_static->ref = $valarray ['ref']; - $newinvoice_static->statut = $valarray ['status']; - $newinvoice_static->type = $valarray ['type']; - $newinvoice_static->paye = $valarray ['paye']; - - $optionsav .= ''; - } + if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (!empty($originid)))) { + // Deposit - Down payment + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
'; - $tmp = 'global->INVOICE_CREDIT_NOTE_STANDALONE)) || $invoice_predefined->id > 0) { - $tmp .= ' disabled'; - } - $tmp .= '> '; - // Show credit note options only if we checked credit note and disable standard invoice if "create credit note" button is pressed + $tmp = ' '; print ''; - $text = ' '; - $text .= ''; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); - print $desc; + jQuery(document).ready(function() { + jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { + jQuery("#radio_standard").prop("checked", true); + }); + jQuery("#typedeposit, #valuedeposit").click(function() { + jQuery("#radio_deposit").prop("checked", true); + }); + jQuery("#typedeposit").change(function() { + console.log("We change type of down payment"); + jQuery("#radio_deposit").prop("checked", true); + setRadioForTypeOfInvoice(); + }); + jQuery("#radio_standard, #radio_deposit, #radio_replacement, #radio_creditnote, #radio_template").change(function() { + setRadioForTypeOfInvoice(); + }); + function setRadioForTypeOfInvoice() { + console.log("Change radio"); + if (jQuery("#radio_deposit").prop("checked") && (jQuery("#typedeposit").val() == \'amount\' || jQuery("#typedeposit").val() == \'variable\')) { + jQuery(".checkforselect").prop("disabled", true); + jQuery(".checkforselect").prop("checked", false); + } else { + jQuery(".checkforselect").prop("disabled", false); + jQuery(".checkforselect").prop("checked", true); + } + } + }); + '; - print '
'; - print '    0 ? 'checked' : '').' /> "; - print '
    0 ? 'checked' : '').' /> "; - print '
'; + print ''; + print ''; + if (($origin == 'propal') || ($origin == 'commande')) { + print ''; + print ''; + } + print '
'; + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3, 'depositonsmartphone'); + print $desc; + print ''; + $arraylist = array( + 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), + 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), + 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') + ); + $typedeposit = GETPOST('typedeposit', 'aZ09'); + $valuedeposit = GETPOST('valuedeposit', 'int'); + if (empty($typedeposit) && !empty($objectsrc->deposit_percent)) { + $origin_payment_conditions_deposit_percent = getDictionaryValue('c_payment_term', 'deposit_percent', $objectsrc->cond_reglement_id); + if (!empty($origin_payment_conditions_deposit_percent)) { + $typedeposit = 'variable'; + } + } + if (empty($valuedeposit) && $typedeposit == 'variable' && !empty($objectsrc->deposit_percent)) { + $valuedeposit = $objectsrc->deposit_percent; + } + print $form->selectarray('typedeposit', $arraylist, $typedeposit, 0, 0, 0, '', 1); + print ''; + print ''.$langs->trans("AmountOrPercent").''; + print '
'; + print '
'; + } + } + + if ($socid > 0) { + if (!empty($conf->global->INVOICE_USE_SITUATION)) { + // First situation invoice + print '
'; + $tmp = ' '; + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); + print $desc; + print '
'; + + // Next situation invoice + $opt = $form->selectSituationInvoices(GETPOST('originid', 'int'), $socid); + + print '
'; + $tmp = ''.$langs->trans('NoSituations').'') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) { + $tmp .= ' disabled'; + } + $tmp .= '> '; + $text = $tmp.' '; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceSituationDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + } + + // Replacement + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) { + // Type de facture + $facids = $facturestatic->list_replacable_invoices($soc->id); + if ($facids < 0) { + dol_print_error($db, $facturestatic->error, $facturestatic->errors); + exit(); + } + $options = ""; + if (is_array($facids)) { + foreach ($facids as $facparam) { + $options .= ''; + } + } + + print ''; + print '
'; + $tmp = 'id > 0) { + $tmp .= ' disabled'; + } + $tmp .= '> '; + print ''; + $text = $tmp.''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; print '
'; } } else { + if (!empty($conf->global->INVOICE_USE_SITUATION)) { + print '
'; + $tmp = ' '; + $text = $tmp.' '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3, 'firstsituationonsmartphone'); + print $desc; + print '
'; + } + print '
'; - if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { - $tmp = ' '; - } else { - $tmp = ' '; - } - $text = $tmp.' '; + $tmp = ' '; + $text = $tmp.' '; //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'replacementonsmartphone'); print $desc; - print '
'."\n"; - } - } - - // Template invoice - print '
'; - $tmp = ' '; - $text = $tmp.' '; - $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone'); - print $desc; - print '
'; - - print '
'; - - - if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf - // Add auto select default document model - $listtType = array(Facture::TYPE_STANDARD, Facture::TYPE_REPLACEMENT, Facture::TYPE_CREDIT_NOTE, Facture::TYPE_DEPOSIT, Facture::TYPE_SITUATION); - $jsListType = ''; - foreach ($listtType as $type) { - $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; - $curent = getDolGlobalString($thisTypeConfName, getDolGlobalString('FACTURE_ADDON_PDF')); - $jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"'; + print ''; } - print ''; - } + if (empty($origin)) { + if ($socid > 0) { + // Credit note + if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { + // Show link for credit note + $facids = $facturestatic->list_qualified_avoir_invoices($soc->id); + if ($facids < 0) { + dol_print_error($db, $facturestatic->error, $facturestatic->errors); + exit; + } + $optionsav = ""; + $newinvoice_static = new Facture($db); + foreach ($facids as $key => $valarray) { + $newinvoice_static->id = $key; + $newinvoice_static->ref = $valarray ['ref']; + $newinvoice_static->statut = $valarray ['status']; + $newinvoice_static->type = $valarray ['type']; + $newinvoice_static->paye = $valarray ['paye']; + $optionsav .= '
'.$langs->trans('InvoiceSubtype').''; - print $form->getSelectInvoiceSubtype(GETPOST('subtype'), 'subtype', 1, 0, ''); - print '
'.$langs->trans('DiscountStillRemaining').''; + print '
'; + print '    0 ? 'checked' : '').' /> "; + print '
    0 ? 'checked' : '').' /> "; + print '
'; - $thirdparty = $soc; - $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'.$langs->trans('DateInvoice').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1); - print '
'.$langs->trans('DatePointOfTax').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); - print '
'.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx'); - print '
'.$langs->trans('RetainedWarranty').''; - print '%'; - - // Retained warranty payment term - print '
'.$langs->trans('PaymentConditionsShortRetainedWarranty').''; - $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - if (empty($retained_warranty_fk_cond_reglement)) { - $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value - $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + print ''; + } } else { + print '
'; + if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { + $tmp = ' '; + } else { + $tmp = ' '; + } + $text = $tmp.' '; + //$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc").'

'.$langs->trans("YouMustCreateInvoiceFromThird"), 1, 'help', '', 0, 3, 'creditnoteonsmartphone'); + print $desc; + print '
'."\n"; + } + } + + // Template invoice + print '
'; + $tmp = ' '; + $text = $tmp.' '; + $desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3, 'templateonsmartphone'); + print $desc; + print '
'; + + print ''; + + + if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { // Hidden conf + // Add auto select default document model + $listtType = array(Facture::TYPE_STANDARD, Facture::TYPE_REPLACEMENT, Facture::TYPE_CREDIT_NOTE, Facture::TYPE_DEPOSIT, Facture::TYPE_SITUATION); + $jsListType = ''; + foreach ($listtType as $type) { + $thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type; + $curent = getDolGlobalString($thisTypeConfName, getDolGlobalString('FACTURE_ADDON_PDF')); + $jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"'; + } + + print ''; + } + + + print '
'.$langs->trans('InvoiceSubtype').''; + print $form->getSelectInvoiceSubtype(GETPOST('subtype'), 'subtype', 1, 0, ''); + print '
'.$langs->trans('DiscountStillRemaining').''; + + $thirdparty = $soc; + $discount_type = 0; + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$langs->trans('DateInvoice').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($newdateinvoice ? $newdateinvoice : $dateinvoice, '', '', '', '', "add", 1, 1); + print '
'.$langs->trans('DatePointOfTax').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1); + print '
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1, 0, 'maxwidth500 widthcentpercentminusx'); + print '
'.$langs->trans('RetainedWarranty').''; + print '%'; + + // Retained warranty payment term + print '
'.$langs->trans('PaymentConditionsShortRetainedWarranty').''; + $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + if (empty($retained_warranty_fk_cond_reglement)) { $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + } else { + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + } } - } - print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); - print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank', 'class="pictofixedwidth"'); - print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('Project').''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; - print '
'; - $incoterm_id = GETPOST('incoterm_id'); - $incoterm_location = GETPOST('location_incoterms'); - if (empty($incoterm_id)) { - $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); - $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + '; } - print img_picto('', 'incoterm', 'class="pictofixedwidth"'); - print $form->select_incoterms($incoterm_id, $incoterm_location); - print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('BankAccount').''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); + print $form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('Project').''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print '
'; + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); } + print img_picto('', 'incoterm', 'class="pictofixedwidth"'); + print $form->select_incoterms($incoterm_id, $incoterm_location); + print '
'.$langs->trans('Model').''; - print img_picto('', 'pdf', 'class="pictofixedwidth"'); - include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; - $liste = ModelePDFFactures::liste_modeles($db); - if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { - // Hidden conf - $paramkey = 'FACTURE_ADDON_PDF_'.$object->type; - $preselected = !empty($conf->global->$paramkey) ? $conf->global->$paramkey : $conf->global->FACTURE_ADDON_PDF; - } else { - $preselected = $conf->global->FACTURE_ADDON_PDF; - } - print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); - print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print img_picto('', 'currency', 'class="pictofixedwidth"'); - print $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code'); - print '
'.$langs->trans('Model').''; + print img_picto('', 'pdf', 'class="pictofixedwidth"'); + include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; + $liste = ModelePDFFactures::liste_modeles($db); + if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) { + // Hidden conf + $paramkey = 'FACTURE_ADDON_PDF_'.$object->type; + $preselected = !empty($conf->global->$paramkey) ? $conf->global->$paramkey : $conf->global->FACTURE_ADDON_PDF; + } else { + $preselected = $conf->global->FACTURE_ADDON_PDF; } - $htmltext .= ''; - } + print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); + print "
'; - print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); - print ''; - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); + // Multicurrency + if (isModEnabled('multicurrency')) { + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code'); + print '
'; - print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); print ''; - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); - // print ' - print '
'; + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print ''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ' + print '
'.$langs->trans($newclassname).''; + print $objectsrc->getNomUrl(1); + // We check if Origin document (id and type is known) has already at least one invoice attached to it + $objectsrc->fetchObjectLinked($originid, $origin, '', 'facture'); + if (isset($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { + setEventMessages('WarningBillExist', null, 'warnings'); + echo ' - '.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1); + } + echo '
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
\n"; } - - // Lines from source (TODO Show them also when creating invoice from template invoice) - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - $langs->loadLangs(array('orders', 'propal')); - - // TODO for compatibility - if ($origin == 'contrat') { - // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva - //$objectsrc->remise_absolue = $remise_absolue; - //$objectsrc->remise_percent = $remise_percent; - $objectsrc->update_price(1, 'auto', 1); - } - - print "\n\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - // The commented lines below are fields already added as hidden parameters before - //print ''; - //print ''; - - switch (get_class($objectsrc)) { - case 'Propal': - $newclassname = 'CommercialProposal'; - break; - case 'Commande': - $newclassname = 'Order'; - break; - case 'Expedition': - $newclassname = 'Sending'; - break; - case 'Contrat': - $newclassname = 'Contract'; - break; - case 'Fichinter': - $newclassname = 'Intervention'; - break; - default: - $newclassname = get_class($objectsrc); - } - - // Ref of origin - print '
'.$langs->trans($newclassname).''; - print $objectsrc->getNomUrl(1); - // We check if Origin document (id and type is known) has already at least one invoice attached to it - $objectsrc->fetchObjectLinked($originid, $origin, '', 'facture'); - if (isset($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { - setEventMessages('WarningBillExist', null, 'warnings'); - echo ' - '.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1); - } - echo '
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
\n"; - print dol_get_fiche_end(); print $form->buttonsSaveCancel("CreateDraft"); From b3e7457cd3df0b5feadfb672434a37e2d66d9ba4 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 Nov 2023 14:25:26 +0100 Subject: [PATCH 126/323] NEW : add new hook tabContentCreateOrder (#26408) * NEW : add new hook tabContentCreateOrder * update comment --------- Co-authored-by: Christophe Battarel --- htdocs/commande/card.php | 552 ++++++++++++++++++++------------------- 1 file changed, 279 insertions(+), 273 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e5bee1124e4..f61e78c5d41 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1816,289 +1816,295 @@ if ($action == 'create' && $usercancreate) { print dol_get_fiche_head(''); - print ''; - - // Reference - print ''; - - // Reference client - print ''; - } else { - print ''; - } - print ''; - - // Thirdparty - print ''; - print ''; - if ($socid > 0) { - print ''; - } else { - print ''; - } - print ''."\n"; - - // Contact of order - if ($socid > 0) { - // Contacts (ask contact only if thirdparty already defined). - print "'; - - // Ligne info remises tiers - print ''; - } - - // Date - print ''; - - // Date delivery planned - print ''; - print '\n"; - print ''; - - // Delivery delay - print ''; - - // Terms of payment - print ''; - - // Payment mode - print ''; - - // Bank Account - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { - print ''; - } - - // Shipping Method - if (isModEnabled('expedition')) { - print ''; - } - - // Warehouse - if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - print ''; - } - - // Source / Channel - What trigger creation - print ''; - - // TODO How record was recorded OrderMode (llx_c_input_method) - - // Project - if (isModEnabled('project')) { - $langs->load("projects"); - print ''; - print ''; - print ''; - } - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - print ''; - } - - // Other attributes + // Call Hook tabContentCreateOrder $parameters = array(); - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - $parameters['objectsrc'] = $objectsrc; - } - $parameters['socid'] = $socid; - // Note that $action and $object may be modified by hook - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); - print $hookmanager->resPrint; + $reshook = $hookmanager->executeHooks('tabContentCreateOrder', $parameters, $object, $action); if (empty($reshook)) { - if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER) && !empty($soc->id)) { - // copy from thirdparty - $tpExtrafields = new ExtraFields($db); - $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); - if ($soc->fetch_optionals() > 0) { - $object->array_options = array_merge($object->array_options, $soc->array_options); + print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; - if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && !empty($origin) && !empty($originid)) { - print '
'.$langs->trans('Customer').''; - print $soc->getNomUrl(1, 'customer'); - print ''; - print ''; - $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); - // reload page to retrieve customer informations - if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { - print ''; - } - print ' '; - print '
".$langs->trans("DefaultContact").''; - print img_picto('', 'contact', 'class="pictofixedwidth"'); - print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('Discounts').''; - - $absolute_discount = $soc->getAvailableDiscounts(); - - $thirdparty = $soc; - $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'.$langs->trans('Date').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date - print '
'.$langs->trans("DateDeliveryPlanned").''; - $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1); - print "
'.$langs->trans('AvailabilityPeriod').''; - print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id') : $availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); - print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank', 'class="pictofixedwidth"'); - print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); - $form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOST('shipping_method_id', 'int') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('Warehouse').''; - print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); - print '
'.$langs->trans('Channel').''; - print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason((GETPOSTISSET('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id).'">'; - print '
'; - $incoterm_id = GETPOST('incoterm_id'); - $incoterm_location = GETPOST('location_incoterms'); - if (empty($incoterm_id)) { - $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); - $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); - } - print img_picto('', 'incoterm', 'class="pictofixedwidth"'); - print $form->select_incoterms($incoterm_id, $incoterm_location); - print '
'; + + // Reference + print ''; + + // Reference client + print ''; + } else { + print ''; + } + print ''; + + // Thirdparty + print ''; + print ''; + if ($socid > 0) { + print ''; + } else { + print ''; + } + print ''."\n"; + + // Contact of order + if ($socid > 0) { + // Contacts (ask contact only if thirdparty already defined). + print "'; + + // Ligne info remises tiers + print ''; + } + + // Date + print ''; + + // Date delivery planned + print ''; + print '\n"; + print ''; + + // Delivery delay + print ''; + + // Terms of payment + print ''; + + // Payment mode + print ''; + + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { + print ''; + } + + // Shipping Method + if (isModEnabled('expedition')) { + print ''; + } + + // Warehouse + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print ''; + } + + // Source / Channel - What trigger creation + print ''; + + // TODO How record was recorded OrderMode (llx_c_input_method) + + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + print ''; + print ''; + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters = array(); + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + $parameters['objectsrc'] = $objectsrc; + } + $parameters['socid'] = $socid; + + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); + print $hookmanager->resPrint; + if (empty($reshook)) { + if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER) && !empty($soc->id)) { + // copy from thirdparty + $tpExtrafields = new ExtraFields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + } + + print $object->showOptionals($extrafields, 'create', $parameters); + } + + // Template to use by default + print ''; + print '"; + + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''; + print ''; + } + + // Note public + print ''; + print ''; + print ''; + + // Note private + if (empty($user->socid)) { + print ''; + print ''; + print ''; + } + + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + // TODO for compatibility + if ($origin == 'contrat') { + // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva + //$objectsrc->remise_absolue = $remise_absolue; + //$objectsrc->remise_percent = $remise_percent; + $objectsrc->update_price(1); + } + + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + + switch ($classname) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + + print ''; + + // Amount + print ''; + print '"; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 RE + print '"; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 IRPF + print '"; + } + + print '"; + + if (isModEnabled("multicurrency")) { + print ''; + print '"; + print '"; } } - print $object->showOptionals($extrafields, 'create', $parameters); - } - - // Template to use by default - print ''; - print '"; - - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''; - print ''; - } - - // Note public - print ''; - print ''; - print ''; - - // Note private - if (empty($user->socid)) { - print ''; - print ''; - print ''; - } - - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - // TODO for compatibility - if ($origin == 'contrat') { - // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva - //$objectsrc->remise_absolue = $remise_absolue; - //$objectsrc->remise_percent = $remise_percent; - $objectsrc->update_price(1); - } - - print "\n"; print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; - switch ($classname) { - case 'Propal': - $newclassname = 'CommercialProposal'; - break; - case 'Commande': - $newclassname = 'Order'; - break; - case 'Expedition': - $newclassname = 'Sending'; - break; - case 'Contrat': - $newclassname = 'Contract'; - break; - default: - $newclassname = $classname; - } - - print ''; - - // Amount - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 RE - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 IRPF - print '"; - } - - print '"; - - if (isModEnabled("multicurrency")) { - print ''; - print '"; - print '"; - } + print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; + if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && !empty($origin) && !empty($originid)) { + print '
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1, 'customer'); + print ''; + print ''; + $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); + // reload page to retrieve customer informations + if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { + print ''; + } + print ' '; + print '
".$langs->trans("DefaultContact").''; + print img_picto('', 'contact', 'class="pictofixedwidth"'); + print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, !empty($srccontactslist)?$srccontactslist:"", '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('Discounts').''; + + $absolute_discount = $soc->getAvailableDiscounts(); + + $thirdparty = $soc; + $discount_type = 0; + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$langs->trans('Date').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date + print '
'.$langs->trans("DateDeliveryPlanned").''; + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1); + print "
'.$langs->trans('AvailabilityPeriod').''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id') : $availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('BankAccount').''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('SendingMethod').''; + print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOST('shipping_method_id', 'int') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('Warehouse').''; + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print '
'.$langs->trans('Channel').''; + print img_picto('', 'question', 'class="pictofixedwidth"'); + $form->selectInputReason((GETPOSTISSET('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans("Project").''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print ' id).'">'; + print '
'; + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print img_picto('', 'incoterm', 'class="pictofixedwidth"'); + print $form->select_incoterms($incoterm_id, $incoterm_location); + print '
'.$langs->trans('DefaultModel').''; + include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; + $liste = ModelePDFCommandes::liste_modeles($db); + $preselected = $conf->global->COMMANDE_ADDON_PDF; + print img_picto('', 'pdf', 'class="pictofixedwidth"'); + print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); + print "
'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('NotePublic').''; + + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ''; + print '
'.$langs->trans('NotePrivate').''; + + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ''; + print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'.$langs->trans('DefaultModel').''; - include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; - $liste = ModelePDFCommandes::liste_modeles($db); - $preselected = $conf->global->COMMANDE_ADDON_PDF; - print img_picto('', 'pdf', 'class="pictofixedwidth"'); - print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); - print "
'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('NotePublic').''; - - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - // print ''; - print '
'.$langs->trans('NotePrivate').''; - - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - // print ''; - print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; } - print "\n"; - - print ''; - print dol_get_fiche_end(); print $form->buttonsSaveCancel("CreateDraft"); From 9580f5bc1101dc221295a2afcca0d54f35b7b56f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 Nov 2023 14:25:33 +0100 Subject: [PATCH 127/323] add hook tabContentCreateProposal (#26411) Co-authored-by: Christophe Battarel --- htdocs/comm/propal/card.php | 600 ++++++++++++++++++------------------ 1 file changed, 303 insertions(+), 297 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3b317504c7f..494d2bbf121 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1853,312 +1853,318 @@ if ($action == 'create') { print dol_get_fiche_head(); - print ''; + // Call Hook tabContentCreateProposal + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateProposal', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - // Reference - print ''; + // Reference + print ''; - // Ref customer - print ''; - print ''; - - // Third party - print ''; - print ''; - $shipping_method_id = 0; - if ($socid > 0) { - print ''; - if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { - $shipping_method_id = $soc->shipping_method_id; - } - //$warehouse_id = $soc->warehouse_id; - } else { - print ''; - } - print ''."\n"; - - if ($socid > 0) { - // Contacts (ask contact only if thirdparty already defined). - print ''; - - // Third party discounts info line - print ''; - } - - // Date - print ''; - - // Validaty duration - print ''; - - // Terms of payment - print ''; - - // Mode of payment - print ''; - - // Bank Account - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { - print ''; - } - - // Source / Channel - What trigger creation - print ''; - - // Delivery delay - print ''; - - // Shipping Method - if (isModEnabled("expedition")) { - if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { - $shipping_method_id = $soc->shipping_method_id; - } - print ''; - } - - // Warehouse - if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - print ''; - } - - // Delivery date (or manufacturing) - print ''; - print ''; - - // Project - if (isModEnabled('project')) { - $langs->load("projects"); - print ''; - print ''; + // Ref customer + print ''; print ''; - } - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - print ''; - } - - // Template to use by default - print ''; - print ''; - print '"; - - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''; - print ''; - } - - // Public note - print ''; - print ''; - print ''; - print ''; - print ''; - } - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - - // Lines from source - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - // TODO for compatibility - if ($origin == 'contrat') { - // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva - //$objectsrc->remise_absolue = $remise_absolue; // deprecated - //$objectsrc->remise_percent = $remise_percent; - $objectsrc->update_price(1, 'auto', 1); - } - - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; - - $newclassname = $classname; - if ($newclassname == 'Propal') { - $newclassname = 'CommercialProposal'; - } elseif ($newclassname == 'Commande') { - $newclassname = 'Order'; - } elseif ($newclassname == 'Expedition') { - $newclassname = 'Sending'; - } elseif ($newclassname == 'Fichinter') { - $newclassname = 'Intervention'; - } - - print ''; - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 - print '"; - } - print '"; - - if (isModEnabled("multicurrency")) { - print ''; - print '"; - print '"; - } - } - - print "
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; - print '
'.$langs->trans('Customer').''; - print $soc->getNomUrl(1, 'customer'); - print ''; - print ''; - $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); - // reload page to retrieve customer informations - if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { - print ''; - } - print ' '; - print '
'.$langs->trans("DefaultContact").''; - print img_picto('', 'contact', 'class="pictofixedwidth"'); - print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300'); - print '
'.$langs->trans('Discounts').''; - - $absolute_discount = $soc->getAvailableDiscounts(); - - $thirdparty = $soc; - $discount_type = 0; - $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - print '
'.$langs->trans('DatePropal').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate('', '', '', '', '', "addprop", 1, 1); - print '
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock', 'class="pictofixedwidth"').' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'payment', 'class="pictofixedwidth"'); - // at last resort we take the payment term id which may be filled by default values set (if not getpostisset) - print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent); - print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank', 'class="pictofixedwidth"'); - print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('Source').''; - print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id', 'int') : ''), 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('AvailabilityPeriod'); - if (isModEnabled('commande')) { - print ' ('.$langs->trans('AfterOrder').')'; - } - print ''; - print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id', 'int') : ''), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('SendingMethod').''; - print img_picto('', 'dolly', 'class="pictofixedwidth"'); - $form->selectShippingMethod((GETPOSTISSET('shipping_method_id') ? GETPOST('shipping_method_id', 'int') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('Warehouse').''; - print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); - print '
'.$langs->trans("DeliveryDate").''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty - $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop"); - } else { - print $form->selectDate(-1, 'date_livraison', '', '', '', "addprop", 1, 1); - } - print '
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id).'">'; - print '
'.$langs->trans('RefCustomer').''; + print '
'; - print img_picto('', 'incoterm', 'class="pictofixedwidth"'); - print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : '')); - print '
'.$langs->trans("DefaultModel").''; - print img_picto('', 'pdf', 'class="pictofixedwidth"'); - $liste = ModelePDFPropales::liste_modeles($db); - $preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF")); - print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); - print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0); - print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); - $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - - // Private note - if (empty($user->socid)) { - print '
'.$langs->trans('NotePrivate').''; - $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null)); - $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - // print ' - print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
\n"; - - - /* - * Combobox for copy function - */ - - if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { - print ''; - } - - if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { - print '
'; - - // For backward compatibility - print ''; - print ''; - print ''; - print ''; + print ''; + $shipping_method_id = 0; + if ($socid > 0) { + print ''; + if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { + $shipping_method_id = $soc->shipping_method_id; } - print $form->selectarray("copie_propal", $liste_propal, 0); + //$warehouse_id = $soc->warehouse_id; } else { - dol_print_error($db); + print ''; + } + print ''."\n"; + + if ($socid > 0) { + // Contacts (ask contact only if thirdparty already defined). + print ''; + + // Third party discounts info line + print ''; + } + + // Date + print ''; + + // Validaty duration + print ''; + + // Terms of payment + print ''; + + // Mode of payment + print ''; + + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { + print ''; + } + + // Source / Channel - What trigger creation + print ''; + + // Delivery delay + print ''; + + // Shipping Method + if (isModEnabled("expedition")) { + if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { + $shipping_method_id = $soc->shipping_method_id; + } + print ''; + } + + // Warehouse + if (isModEnabled('stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print ''; + } + + // Delivery date (or manufacturing) + print ''; + print ''; - print ''; - print ''; - print '
'.$langs->trans("CopyPropalFrom").' '; - $liste_propal = array(); - $liste_propal [0] = ''; - - $sql = "SELECT p.rowid as id, p.ref, s.nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."propal p"; - $sql .= ", ".MAIN_DB_PREFIX."societe s"; - $sql .= " WHERE s.rowid = p.fk_soc"; - $sql .= " AND p.entity IN (".getEntity('propal').")"; - $sql .= " AND p.fk_statut <> 0"; - $sql .= " ORDER BY Id"; - - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) { - $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; - $liste_propal[$row[0]] = $propalRefAndSocName; - $i++; + // Third party + print '
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1, 'customer'); + print ''; + print ''; + $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + // reload page to retrieve customer informations + if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { + print ''; + } + print ' '; + print '
'.$langs->trans("DefaultContact").''; + print img_picto('', 'contact', 'class="pictofixedwidth"'); + print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300'); + print '
'.$langs->trans('Discounts').''; + + $absolute_discount = $soc->getAvailableDiscounts(); + + $thirdparty = $soc; + $discount_type = 0; + $backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode(GETPOST('origin')).'&originid='.urlencode(GETPOSTINT('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + print '
'.$langs->trans('DatePropal').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate('', '', '', '', '', "addprop", 1, 1); + print '
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock', 'class="pictofixedwidth"').' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + // at last resort we take the payment term id which may be filled by default values set (if not getpostisset) + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent); + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('Source').''; + print img_picto('', 'question', 'class="pictofixedwidth"'); + $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id', 'int') : ''), 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('AvailabilityPeriod'); + if (isModEnabled('commande')) { + print ' ('.$langs->trans('AfterOrder').')'; + } + print ''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id', 'int') : ''), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('SendingMethod').''; + print img_picto('', 'dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod((GETPOSTISSET('shipping_method_id') ? GETPOST('shipping_method_id', 'int') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('Warehouse').''; + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print '
'.$langs->trans("DeliveryDate").''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty + $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop"); + } else { + print $form->selectDate(-1, 'date_livraison', '', '', '', "addprop", 1, 1); } print '
'.$langs->trans("CreateEmptyPropal").'
'; + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + print ''; + print ''.$langs->trans("Project").''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print ' id).'">'; + print ''; + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + print ''; + print img_picto('', 'incoterm', 'class="pictofixedwidth"'); + print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : '')); + print ''; + } + + // Template to use by default + print ''; + print ''.$langs->trans("DefaultModel").''; + print ''; + print img_picto('', 'pdf', 'class="pictofixedwidth"'); + $liste = ModelePDFPropales::liste_modeles($db); + $preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF")); + print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); + print ""; + + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print ''; + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany'))?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0); + print ''; + } + + // Public note + print ''; + print ''.$langs->trans('NotePublic').''; + print ''; + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml'); + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + + // Private note + if (empty($user->socid)) { + print ''; + print ''.$langs->trans('NotePrivate').''; + print ''; + $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null)); + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ' + print ''; + } + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + + // Lines from source + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + // TODO for compatibility + if ($origin == 'contrat') { + // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva + //$objectsrc->remise_absolue = $remise_absolue; // deprecated + //$objectsrc->remise_percent = $remise_percent; + $objectsrc->update_price(1, 'auto', 1); + } + + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + + $newclassname = $classname; + if ($newclassname == 'Propal') { + $newclassname = 'CommercialProposal'; + } elseif ($newclassname == 'Commande') { + $newclassname = 'Order'; + } elseif ($newclassname == 'Expedition') { + $newclassname = 'Sending'; + } elseif ($newclassname == 'Fichinter') { + $newclassname = 'Intervention'; + } + + print ''.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).''; + print ''.$langs->trans('AmountHT').''.price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency).""; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency).""; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency).""; + } + print ''.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).""; + + if (isModEnabled("multicurrency")) { + print ''.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).''; + print ''.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva).""; + print ''.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc).""; + } + } + + print "\n"; + + + /* + * Combobox for copy function + */ + + if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { + print ''; + } + + if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) { + print '
'; + + // For backward compatibility + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print '
'.$langs->trans("CopyPropalFrom").' '; + $liste_propal = array(); + $liste_propal [0] = ''; + + $sql = "SELECT p.rowid as id, p.ref, s.nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."propal p"; + $sql .= ", ".MAIN_DB_PREFIX."societe s"; + $sql .= " WHERE s.rowid = p.fk_soc"; + $sql .= " AND p.entity IN (".getEntity('propal').")"; + $sql .= " AND p.fk_statut <> 0"; + $sql .= " ORDER BY Id"; + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + $propalRefAndSocName = $row[1]." - ".$row[2]; + $liste_propal[$row[0]] = $propalRefAndSocName; + $i++; + } + print $form->selectarray("copie_propal", $liste_propal, 0); + } else { + dol_print_error($db); + } + print '
'.$langs->trans("CreateEmptyPropal").'
'; + } } print dol_get_fiche_end(); From 80734cc94522edac1ac1efa58521ac216567f1c4 Mon Sep 17 00:00:00 2001 From: manavb2214 <131509907+manavb2214@users.noreply.github.com> Date: Wed, 1 Nov 2023 18:55:48 +0530 Subject: [PATCH 128/323] Update CONTRIBUTING.md (#26412) Fixed a Typographical Error. --- .github/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c3cc2bbd538..90ab6c01ccd 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -37,7 +37,7 @@ Unless you're fixing a bug, all pull requests should be made against the *develo If you're fixing a bug, it is preferred that you cook your fix and pull request it against an oldest version affected. -We recommand to push it into N - 2 for N the latest version available, if not possible into version N - 1, and finally into develop. +We recommend to push it into N - 2 for N the latest version available, if not possible into version N - 1, and finally into develop. This is just a recommendation, currently, if you push a bug fix on a very old version, it is still merged and propagated into higher versions. From 23c944a104336f368c6a2e5dfdd2078e2af63ba8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 1 Nov 2023 15:00:29 +0100 Subject: [PATCH 129/323] NEW : customize position in complete_head_from_modules (#26406) * NEW : customize position in complete_head_from_modules * fix parenthesis search * fix position search --------- Co-authored-by: Christophe Battarel --- htdocs/core/lib/functions.lib.php | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 52859d2ea81..2b67b680615 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9894,6 +9894,21 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $reg = array(); if ($mode == 'add' && !preg_match('/^\-/', $values[1])) { + $newtab = array(); + $postab = $h; + // detect if position set in $values[1] ie : +(2)mytab@mymodule (first tab is 0, second is one, ...) + $str = $values[1]; + $posstart = strpos($str, '('); + if ($posstart > 0) { + $posend = strpos($str, ')'); + if ($posstart > 0) { + $res1 = substr($str, $posstart + 1, $posend - $posstart -1); + if (is_numeric($res1)) { + $postab = (int) $res1; + $values[1] = '+' . substr($str, $posend + 1); + } + } + } if (count($values) == 6) { // new declaration with permissions: // $value='objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__' @@ -9943,9 +9958,9 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, } } - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); - $head[$h][1] = $label; - $head[$h][2] = str_replace('+', '', $values[1]); + $newtab[0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); + $newtab[1] = $label; + $newtab[2] = str_replace('+', '', $values[1]); $h++; } } elseif (count($values) == 5) { // case deprecated @@ -9976,11 +9991,13 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $label = $langs->trans($values[2]); } - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[4]), 1); - $head[$h][1] = $label; - $head[$h][2] = str_replace('+', '', $values[1]); + $newtab[0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[4]), 1); + $newtab[1] = $label; + $newtab[2] = str_replace('+', '', $values[1]); $h++; } + // set tab at its position + $head = array_merge(array_slice($head, 0, $postab), array($newtab), array_slice($head, $postab)); } elseif ($mode == 'remove' && preg_match('/^\-/', $values[1])) { if ($values[0] != $type) { continue; From ba458ddfd647a2f670a1fa798ba7d57ded31e5f3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 1 Nov 2023 15:00:48 +0100 Subject: [PATCH 130/323] Review of ledger display (#26423) * Review of ledger display * typo * Update listbyaccount.php * Update listbyaccount.php --------- Co-authored-by: Laurent Destailleur --- .../accountancy/bookkeeping/listbyaccount.php | 90 ++++++++++++------- htdocs/product/class/product.class.php | 4 +- 2 files changed, 60 insertions(+), 34 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7135044ef09..3e4055510cd 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2020 Florian Henry - * Copyright (C) 2013-2022 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -164,12 +164,13 @@ $arrayfields = array( 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1), 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1), 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1), + 't.lettering_code'=>array('label'=>$langs->trans("Lettering"), 'checked'=>1), 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1), 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1), - 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), - 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), - 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), + 't.balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1), + 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>-1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>-1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), + 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>-1, 'position'=>1100), ); if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) { @@ -260,9 +261,9 @@ if (empty($reshook)) { $search_date_validation_endyear = ''; $search_date_validation_endmonth = ''; $search_date_validation_endday = ''; + $search_lettering_code = ''; $search_debit = ''; $search_credit = ''; - $search_lettering_code = ''; $search_not_reconciled = ''; $search_import_key = ''; $toselect = array(); @@ -339,6 +340,10 @@ if (empty($reshook)) { $param .= '&search_ledger_code[]='.urlencode($code); } } + if (!empty($search_lettering_code)) { + $filter['t.lettering_code'] = $search_lettering_code; + $param .= '&search_lettering_code='.urlencode($search_lettering_code); + } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; $param .= '&search_debit='.urlencode($search_debit); @@ -347,10 +352,6 @@ if (empty($reshook)) { $filter['t.credit'] = $search_credit; $param .= '&search_credit='.urlencode($search_credit); } - if (!empty($search_lettering_code)) { - $filter['t.lettering_code'] = $search_lettering_code; - $param .= '&search_lettering_code='.urlencode($search_lettering_code); - } if (!empty($search_not_reconciled)) { $filter['t.reconciled_option'] = $search_not_reconciled; $param .= '&search_not_reconciled='.urlencode($search_not_reconciled); @@ -679,7 +680,6 @@ if (empty($reshook)) { $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly')); } - $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); } @@ -844,6 +844,13 @@ if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.label_operation']['checked'])) { print ''; } +// Lettering code +if (!empty($arrayfields['t.lettering_code']['checked'])) { + print ''; + print ''; + print '
'.$langs->trans("NotReconciled").''; + print ''; +} // Debit if (!empty($arrayfields['t.debit']['checked'])) { print ''; @@ -852,12 +859,9 @@ if (!empty($arrayfields['t.debit']['checked'])) { if (!empty($arrayfields['t.credit']['checked'])) { print ''; } -// Lettering code -if (!empty($arrayfields['t.lettering_code']['checked'])) { - print ''; - print ''; - print '
'.$langs->trans("NotReconciled").''; - print ''; +// Balance +if (!empty($arrayfields['t.balance']['checked'])) { + print ''; } // Date export if (!empty($arrayfields['t.date_export']['checked'])) { @@ -920,14 +924,17 @@ if (!empty($arrayfields['t.doc_ref']['checked'])) { if (!empty($arrayfields['t.label_operation']['checked'])) { print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); } +if (!empty($arrayfields['t.lettering_code']['checked'])) { + print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +} if (!empty($arrayfields['t.debit']['checked'])) { print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['t.credit']['checked'])) { print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); } -if (!empty($arrayfields['t.lettering_code']['checked'])) { - print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.balance']['checked'])) { + print_liste_field_titre($arrayfields['t.balance']['label'], "", "", "", $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['t.date_export']['checked'])) { print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); @@ -977,18 +984,23 @@ while ($i < min($num, $limit)) { //if (empty($accountg)) $accountg = '-'; $colspan = 0; // colspan before field 'label of operation' - $colspanend = 3; // colspan after debit/credit + $colspanend = 0; // colspan after debit/credit + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + $colspan++; + } if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } + if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspan++; } + + if (!empty($arrayfields['t.balance']['checked'])) { $colspanend++; } if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - $colspan++; - $colspanend--; + if (!empty($arrayfields['t.import_key']['checked'])) { $colspanend++; } + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + $colspanend++; } // Is it a break ? @@ -1003,7 +1015,7 @@ while ($i < min($num, $limit)) { } print ''.price(price2num($sous_total_debit, 'MT')).''; print ''.price(price2num($sous_total_credit, 'MT')).''; - print ''; + if ($colspanend > 0) print ''; print ''; // Show balance of last shown account $balance = $sous_total_debit - $sous_total_credit; @@ -1020,7 +1032,7 @@ while ($i < min($num, $limit)) { print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print ''; } - print ''; + if ($colspanend > 0) print ''; print ''; } @@ -1189,6 +1201,14 @@ while ($i < min($num, $limit)) { } } + // Lettering code + if (!empty($arrayfields['t.lettering_code']['checked'])) { + print ''.$line->lettering_code.''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Amount debit if (!empty($arrayfields['t.debit']['checked'])) { print ''.($line->debit != 0 ? price($line->debit) : '').''; @@ -1213,12 +1233,16 @@ while ($i < min($num, $limit)) { $totalarray['val']['totalcredit'] += $line->credit; } - // Lettering code - if (!empty($arrayfields['t.lettering_code']['checked'])) { - print ''.$line->lettering_code.''; + // Amount balance + if (!empty($arrayfields['t.balance']['checked'])) { + print ''.price(price2num($sous_total_debit + $line->debit - $sous_total_credit - $line->credit, 'MT')).''; if (!$i) { $totalarray['nbfield']++; } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalbalance'; + }; + $totalarray['val']['totalbalance'] += $line->debit - $line->credit; } // Exported operation date @@ -1279,7 +1303,7 @@ if ($num > 0 && $colspan > 0) { print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; print ''.price(price2num($sous_total_debit, 'MT')).''; print ''.price(price2num($sous_total_credit, 'MT')).''; - print ''; + if ($colspanend > 0) print ''; print ''; // Show balance of last shown account $balance = $sous_total_debit - $sous_total_credit; @@ -1296,7 +1320,7 @@ if ($num > 0 && $colspan > 0) { print price(price2num($sous_total_credit - $sous_total_debit, 'MT')); print ''; } - print ''; + if ($colspanend > 0) print ''; print ''; } @@ -1308,7 +1332,9 @@ if (!empty($totalarray['val']['totaldebit'])) { if (!empty($totalarray['val']['totalcredit'])) { $totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT'); } - +if (!empty($totalarray['val']['totalbalance'])) { + $totalarray['val']['totalbalance'] = price2num($totalarray['val']['totaldebit'] - $totalarray['val']['totalcredit'], 'MT'); +} // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index beaf69dcfa4..8b6c4704a3b 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5247,12 +5247,12 @@ class Product extends CommonObject } /** - * Return clicable link of object (with eventually picto) + * Return clickable link of object (with eventually picto) * * @param int $withpicto Add picto into link * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '') * @param int $maxlength Maxlength of ref - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values when clicking * @param int $notooltip No tooltip * @param string $morecss ''=Add more css on link * @param int $add_label 0=Default, 1=Add label into string, >1=Add first chars into string From 2adb0b5213a76d479e24d6bb3499eafb184d895d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Nov 2023 15:02:40 +0100 Subject: [PATCH 131/323] NEW shipment can include service (for information and invoicing) (#26407) * NEW shipment can include service (for information and invoicing) add an optionnal option for include service on shipment because some business need invoicing only from shipment so actually dont get services on invoice autmatically. this is a first PR for validation of this secret option before upload other PR * Update shipment.php * Update card.php --- htdocs/expedition/card.php | 53 +++++++++++++++----- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/shipment.php | 4 +- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index ce552fdd71d..3690c6e75d4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -752,7 +752,20 @@ if (empty($reshook)) { } else { if ($lines[$i]->fk_product > 0) { // line without lot - if ($lines[$i]->entrepot_id > 0) { + if ($lines[$i]->entrepot_id == 0) { + // single warehouse shipment line + $stockLocation = 0; + $qty = "qtyl".$line_id; + $line->id = $line_id; + $line->entrepot_id = GETPOST($stockLocation, 'int'); + $line->qty = GETPOST($qty, 'int'); + if ($line->update($user) < 0) { + setEventMessages($line->error, $line->errors, 'errors'); + $error++; + } + unset($_POST[$stockLocation]); + unset($_POST[$qty]); + } elseif ($lines[$i]->entrepot_id > 0) { // single warehouse shipment line $stockLocation = "entl".$line_id; $qty = "qtyl".$line_id; @@ -1268,7 +1281,7 @@ if ($action == 'create') { // Qty to ship $quantityAsked = $line->qty; - if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES) && empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { $quantityToBeDelivered = 0; } else { if (is_numeric($quantityDelivered)) { @@ -1283,14 +1296,18 @@ if ($action == 'create') { print ''; //ship from preselected location $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number - $deliverableQty = min($quantityToBeDelivered, $stock); + if (!empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { + $deliverableQty = $quantityToBeDelivered; + } else { + $deliverableQty = min($quantityToBeDelivered, $stock); + } if ($deliverableQty < 0) { $deliverableQty = 0; } if (empty($conf->productbatch->enabled) || !$product->hasbatch()) { // Quantity to send print ''; - if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { if (GETPOST('qtyl'.$indiceAsked, 'int')) { $deliverableQty = GETPOST('qtyl'.$indiceAsked, 'int'); } @@ -1331,7 +1348,7 @@ if ($action == 'create') { } } } else { - print $langs->trans("Service"); + print '('.$langs->trans("Service").')'; } print ''; } @@ -1466,7 +1483,7 @@ if ($action == 'create') { // Quantity to send print ''; print ''; - if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) { $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]); } else { @@ -1513,7 +1530,7 @@ if ($action == 'create') { print ''; print '('.$stock.')'; } else { - print $langs->trans("Service"); + print '('.$langs->trans("Service").')'; } print ''; } @@ -1655,7 +1672,7 @@ if ($action == 'create') { print ''; print ''; - if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { $disabled = ''; if (isModEnabled('productbatch') && $product->hasbatch()) { $disabled = 'disabled="disabled"'; @@ -1683,7 +1700,7 @@ if ($action == 'create') { } } } else { - print $langs->trans("Service"); + print '('.$langs->trans("Service").')'; } print ''; if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) print '';//StockEntrydate @@ -2407,12 +2424,20 @@ if ($action == 'create') { print ' - '.$langs->trans("NA").''; print ''; } - } else { + } elseif ($lines[$i]->product_type == Product::TYPE_SERVICE && !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { print ''; + print ''; + // Qty to ship or shipped + print ''; + print '('.$langs->trans("Service").')'; + print ''; + print ''; + } else { + print ''; print ''.$langs->trans("NotEnoughStock").''; } } else { - print ''; + print ''; print ''; // Qty to ship or shipped print ''.$unit_order.''; @@ -2423,7 +2448,7 @@ if ($action == 'create') { print ''; } } elseif (!isModEnabled('stock') && empty($conf->productbatch->enabled)) { // both product batch and stock are not activated. - print ''; + print ''; print ''; // Qty to ship or shipped print ''; @@ -2442,7 +2467,9 @@ if ($action == 'create') { // Warehouse source if (isModEnabled('stock')) { print ''; - if ($lines[$i]->entrepot_id > 0) { + if ($lines[$i]->product_type == Product::TYPE_SERVICE && !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { + print '('.$langs->trans("Service").')'; + } elseif ($lines[$i]->entrepot_id > 0) { $entrepot = new Entrepot($db); $entrepot->fetch($lines[$i]->entrepot_id); print $entrepot->getNomUrl(1); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 604cdac0fe2..285b0cef578 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -403,7 +403,7 @@ class Expedition extends CommonObject // Insert of lines $num = count($this->lines); for ($i = 0; $i < $num; $i++) { - if (empty($this->lines[$i]->product_type) || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if (empty($this->lines[$i]->product_type) || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { if (!isset($this->lines[$i]->detail_batch)) { // no batch management if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0) { $error++; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index b943260edc2..0cf5b9b68cc 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -764,7 +764,7 @@ if ($id > 0 || !empty($ref)) { // Qty remains to ship print ''; - if ($type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)|| !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES)) { $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; $toBeShippedTotal += $toBeShipped[$objp->fk_product]; print $toBeShipped[$objp->fk_product]; @@ -790,6 +790,8 @@ if ($id > 0 || !empty($ref)) { } } print ''; + } elseif ($objp->fk_product > 0 && $type == Product::TYPE_SERVICE && !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES) && isModEnabled('stock')) { + print '('.$langs->trans("Service").')'; } else { print ' '; } From 0562f893474fe6a97a17c956ce65b47b8b9466e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 15:35:29 +0100 Subject: [PATCH 132/323] Can find a stock id from a couple batch-warehouse --- htdocs/product/class/productbatch.class.php | 42 ++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 6705c457a2d..3f3b5463f76 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -57,7 +57,16 @@ class Productbatch extends CommonObject // Properties of the lot public $lotid; // ID in table of the details of properties of each lots + + /** + * @var int|string + * @deprecated + */ public $sellby = ''; // dlc + /** + * @var int|string + * @deprecated + */ public $eatby = ''; // dmd/dluo @@ -81,7 +90,6 @@ class Productbatch extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -137,7 +145,6 @@ class Productbatch extends CommonObject */ public function fetch($id) { - global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.tms,"; @@ -191,7 +198,6 @@ class Productbatch extends CommonObject */ public function update($user = null, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -242,7 +248,6 @@ class Productbatch extends CommonObject */ public function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $this->db->begin(); @@ -370,12 +375,11 @@ class Productbatch extends CommonObject * @param integer $eatby eat-by date for object - deprecated: a search must be done on batch number * @param integer $sellby sell-by date for object - deprecated: a search must be done on batch number * @param string $batch_number batch number for object + * @param int $fk_warehouse filter on warehouse (use it if you don't have $fk_product_stock) * @return int <0 if KO, >0 if OK */ - public function find($fk_product_stock = 0, $eatby = '', $sellby = '', $batch_number = '') + public function find($fk_product_stock = 0, $eatby = '', $sellby = '', $batch_number = '', $fk_warehouse = 0) { - global $langs; - $where = array(); $sql = "SELECT"; $sql .= " t.rowid,"; @@ -387,8 +391,12 @@ class Productbatch extends CommonObject $sql .= " t.qty,"; $sql .= " t.import_key"; $sql .= " FROM ".$this->db->prefix().self::$_table_element." as t"; - $sql .= " WHERE fk_product_stock=".((int) $fk_product_stock); - + if ($fk_product_stock > 0 || empty($fk_warehouse)) { + $sql .= " WHERE t.fk_product_stock = ".((int) $fk_product_stock); + } else { + $sql .= ", ".$this->db->prefix()."product_stock as ps"; + $sql .= " WHERE t.fk_product_stock = ps.rowid AND ps.fk_warehouse = ".((int) $fk_warehouse); + } if (!empty($eatby)) { array_push($where, " eatby = '".$this->db->idate($eatby)."'"); // deprecated } @@ -414,8 +422,8 @@ class Productbatch extends CommonObject $this->tms = $this->db->jdate($obj->tms); $this->fk_product_stock = $obj->fk_product_stock; - $this->sellby = $this->db->jdate($obj->sellby); - $this->eatby = $this->db->jdate($obj->eatby); + $this->sellby = $this->db->jdate($obj->sellby); // deprecated. do no tuse this data. + $this->eatby = $this->db->jdate($obj->eatby); // deprecated. do not use this data. $this->batch = $obj->batch; $this->qty = $obj->qty; $this->import_key = $obj->import_key; @@ -431,11 +439,11 @@ class Productbatch extends CommonObject /** * Return all batch detail records for a given product and warehouse * - * @param DoliDB $dbs database object - * @param int $fk_product_stock id product_stock for objet - * @param int $with_qty 1 = doesn't return line with 0 quantity - * @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot - * @return array|int <0 if KO, array of batch + * @param DoliDB $dbs database object + * @param int $fk_product_stock id product_stock for objet + * @param int $with_qty 1 = doesn't return line with 0 quantity + * @param int $fk_product If set to a product id, get eatby and sellby from table llx_product_lot + * @return array|int <0 if KO, array of batch */ public static function findAll($dbs, $fk_product_stock, $with_qty = 0, $fk_product = 0) { @@ -525,7 +533,7 @@ class Productbatch extends CommonObject } /** - * Return all batch for a product and a warehouse + * Return all batch known for a product and a warehouse (batch that was one day used) * * @param int $fk_product Id of product * @param int $fk_warehouse Id of warehouse From 0708f0c53f20a329f532fd857f91efa77974c589 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 15:38:45 +0100 Subject: [PATCH 133/323] Add fields to allow batch management into POS module --- htdocs/compta/facture/class/facture.class.php | 33 +++++++++++++++---- .../install/mysql/migration/18.0.0-19.0.0.sql | 3 ++ .../install/mysql/tables/llx_facturedet.sql | 3 ++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8210490895e..de9617141e2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2274,14 +2274,12 @@ class Facture extends CommonInvoice public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { // phpcs:enable - global $langs, $conf; - $this->lines = array(); $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice, l.ref_ext,'; $sql .= ' l.situation_percent, l.fk_prev_id,'; - $sql .= ' l.rang, l.special_code,'; + $sql .= ' l.rang, l.special_code, l.batch, l.fk_warehouse,'; $sql .= ' l.date_start as date_start, l.date_end as date_end,'; $sql .= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql .= ' l.fk_unit,'; @@ -2351,6 +2349,9 @@ class Facture extends CommonInvoice $line->fk_prev_id = $objp->fk_prev_id; $line->fk_unit = $objp->fk_unit; + $line->batch = $objp->batch; + $line->fk_warehouse = $objp->fk_warehouse; + // Accountancy $line->fk_accounting_account = $objp->fk_code_ventilation; @@ -6014,16 +6015,34 @@ class FactureLigne extends CommonInvoiceLine public $remise_percent; - public $special_code; // Liste d'options non cumulabels: - // 1: frais de port - // 2: ecotaxe - // 3: ?? + /** + * List of special options to define line: + * 1: shipment cost lines + * 2: ecotaxe + * 3: ?? + * idofmodule: a meaning for the module + */ + public $special_code; + + /** + * @var string To store the batch to consume in stock when using a POS module + */ + public $batch; + /** + * @var string To store the warehouse where to consume stock when using a POS module + */ + public $fk_warehouse; + public $origin; public $origin_id; + /** + * @var integer Id in table llx_accounting_bookeeping to know accounting account for product line + */ public $fk_code_ventilation = 0; + public $date_start; public $date_end; diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 4b11a28f075..92eff01cf9b 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -167,3 +167,6 @@ ALTER TABLE llx_societe_rib ADD COLUMN bic_intermediate varchar(11) AFTER bic; UPDATE llx_menu SET url = '/fourn/paiement/list.php?mainmenu=billing&leftmenu=suppliers_bills_payment' WHERE leftmenu = 'suppliers_bills_payment'; ALTER TABLE llx_facture_rec ADD INDEX idx_facture_rec_datec(datec); + +ALTER TABLE llx_facturedet ADD COLUMN batch varchar(128) NULL; -- To store the batch to consume in stock when using a POS module +ALTER TABLE llx_facturedet ADD COLUMN fk_warehouse integer NULL; -- To store the warehouse where to consume stock when using a POS module diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index 9fabf237c62..ff717cf0e5e 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -55,6 +55,9 @@ create table llx_facturedet buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) + batch varchar(128) NULL, -- To store the batch to consume in stock when using a POS module + fk_warehouse integer NULL, -- To store the warehouse where to consume stock when using a POS module + special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...) rang integer DEFAULT 0, -- position of line fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines From b3a08fc0c70d68692d3888d966945039045c32dc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Nov 2023 15:56:51 +0100 Subject: [PATCH 134/323] Fix v19 look on shipment.php (#26427) --- htdocs/expedition/shipment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0cf5b9b68cc..43d7a6cc887 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -791,7 +791,7 @@ if ($id > 0 || !empty($ref)) { } print ''; } elseif ($objp->fk_product > 0 && $type == Product::TYPE_SERVICE && !empty($conf->global->SHIPMENT_SUPPORTS_SERVICES) && isModEnabled('stock')) { - print '('.$langs->trans("Service").')'; + print '('.$langs->trans("Service").')'; } else { print ' '; } From f36e8b935cbff79380b59361c8f3533b17f74839 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Wed, 1 Nov 2023 15:58:45 +0100 Subject: [PATCH 135/323] Fix list agenda (#26394) * int $nbtotalrecord list agenda * nbtotal of record should be number not a string * ternaire isnumeric $nbtotalofrecords --- htdocs/comm/action/list.php | 2 +- htdocs/compta/bank/treso.php | 2 +- htdocs/hrm/skill_card.php | 2 +- htdocs/product/stock/stockatdate.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index e67d2bdc89c..7ee65430446 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -710,7 +710,7 @@ $newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-c $param .= '&mode='.$mode; -print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1 * $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); +print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, is_numeric($nbtotalofrecords) ? -1 * $nbtotalofrecords: $nbtotalofrecords, 'object_action', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1, $viewmode); print $s; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 61f8fcf2936..a861acb303f 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -172,7 +172,7 @@ if (GETPOST("account") || GETPOST("ref")) { $error = 0; $tab_sqlobjOrder = array(); $tab_sqlobj = array(); - $nbtotalofrecords = 0; + $nbtotalofrecords = ''; foreach ($sqls as $sql) { $resql = $db->query($sql); diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 616730fa607..c081ef3a664 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -578,7 +578,7 @@ if ($action != "create" && $action != "edit") { $title = $langs->transnoentitiesnoconv("Skilldets"); $morejs = array(); $morecss = array(); - $nbtotalofrecords = 0; + $nbtotalofrecords = ''; // Build and execute select // -------------------------------------------------------------------- diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index bafb0f294d9..bfc3b92b2a9 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -325,7 +325,7 @@ if ($sortfield == 'stock' && !empty($search_fk_warehouse)) { } $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; +$nbtotalofrecords = ''; if ($date && $dateIsValid) { // We avoid a heavy sql if mandatory parameter date not yet defined if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $result = $db->query($sql); From 127de7e7d8aa146390321b6435f0e9fc660a1c8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Oct 2023 19:28:11 +0100 Subject: [PATCH 136/323] FIX On object validation, ecm index are not updated for uploaded files --- htdocs/bom/class/bom.class.php | 6 ++++++ htdocs/bookcal/class/availabilities.class.php | 6 ++++++ htdocs/comm/propal/class/propal.class.php | 6 ++++++ htdocs/commande/card.php | 2 ++ htdocs/commande/class/commande.class.php | 6 ++++++ htdocs/compta/facture/class/facture.class.php | 6 ++++++ htdocs/contrat/class/contrat.class.php | 6 ++++++ htdocs/core/class/timespent.class.php | 6 ++++++ htdocs/delivery/class/delivery.class.php | 6 ++++++ .../class/conferenceorboothattendee.class.php | 6 ++++++ htdocs/expedition/class/expedition.class.php | 6 ++++++ htdocs/expensereport/class/expensereport.class.php | 6 ++++++ htdocs/fichinter/class/fichinter.class.php | 6 ++++++ htdocs/fourn/class/fournisseur.commande.class.php | 6 ++++++ htdocs/fourn/class/fournisseur.facture.class.php | 6 ++++++ htdocs/fourn/facture/card.php | 6 ++++++ htdocs/holiday/class/holiday.class.php | 6 ++++++ htdocs/hrm/class/evaluation.class.php | 6 ++++++ htdocs/hrm/class/evaluationdet.class.php | 6 ++++++ htdocs/hrm/class/job.class.php | 6 ++++++ htdocs/hrm/class/position.class.php | 6 ++++++ htdocs/hrm/class/skill.class.php | 6 ++++++ htdocs/hrm/class/skilldet.class.php | 6 ++++++ htdocs/hrm/class/skillrank.class.php | 6 ++++++ .../class/knowledgerecord.class.php | 6 ++++++ .../modulebuilder/template/class/myobject.class.php | 6 ++++++ htdocs/mrp/class/mo.class.php | 6 ++++++ htdocs/partnership/class/partnership.class.php | 12 ++++++++++++ .../product/class/productfournisseurprice.class.php | 10 +++++++++- .../stocktransfer/class/stocktransfer.class.php | 10 +++++++++- .../stocktransfer/class/stocktransferline.class.php | 10 +++++++++- htdocs/reception/class/reception.class.php | 6 ++++++ .../class/recruitmentcandidature.class.php | 6 ++++++ .../class/recruitmentjobposition.class.php | 6 ++++++ .../class/supplier_proposal.class.php | 6 ++++++ htdocs/webhook/class/target.class.php | 6 ++++++ 36 files changed, 227 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 866c8be0857..1e761324c7f 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -975,6 +975,12 @@ class BOM extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'bom/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index c7e86a9f589..b746e2084a3 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -579,6 +579,12 @@ class Availabilities extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'availabilities/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'availabilities/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0b737679879..ec2fa41b991 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2047,6 +2047,12 @@ class Propal extends CommonObject $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'propale/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0894bec0e71..69b7bd5e1f5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1318,7 +1318,9 @@ if (empty($reshook)) { if (!$error) { $locationTarget = ''; + $db->begin(); + $result = $object->valid($user, $idwarehouse); if ($result >= 0) { $error = 0; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 34c409c3d32..6b6037d62d5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -580,6 +580,12 @@ class Commande extends CommonOrder if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'commande/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 995fc16c6fd..5a9b711aff7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3535,6 +3535,12 @@ class Facture extends CommonInvoice $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'facture/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'facture/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ff86a6aa5af..65e5249bf82 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -541,6 +541,12 @@ class Contrat extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'contract/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index 2c98c9747ec..256077fa40f 100755 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -587,6 +587,12 @@ class TimeSpent extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'timespent/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'timespent/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 7d528f0d051..f44c531160b 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -478,6 +478,12 @@ class Delivery extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'expedition/receipt/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'expedition/receipt/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index edb23332732..c0a7a713075 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -608,6 +608,12 @@ class ConferenceOrBoothAttendee extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'conferenceorboothattendee/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'conferenceorboothattendee/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index df4b92fe76f..284d458d78a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -790,6 +790,12 @@ class Expedition extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'expedition/sending/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'expedition/sending/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index e07ca8bb6cc..5a07b11c322 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1327,6 +1327,12 @@ class ExpenseReport extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'expensereport/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'expensereport/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 35a9d37443c..36353fa39e7 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -625,6 +625,12 @@ class Fichinter extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'ficheinter/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'ficheinter/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f59a6076ea..0fc35863494 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -723,6 +723,12 @@ class CommandeFournisseur extends CommonOrder if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'fournisseur/commande/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'fournisseur/commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c55832a6f83..c2baae01a14 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1868,6 +1868,12 @@ class FactureFournisseur extends CommonInvoice if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'fournisseur/facture/".get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4bf4be6e76a..4da8efe076d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -226,10 +226,16 @@ if (empty($reshook)) { } if (!$error) { + $db->begin(); + $result = $object->validate($user, '', $idwarehouse); if ($result < 0) { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); } else { + $db->commit(); + // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index c01feb32d6c..cb0308124d3 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -787,6 +787,12 @@ class Holiday extends CommonObject $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'holiday/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'holiday/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 1ae170a3c82..45d2f92a471 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -583,6 +583,12 @@ class Evaluation extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'evaluation/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'evaluation/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 6b779d17336..c3141284d84 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -563,6 +563,12 @@ class Evaluationline extends CommonObject $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'evaluationline/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'evaluationline/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index c7e31f84d7b..a2c8621a736 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -560,6 +560,12 @@ class Job extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'job/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'job/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 9e2347088e5..934da045bfc 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -571,6 +571,12 @@ class Position extends CommonObject $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'position/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'position/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index a0e48fb4f9c..99a5183a3f0 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -628,6 +628,12 @@ class Skill extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'skill/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'skill/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index 70f6d619376..f118f0baeb7 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -551,6 +551,12 @@ class Skilldet extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'skilldet/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'skilldet/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 8c5f24b6fa8..23f67452a20 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -590,6 +590,12 @@ class SkillRank extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'skillrank/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'skillrank/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 28e32c3ad35..05f06d6e96c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -601,6 +601,12 @@ class KnowledgeRecord extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'knowledgerecord/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'knowledgerecord/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index c9897b077c0..b4f41e00b2f 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -635,6 +635,12 @@ class MyObject extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'myobject/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'myobject/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ef043198f70..166d0a247df 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1044,6 +1044,12 @@ class Mo extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'mrp/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'mrp/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 097fb27fc85..91d2b5d0a57 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -682,6 +682,12 @@ class Partnership extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); @@ -806,6 +812,12 @@ class Partnership extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'partnership/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'partnership/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 4cbd998a0f6..f2e5e97c104 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -466,7 +466,15 @@ class ProductFournisseurPrice extends CommonObject $sql = 'UPDATE '.$this->db->prefix()."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'productfournisseurprice/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'productfournisseurprice/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'productfournisseurprice/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index f07610c6898..a2f6707ad40 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -581,7 +581,15 @@ class StockTransfer extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'stocktransfer/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'stocktransfer/".$this->db->escape($this->ref)."' and entity = ".((int) $conf->entity); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'stocktransfer/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'stocktransfer/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index 0d4ef0c1939..3b1dbdfa43b 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -579,7 +579,15 @@ class StockTransferLine extends CommonObjectLine $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'stocktransferline/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'stocktransferline/".$this->db->escape($this->ref)."' and entity = ".((int) $conf->entity); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'stocktransferline/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'stocktransferline/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 56b236ad260..d27ae63052d 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -656,6 +656,12 @@ class Reception extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'reception/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'reception/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 0a3311e0e95..24c78899be4 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -561,6 +561,12 @@ class RecruitmentCandidature extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'recruitmentcandidature/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'recruitmentcandidature/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index a786c0196bb..f12c76ff65f 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -574,6 +574,12 @@ class RecruitmentJobPosition extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'recruitmentjobposition/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'recruitmentjobposition/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index dff5ae02d89..2d1482b1bf7 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1468,6 +1468,12 @@ class SupplierProposal extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'supplier_proposal/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'supplier_proposal/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 099db89a85b..dbf075e8d6a 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -570,6 +570,12 @@ class Target extends CommonObject if (!$resql) { $error++; $this->error = $this->db->lasterror(); } + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'target/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filepath = 'target/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; $this->error = $this->db->lasterror(); + } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); From a1f4c0c63553219616926818faf492ffb85af9f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 16:34:20 +0100 Subject: [PATCH 137/323] NEW Enhance github_commits_perversion to get more stats on git commits --- dev/tools/github_commits_perversion.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dev/tools/github_commits_perversion.sh b/dev/tools/github_commits_perversion.sh index e8232397e60..9653db121ca 100755 --- a/dev/tools/github_commits_perversion.sh +++ b/dev/tools/github_commits_perversion.sh @@ -4,15 +4,20 @@ # Releases=("17.0" "18.0" "develop") -Dates=("2023-02-01" "2023-08-31" "2050-01-01") -let "counter = 1" +Dates=("2022-08-15", "2023-02-01" "2023-08-31" "2050-01-01") +let "counter = 0" for i in "${Releases[@]}" do - echo "=== $counter git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}" - git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]} - echo -n "Total $i: " - git log --pretty=oneline --after=${Dates[counter-1]} --before=${Dates[counter]} | wc -l + echo "=== Version $i (counter $counter): git shortlog -s -n --after=${Dates[counter]} --before=${Dates[counter+1]}" + git shortlog -s -n --after=${Dates[counter]} --before=${Dates[counter+1]} | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt + cat /tmp/github_commits_perversion.txt + echo "Total for version $i:" + echo -n "- Nb of commits: " + git log --pretty=oneline --after=${Dates[counter]} --before=${Dates[counter+1]} | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion2.txt + cat /tmp/github_commits_perversion2.txt | wc -l + echo -n "- Nb of different authors: " + awk ' { print $2 } ' < /tmp/github_commits_perversion.txt | sort -u | wc -l echo "=======================" echo let "counter +=1" From d0d937f2e757b72762a16b13dca4d1d91c73205e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 16:49:18 +0100 Subject: [PATCH 138/323] Tool to calculate nb of commits and developers for each version branch --- dev/tools/github_commits_perversion.sh | 35 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/dev/tools/github_commits_perversion.sh b/dev/tools/github_commits_perversion.sh index 9653db121ca..2b2e86f7fe6 100755 --- a/dev/tools/github_commits_perversion.sh +++ b/dev/tools/github_commits_perversion.sh @@ -3,18 +3,41 @@ # Count number of commits per user and per versions (using date for version detection) # -Releases=("17.0" "18.0" "develop") -Dates=("2022-08-15", "2023-02-01" "2023-08-31" "2050-01-01") +Releases=("3.9" "4.0" "5.0" "6.0" "7.0" "8.0" "9.0" "10.0" "11.0" "12.0" "13.0" "14.0" "15.0" "16.0" "17.0" "18.0" "develop") let "counter = 0" +echo "Copy script into /tmp/github_commits_perversion.sh" +cp $0 /tmp/github_commits_perversion.sh + +mkdir /tmp/git +cd /tmp/git +git clone https://github.com/Dolibarr/dolibarr.git + +cd /tmp/git/dolibarr + +firstline=1 for i in "${Releases[@]}" do - echo "=== Version $i (counter $counter): git shortlog -s -n --after=${Dates[counter]} --before=${Dates[counter+1]}" - git shortlog -s -n --after=${Dates[counter]} --before=${Dates[counter+1]} | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt - cat /tmp/github_commits_perversion.txt + if [ $firstline -eq 1 ]; then + firstline=0 + continue + fi + + #echo "=== Version $i (counter $counter):" + echo "=== Version $i (counter $counter):" + echo "Get common commit ID between origin/${Releases[counter]} and origin/${Releases[counter+1]}" + echo "git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}" + commitidcommon=`git merge-base origin/${Releases[counter]} origin/${Releases[counter+1]}` + echo "Found commitid=$commitidcommon" + + echo "Checkout into version $i" + git checkout $i + #git shortlog -s -n --after=YYYY-MM-DD --before=YYYY-MM-DD | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt + git shortlog -s -n $commitidcommon.. | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion.txt + #cat /tmp/github_commits_perversion.txt echo "Total for version $i:" echo -n "- Nb of commits: " - git log --pretty=oneline --after=${Dates[counter]} --before=${Dates[counter+1]} | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion2.txt + git log $commitidcommon.. --pretty=oneline | tr '[:lower:]' '[:upper:]' > /tmp/github_commits_perversion2.txt cat /tmp/github_commits_perversion2.txt | wc -l echo -n "- Nb of different authors: " awk ' { print $2 } ' < /tmp/github_commits_perversion.txt | sort -u | wc -l From 5336a4788fd5c36f4c1bb31cf74656fedd232d1a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 23:46:56 +0100 Subject: [PATCH 139/323] Complete trans --- htdocs/langs/en_US/languages.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 9c55f3ae4d0..8f08e5777e7 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -1,12 +1,13 @@ # Dolibarr language file - Source file is en_US - languages Language_am_ET=Ethiopian Language_af_ZA=Afrikaans (South Africa) +Language_en_AE=Arabic (United Arab Emirates) Language_ar_AR=Arabic Language_ar_DZ=Arabic (Algeria) Language_ar_EG=Arabic (Egypt) Language_ar_JO=Arabic (Jordania) Language_ar_MA=Arabic (Moroco) -Language_ar_SA=Arabic +Language_ar_SA=Arabic (Saudi Arabia) Language_ar_TN=Arabic (Tunisia) Language_ar_IQ=Arabic (Iraq) Language_as_IN=Assamese From 8fde7bafdbf92dda48be616543e7a8aecf785375 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 23:48:09 +0100 Subject: [PATCH 140/323] Prepare 18.0.3 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 522cc03f7df..233bd837387 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '18.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '18.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 4a83014c66ccf9db7d33c6b6c54711b7d45f6d44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Nov 2023 23:51:03 +0100 Subject: [PATCH 141/323] Prepare 18.0.3 --- ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0b03cadeb77..df085fbc31d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,46 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 18.0.3 compared to 18.0.2 ***** +FIX: #25793 Cannot add time spent (#26405) +FIX: #26100 Ticket - On edit, list of closed project must be excluded (#26223) +FIX: #26170 +FIX: #26195 Various payment - List of project excluded those assigned to third parties (#26222) +FIX: #26349 add_customer_ref_on_linked_shipment +FIX: avoid warning + CSRF +FIX: avoid warning if module not activated +FIX: Bad name for trigger in HRM module +FIX: check tva_tx before comparing price_min_ttc (#25220) +FIX: Compare the result of the send mail file function +FIX: dol_eval with function starting with ! +FIX: Error handling for computed values on import (#24897) +FIX: Error not returned on sales with takepos and batch module enabled +FIX: error of webhook not returned +FIX: firstname and lastname were not saved in attendee subscription +FIX: HTML in ODT templates (#26181) +FIX: Link to list of movement from the inventory code +FIX: Mass import of stock from a file must accept empty source +FIX: Max version of PHP (#26327) +FIX: missing load group members for ldap synchro (#26167) +FIX: missing project entity filter (Issue #26243) (#26247) +FIX: modification of complementary attributes in invoices (#26180) +FIX: On object validation, ecm index are not updated for uploaded files +FIX: Propal's negative quantities +FIX: public subscription page should not display acceptation for public register when it is not enabled (#26354) +FIX: regression on rounding stocks fields on product list +FIX: removed a non expected hidden input field in stockatdate page +FIX: src_object_id and ttype not filed when uploading a file with API. +FIX: suggested end for membership can be before subscription start (#26351) +FIX: Supplier card - VAT Reserve Charge - Undefined function isInEEC() (#26379) +FIX: syntax error +FIX: template invoice list extrafield filters (backport v17) (#26227) +FIX: Tooltip for search syntax must not appear on date fields +FIX: upload of files src_object_type +FIX: use event.key instead event.wich to avoid keyboard difference +FIX: Use of line->insert instead of line->create +FIX: user creation when LDAP is configured (#26332) +FIX: Wrong backtopage given for the stocktransfer button from the stocktransfer list (#26271) + ***** ChangeLog for 18.0.2 compared to 18.0.1 ***** FIX: 17.0 PHP8: supplier invoice class FIX: #24908 #25824 From 63ccf17402c6b09c63f993f0297ced75ec78a907 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 2 Nov 2023 01:33:46 +0100 Subject: [PATCH 142/323] FIX #24367 - membership duration is the default duration adhtype (#26428) * FIX #24367 - membership duration is the default duration adhtype * avoid error for old database * avoid error for old database * Update paymentok.php --------- Co-authored-by: Laurent Destailleur --- htdocs/adherents/subscription.php | 8 +++++--- htdocs/public/payment/paymentok.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index c4e4ec79204..b3e2770ecc5 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -81,9 +81,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); $errmsg = ''; -$defaultdelay = 1; -$defaultdelayunit = 'y'; - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscription')); @@ -213,6 +210,8 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti // Subscription informations $datesubscription = 0; $datesubend = 0; + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; $paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01 if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) { $datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int")); @@ -476,6 +475,9 @@ if (! ($object->id > 0)) { $adht->fetch($object->typeid); +$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; +$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + $head = member_prepare_head($object); $rowspan = 10; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8a7223baf0b..6135c1e6801 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -418,9 +418,6 @@ if ($ispaymentok) { // Create complementary actions (this include creation of thirdparty) // Send confirmation email - $defaultdelay = 1; - $defaultdelayunit = 'y'; - // Record subscription include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; @@ -431,6 +428,9 @@ if ($ispaymentok) { $result1 = $object->fetch((int) $tmptag['MEM']); $result2 = $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); if ($result1 > 0 && $result2 > 0) { From e2e9a330fa92044b2e65223856012e99fa9453ed Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 2 Nov 2023 01:33:46 +0100 Subject: [PATCH 143/323] FIX #24367 - membership duration is the default duration adhtype (#26428) * FIX #24367 - membership duration is the default duration adhtype * avoid error for old database * avoid error for old database * Update paymentok.php --------- Co-authored-by: Laurent Destailleur --- htdocs/adherents/subscription.php | 8 +++++--- htdocs/public/payment/paymentok.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b9cd776c176..b2bb3f723cf 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -81,9 +81,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); $errmsg = ''; -$defaultdelay = 1; -$defaultdelayunit = 'y'; - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscription')); @@ -213,6 +210,8 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti // Subscription informations $datesubscription = 0; $datesubend = 0; + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; $paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01 if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) { $datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int")); @@ -476,6 +475,9 @@ if (! ($object->id > 0)) { $adht->fetch($object->typeid); +$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; +$defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + $head = member_prepare_head($object); $rowspan = 10; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index d93386a62ed..e21b2673977 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -414,9 +414,6 @@ if ($ispaymentok) { // Create complementary actions (this include creation of thirdparty) // Send confirmation email - $defaultdelay = 1; - $defaultdelayunit = 'y'; - // Record subscription include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; @@ -427,6 +424,9 @@ if ($ispaymentok) { $result1 = $object->fetch((int) $tmptag['MEM']); $result2 = $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); if ($result1 > 0 && $result2 > 0) { From 2ce3ececfb3de20220a2a9c02d43b210a2c00d54 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 2 Nov 2023 01:33:46 +0100 Subject: [PATCH 144/323] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 --- htdocs/adherents/subscription.php | 8 +++++--- htdocs/public/payment/paymentok.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 93b57a630e1..1a6925951a6 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -80,9 +80,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); $errmsg = ''; -$defaultdelay = 1; -$defaultdelayunit = 'y'; - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscription')); @@ -212,6 +209,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! // Subscription informations $datesubscription = 0; $datesubend = 0; + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; $paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01 if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) { $datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int")); @@ -470,6 +469,9 @@ if ($rowid > 0) { $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + $head = member_prepare_head($object); $rowspan = 10; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index e19fd856f23..7b605be02ed 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -398,9 +398,6 @@ if ($ispaymentok) { // Create complementary actions (this include creation of thirdparty) // Send confirmation email - $defaultdelay = 1; - $defaultdelayunit = 'y'; - // Record subscription include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; @@ -411,6 +408,9 @@ if ($ispaymentok) { $result1 = $object->fetch((int) $tmptag['MEM']); $result2 = $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); if ($result1 > 0 && $result2 > 0) { From 301064afb610e73c836753ff3220c89315849620 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 2 Nov 2023 01:33:46 +0100 Subject: [PATCH 145/323] Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 17.0 --- htdocs/adherents/subscription.php | 8 +++++--- htdocs/public/payment/paymentok.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index cf0ad445c92..54ea3ebe998 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -79,9 +79,6 @@ $extrafields->fetch_name_optionals_label($object->table_element); $errmsg = ''; -$defaultdelay = 1; -$defaultdelayunit = 'y'; - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('subscription')); @@ -211,6 +208,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! // Subscription informations $datesubscription = 0; $datesubend = 0; + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; $paymentdate = ''; // Do not use 0 here, default value is '' that means not filled where 0 means 1970-01-01 if (GETPOST("reyear", "int") && GETPOST("remonth", "int") && GETPOST("reday", "int")) { $datesubscription = dol_mktime(0, 0, 0, GETPOST("remonth", "int"), GETPOST("reday", "int"), GETPOST("reyear", "int")); @@ -469,6 +468,9 @@ if ($rowid > 0) { $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + $head = member_prepare_head($object); $rowspan = 10; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 241fa09dabc..44411db975d 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -386,9 +386,6 @@ if ($ispaymentok) { // Create complementary actions (this include creation of thirdparty) // Send confirmation email - $defaultdelay = 1; - $defaultdelayunit = 'y'; - // Record subscription include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; @@ -399,6 +396,9 @@ if ($ispaymentok) { $result1 = $object->fetch((int) $tmptag['MEM']); $result2 = $adht->fetch($object->typeid); + $defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; + $defaultdelayunit = !empty($adht->duration_unit) ? $adht->duration_unit : 'y'; + dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); if ($result1 > 0 && $result2 > 0) { From b92d685940d382cafe25068e1e63137a6fc32c63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2023 01:59:51 +0100 Subject: [PATCH 146/323] Debug v19 --- htdocs/admin/webhook.php | 7 +-- htdocs/admin/website_options.php | 7 +-- htdocs/bookcal/admin/setup.php | 7 +-- htdocs/modulebuilder/index.php | 58 ++++++++++--------- htdocs/modulebuilder/template/admin/setup.php | 7 +-- 5 files changed, 34 insertions(+), 52 deletions(-) diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 5495a7633a2..8e978a30621 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -55,12 +55,7 @@ $setupnotempty = 0; $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 16.0 - if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { - require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index a1403aea6f1..73a1cddbc68 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -68,12 +68,7 @@ if (!$user->admin || !isModEnabled('website')) { $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 16.0 - if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { - require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index ebf5d118b44..57174c488e3 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -61,12 +61,7 @@ $setupnotempty = 0; $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 16.0 - if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { - require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index fa8f9c8e3bc..32a0602595a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -246,29 +246,31 @@ if ($dirins && $action == 'initmodule' && $modulename) { } } - // Copy last html.formsetup.class.php' to backport folder - $tryToCopyFromSetupClass = true; - $backportDest = $destdir .'/backport/v16/core/class'; - $backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - $backportFileDest = $backportDest.'/html.formsetup.class.php'; - $result = dol_mkdir($backportDest); + // Copy last 'html.formsetup.class.php' to backport folder + if (getDolGlobalInt('MODULEBUILDER_SUPPORT_COMPATIBILITY_V16')) { + $tryToCopyFromSetupClass = true; + $backportDest = $destdir .'/backport/v16/core/class'; + $backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; + $backportFileDest = $backportDest.'/html.formsetup.class.php'; + $result = dol_mkdir($backportDest); - if ($result < 0) { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors'); - $tryToCopyFromSetupClass = false; - } + if ($result < 0) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors'); + $tryToCopyFromSetupClass = false; + } - if ($tryToCopyFromSetupClass) { - $result = dol_copy($backportFileSrc, $backportFileDest); - if ($result <= 0) { - if ($result < 0) { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors'); - } else { - setEventMessages($langs->trans("FileDidAlreadyExist", $backportFileDest), null, 'warnings'); + if ($tryToCopyFromSetupClass) { + $result = dol_copy($backportFileSrc, $backportFileDest); + if ($result <= 0) { + if ($result < 0) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors'); + } else { + setEventMessages($langs->trans("FileDidAlreadyExist", $backportFileDest), null, 'warnings'); + } } } } @@ -289,9 +291,6 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/admin/myobject_extrafields.php'); - dol_delete_file($destdir.'/sql/data.sql'); - dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql'); - dol_delete_file($destdir.'/class/actions_'.strtolower($modulename).'.class.php'); dol_delete_file($destdir.'/class/api_'.strtolower($modulename).'.class.php'); @@ -301,7 +300,8 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/scripts/'.strtolower($modulename).'.php'); - dol_delete_file($destdir.'/test/phpunit/'.$modulename.'FunctionnalTest.php'); + dol_delete_file($destdir.'/sql/data.sql'); + dol_delete_file($destdir.'/sql/update_x.x.x-y.y.y.sql'); // Delete some files related to Object (because the previous dolCopyDir has copied everything) dol_delete_file($destdir.'/myobject_card.php'); @@ -311,6 +311,7 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); + dol_delete_file($destdir.'/test/phpunit/functionnal/'.$modulename.'FunctionnalTest.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); @@ -319,10 +320,11 @@ if ($dirins && $action == 'initmodule' && $modulename) { dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_dir($destdir.'/class', 1); - dol_delete_dir($destdir.'/sql', 1); - dol_delete_dir($destdir.'/scripts', 1); - dol_delete_dir($destdir.'/js', 1); dol_delete_dir($destdir.'/css', 1); + dol_delete_dir($destdir.'/js', 1); + dol_delete_dir($destdir.'/scripts', 1); + dol_delete_dir($destdir.'/sql', 1); + dol_delete_dir($destdir.'/test/phpunit/functionnal', 1); dol_delete_dir($destdir.'/test/phpunit', 1); dol_delete_dir($destdir.'/test', 1); } diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index c7e20a479d4..a985dfe3998 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -86,12 +86,7 @@ $setupnotempty = 0; $useFormSetup = 1; if (!class_exists('FormSetup')) { - // For retrocompatibility Dolibarr < 16.0 - if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) { - require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php'; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; - } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; } $formSetup = new FormSetup($db); From 440baec6e7b6eba482539d9eb606ae5cd829339f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2023 02:04:09 +0100 Subject: [PATCH 147/323] Debug v19 --- htdocs/modulebuilder/template/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/.gitignore b/htdocs/modulebuilder/template/.gitignore index 70479d0eb63..448aa368544 100644 --- a/htdocs/modulebuilder/template/.gitignore +++ b/htdocs/modulebuilder/template/.gitignore @@ -1,6 +1,7 @@ # Generated binaries /build/*.zip /bin/*.zip +/bin # Doxygen generated documentation /build/doxygen/doxygen_warnings.log /doc/code/doxygen From 99f50e5fa1d248fe8450ce2c12b9772093cf8ae6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Nov 2023 14:12:57 +0100 Subject: [PATCH 148/323] Fix comment --- htdocs/compta/facture/class/facture.class.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index de9617141e2..f7cea03081c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -157,13 +157,6 @@ class Facture extends CommonInvoice */ public $ref_customer; - //public $remise_absolue; - - /** - * @deprecated - */ - //public $remise_percent; - public $total_ht; public $total_tva; public $total_localtax1; From 9d03444298ba5b70f5a45dbc80b0fed8919ecdb5 Mon Sep 17 00:00:00 2001 From: atm-jonathan <146709163+atm-jonathan@users.noreply.github.com> Date: Fri, 3 Nov 2023 16:21:58 +0100 Subject: [PATCH 149/323] Fix position with this job (#26455) * FIX list position in job * add trad position --- htdocs/hrm/position.php | 10 +++++----- htdocs/langs/fr_FR/hrm.lang | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 2205753cefb..b2d09e1a56e 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -54,7 +54,7 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$fk_job = GETPOST('fk_job', 'int'); +$fk_job = GETPOST('id', 'int'); $fk_user = GETPOST('fk_user', 'int'); //$start_date = date('Y-m-d', GETPOST('date_startyear', 'int').'-'.GETPOST('date_startmonth', 'int').'-'.GETPOST('date_startday', 'int')); $start_date = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); @@ -177,8 +177,10 @@ if (empty($reshook)) { $error = 0; $backurlforlist = dol_buildpath('/hrm/position_list.php', 1); - //$backtopage = dol_buildpath('/hrm/position.php', 1) . '?fk_job=' . ($fk_job > 0 ? $fk_job : '__ID__'); - + $idBacktoPage = GETPOST('fk_job', 'aZ09'); + if($idBacktoPage > 0){ + $backtopage = dol_buildpath('/hrm/position.php', 1) . '?id=' . $idBacktoPage; + } if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { @@ -253,7 +255,6 @@ if ($action == 'create') { if ($backtopage) { print ''; } - if ($backtopageforcancel) { print ''; } @@ -278,7 +279,6 @@ if ($action == 'create') { //dol_set_focus('input[name="ref"]'); } - if ($job->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { if ($backtopage) { print ''; diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index bbbec3b0ff3..28ed8f50ef9 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -28,6 +28,7 @@ DateEval=Date d'évaluation JobCard=Fiche emploi JobPosition=Profil de poste JobsPosition=Profils de poste +Positions = Postes NewSkill=Nouvelle compétence SkillType=Type de compétence Skilldets=Liste des niveaux pour cette compétence From a3437c720736a40fe393a54072d5b960f851ee7d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 3 Nov 2023 16:27:02 +0100 Subject: [PATCH 150/323] fix: display details quantity in Kit in PDF #26359 (#26454) * add detail qty in kit displayed in PDF line * fix: #26359 --- htdocs/core/lib/pdf.lib.php | 19 +++++++++++++++++-- htdocs/product/class/product.class.php | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4b52b0cd384..bae6cf56f99 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1534,14 +1534,29 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) { $prodser->get_sousproduits_arbo(); if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) { + $outputlangs->load('mrp'); $tmparrayofsubproducts = reset($prodser->sousprods); + + $qtyText = null; + if (isset($object->lines[$i]->qty) && !empty($object->lines[$i]->qty)) { + $qtyText = $object->lines[$i]->qty; + } elseif (isset($object->lines[$i]->qty_shipped) && !empty($object->lines[$i]->qty_shipped)) { + $qtyText = $object->lines[$i]->qty; + } + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc($libelleproduitservice, " * ".$subprodval[3].' ('.$subprodval[1].')'); + $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]), + (!empty($qtyText) ? + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); } } else { foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice = dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')'); + $libelleproduitservice = dol_concatdesc(dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]), + (!empty($qtyText) ? + $outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1]*$qtyText: + $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])); } } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8b6c4704a3b..d28c527fbe3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5094,7 +5094,8 @@ class Product extends CommonObject //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); if (empty($firstlevelonly)) { - $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, array_push($parents, $rec['rowid'])); + $parents[] = $rec['rowid']; + $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, $parents); foreach ($listofchilds as $keyChild => $valueChild) { $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; } From 1e6788aec62bfa51088ac4cbc61bb94267537201 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:29:40 -0500 Subject: [PATCH 151/323] NEW Manage rate indirect. (#26449) * Indirect exchange rate * Indirect exchange rate * Indirect exchange rate * Indirect exchange rate --- .../mysql/tables/llx_multicurrency_rate.sql | 3 +- .../class/multicurrency.class.php | 10 +++++- htdocs/multicurrency/multicurrency_rate.php | 35 +++++++++++++++++-- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql index 45486acb5ec..a99d1e911e0 100644 --- a/htdocs/install/mysql/tables/llx_multicurrency_rate.sql +++ b/htdocs/install/mysql/tables/llx_multicurrency_rate.sql @@ -21,7 +21,8 @@ CREATE TABLE llx_multicurrency_rate ( rowid integer AUTO_INCREMENT PRIMARY KEY, date_sync datetime DEFAULT NULL, - rate double NOT NULL DEFAULT 0, + rate double NOT NULL DEFAULT 0, + rate_indirect double DEFAULT 0, fk_multicurrency integer NOT NULL, entity integer DEFAULT 1 ) ENGINE=innodb; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index a895c830d7e..c50d9b4b8e1 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -750,6 +750,11 @@ class CurrencyRate extends CommonObjectLine */ public $rate; + /** + * @var double Rate Indirect + */ + public $rate_indirect; + /** * @var integer Date synchronisation */ @@ -799,11 +804,13 @@ class CurrencyRate extends CommonObjectLine // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; $sql .= ' rate,'; + $sql .= ' rate_indirect,'; $sql .= ' date_sync,'; $sql .= ' fk_multicurrency,'; $sql .= ' entity'; $sql .= ') VALUES ('; $sql .= ' '.((float) $this->rate).','; + $sql .= ' '.((float) $this->rate_indirect).','; $sql .= " '".$this->db->idate($now)."',"; $sql .= " ".((int) $fk_multicurrency).","; $sql .= " ".((int) $this->entity); @@ -853,7 +860,7 @@ class CurrencyRate extends CommonObjectLine { dol_syslog('CurrencyRate::fetch', LOG_DEBUG); - $sql = "SELECT cr.rowid, cr.rate, cr.date_sync, cr.fk_multicurrency, cr.entity"; + $sql = "SELECT cr.rowid, cr.rate, cr.rate_indirect, cr.date_sync, cr.fk_multicurrency, cr.entity"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." AS cr"; $sql .= " WHERE cr.rowid = ".((int) $id); @@ -866,6 +873,7 @@ class CurrencyRate extends CommonObjectLine $this->id = $obj->rowid; $this->rate = $obj->rate; + $this->rate_indirect = $obj->rate_indirect; $this->date_sync = $this->db->jdate($obj->date_sync); $this->fk_multicurrency = $obj->fk_multicurrency; $this->entity = $obj->entity; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index e20476776e2..63baa14dea4 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -11,6 +11,7 @@ * Copyright (C) 2013 Adolfo segura * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2023 Lenin Rivas * * 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 @@ -52,10 +53,12 @@ $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', $search_date_sync = dol_mktime(0, 0, 0, GETPOST('search_date_syncmonth', 'int'), GETPOST('search_date_syncday', 'int'), GETPOST('search_date_syncyear', 'int')); $search_date_sync_end = dol_mktime(0, 0, 0, GETPOST('search_date_sync_endmonth', 'int'), GETPOST('search_date_sync_endday', 'int'), GETPOST('search_date_sync_endyear', 'int')); $search_rate = GETPOST('search_rate', 'alpha'); +$search_rate_indirect = GETPOST('search_rate_indirect', 'alpha'); $search_code = GETPOST('search_code', 'alpha'); $multicurrency_code = GETPOST('multicurrency_code', 'alpha'); $dateinput = dol_mktime(0, 0, 0, GETPOST('dateinputmonth', 'int'), GETPOST('dateinputday', 'int'), GETPOST('dateinputyear', 'int')); $rateinput = price2num(GETPOST('rateinput', 'alpha')); +$rateindirectinput = price2num(GETPOST('rateinidirectinput', 'alpha')); $optioncss = GETPOST('optioncss', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -89,6 +92,7 @@ if (empty($action)) { $fieldstosearchall = array( 'cr.date_sync'=>"date_sync", 'cr.rate'=>"rate", + 'cr.rate_indirect'=>"rate_indirect", 'm.code'=>"code", ); @@ -96,6 +100,7 @@ $fieldstosearchall = array( $arrayfields = array( 'cr.date_sync'=>array('label'=>'Date', 'checked'=>1), 'cr.rate'=>array('label'=>'Rate', 'checked'=>1), + 'cr.rate_indirect'=>array('label'=>'RateIndirect', 'checked'=>0, 'enabled'=>(empty($conf->global->MULTICURRENCY_USE_RATE_INDIRECT) ? 0 : 1)), 'm.code'=>array('label'=>'Code', 'checked'=>1), ); @@ -139,6 +144,7 @@ if ($action == "create") { $currencyRate_static->entity = $conf->entity; $currencyRate_static->date_sync = $dateinput; $currencyRate_static->rate = $rateinput; + $currencyRate_static->rate_indirect = $rateindirectinput; $result = $currencyRate_static->create(intval($fk_currency)); if ($result > 0) { @@ -278,7 +284,24 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { print ''.$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code', 'alpha') : $multicurrency_code), 'multicurrency_code', 1, " code != '".$db->escape($conf->currency)."'", true).''; print ' '.$langs->trans('Rate').' / '.$langs->getCurrencySymbol($conf->currency).''; - print ' '; + print ' '; + + if (!empty($conf->global->MULTICURRENCY_USE_RATE_INDIRECT)) { + print ' '.$langs->trans('RateIndirect').' / '.$langs->getCurrencySymbol($conf->currency).''; + print ' '; + // LRR Calculate Rate Direct + print ''; + } print ''; print ''; @@ -296,7 +319,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { -$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.entity, m.code, m.name'; +$sql = 'SELECT cr.rowid, cr.date_sync, cr.rate, cr.rate_indirect, cr.entity, m.code, m.name'; // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -527,6 +550,14 @@ if ($resql) { if (! $i) $totalarray['nbfield']++; } + // rate indirect + if (!empty($arrayfields['cr.rate_indirect']['checked'])) { + print ''; + print $obj->rate_indirect; + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Fields from hook $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); From 3b30a94e439179734a434bfa6fc224b1c095920d Mon Sep 17 00:00:00 2001 From: thibdrev Date: Fri, 3 Nov 2023 16:30:29 +0100 Subject: [PATCH 152/323] fix error message ErrorThisBankReceiptIsAlreadyUsed is not translated (#26448) * fix missing translation for ErrorThisBankReceiptIsAlreadyUsed * add translation key to fr_FR * modify error message key in releve.php --- htdocs/compta/bank/releve.php | 2 +- htdocs/langs/en_US/banks.lang | 3 ++- htdocs/langs/fr_FR/banks.lang | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 43c72e4a8f5..f6c43583441 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -201,7 +201,7 @@ if ($action == 'confirm_editbankreceipt' && !empty($oldbankreceipt) && !empty($n if ($resql) { $obj = $db->fetch_object($resql); if ($obj && $obj->rowid) { - setEventMessages('ErrorThisBankReceiptIsAlreadyUsed', null, 'errors'); + setEventMessages('ErrorBankReceiptAlreadyExists', null, 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 62dbe855aba..b91de649cfa 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -16,6 +16,7 @@ CashAccounts=Cash accounts CurrentAccounts=Current accounts SavingAccounts=Savings accounts ErrorBankLabelAlreadyExists=Financial account label already exists +ErrorBankReceiptAlreadyExists=Bank receipt reference already exists BankBalance=Balance BankBalanceBefore=Balance before BankBalanceAfter=Balance after @@ -192,4 +193,4 @@ AlreadyOneBankAccount=Already one bank account defined SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=When generatin a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. ToCreateRelatedRecordIntoBank=To create missing related bank record -XNewLinesConciliated=%s new line(s) conciliated \ No newline at end of file +XNewLinesConciliated=%s new line(s) conciliated diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang index dafb3da22e0..9d6fa0217c9 100644 --- a/htdocs/langs/fr_FR/banks.lang +++ b/htdocs/langs/fr_FR/banks.lang @@ -16,6 +16,7 @@ CashAccounts=Comptes caisse/liquide CurrentAccounts=Comptes courants SavingAccounts=Comptes épargne/placements ErrorBankLabelAlreadyExists=Libellé de compte financier déjà existant +ErrorBankReceiptAlreadyExists=Référence de relevé bancaire déjà existante BankBalance=Solde BankBalanceBefore=Solde avant BankBalanceAfter=Solde après From 1eb0e66736627842b67c7406feeb43ef42d39ae1 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Fri, 3 Nov 2023 16:31:33 +0100 Subject: [PATCH 153/323] fix Rename is not translated because its translation isn't declared (#26447) `htdocs/compta/bank/releve.php` calls for `$langs->trans("Rename") at line 374 , but this translation doesn't exists: `grep -Rl "Rename=" ./htdocs/langs/` Also, this translation seems to be called only by `releve.php` (`grep -Rl '$langs->trans("Rename")'`) --- htdocs/compta/bank/releve.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index dc451f6a438..38a8fb1013b 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -371,7 +371,7 @@ if (empty($numref)) { } else { print ''; print ''; - print ''; + print ''; print ''; } print ''; From 0c9610641c184d3336abf57aba269274d250f264 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Fri, 3 Nov 2023 16:32:31 +0100 Subject: [PATCH 154/323] Fix Attributes values shall be ordered by position when retrieved (#26446) * Fix Attributes values shall be ordered by position when retrieved from the table The order of attribute values can be modified manually. This is recorded via the "position" key in the table "llx_product_attribute_value". However, this order is not taken into account when the attribute values are retrieved via the function fetchAllByProductAttribute() from ProductAttributeValue.class.php * correction d'une coquille --- htdocs/variants/class/ProductAttributeValue.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 734e82b7c27..b9c312b8c82 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -288,6 +288,8 @@ class ProductAttributeValue extends CommonObjectLine $sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1"; } + $sql .= " ORDER BY v.position ASC"; + $query = $this->db->query($sql); while ($result = $this->db->fetch_object($query)) { From 8605e6b17b746f035162fd17d1f5c5ace7f2cc84 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 3 Nov 2023 17:05:51 +0100 Subject: [PATCH 155/323] FIX wrong color for pending status (#26443) --- htdocs/core/boxes/box_members_by_tags.php | 2 +- htdocs/core/boxes/box_members_by_type.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_tags.php b/htdocs/core/boxes/box_members_by_tags.php index efee61607ba..27aa289be7d 100644 --- a/htdocs/core/boxes/box_members_by_tags.php +++ b/htdocs/core/boxes/box_members_by_tags.php @@ -219,7 +219,7 @@ class box_members_by_tags extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 72db5ec4f92..c11f768b6f7 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -170,7 +170,7 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'text' => (isset($data['members_pending']) && $data['members_pending'] > 0 ? $data['members_pending'] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( @@ -219,7 +219,7 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), + 'text' => $sumMembers['total']['members_pending'].' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( From fccc2c182483a80fc85a56c9d587f88a133929b6 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 19:58:42 +0100 Subject: [PATCH 156/323] add hook tabContentEditProduct (#26436) Co-authored-by: Christophe Battarel --- htdocs/product/card.php | 919 ++++++++++++++++++++-------------------- 1 file changed, 462 insertions(+), 457 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 8d193628584..25a7aa81358 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1899,477 +1899,482 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'card', $titre, 0, $picto); - - print ''; - - // Ref - if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { - print ''; - } else { - print ''; - } - - // Label - print ''; - - // Status To sell - print ''; - - // Status To Buy - print ''; - - // Batch number managment - if (isModEnabled('productbatch')) { - if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print ''; - if (!empty($object->status_batch) || !empty($conf->use_javascript_ajax)) { - $langs->load("admin"); - $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); - $tooltip .= '
'.$langs->trans("GenericMaskCodes2"); - $tooltip .= '
'.$langs->trans("GenericMaskCodes3"); - $tooltip .= '
'.$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); - $tooltip .= '
'.$langs->trans("GenericMaskCodes5"); - print ''; - $mask = ''; - if ($object->status_batch == '1' && getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') { - $mask = !empty($object->batch_mask) ? $object->batch_mask : getDolGlobalString('LOT_ADVANCED_MASK'); - } - if ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced') { - $mask = !empty($object->batch_mask) ? $object->batch_mask : getDolGlobalString('SN_ADVANCED_MASK'); - } - $inherited_mask_lot = getDolGlobalString('LOT_ADVANCED_MASK'); - $inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK'); - print ''; - } - } - } - - // Barcode - $showbarcode = isModEnabled('barcode'); - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { - $showbarcode = 0; - } - - if ($showbarcode) { - print ''; - print ''; - } - - // Description (used in invoice, propal...) - print '"; - print "\n"; - - // Public Url - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { - print ''; - } - - // Stock - if ($object->isProduct() && isModEnabled('stock')) { - // Default warehouse - print ''; - /* - print "".''; - - print ''; - */ - } - - if ($object->isService() && $conf->workstation->enabled) { - // Default workstation - print ''; - } - - /* - else - { - print ''; - print ''; - }*/ - - if ($object->isService()) { - // Duration - print ''; - } else { - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { - // Nature - print ''; - } - } - - if (!$object->isService() && isModEnabled('bom')) { - print ''; - } - - if (!$object->isService()) { - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { - // Brut Weight - print ''; - } - - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Brut Length - print ''; - } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Brut Surface - print ''; - } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Brut Volume - print ''; - } - - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { - // Net Measure - print ''; - } - } - // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''; - print ''; - } - - // Custom code - if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { - print ''; - // Origin country - print ''; - print ''; - - // State - if (empty($conf->global->PRODUCT_DISABLE_STATE)) { - print ''; - if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { - print ''; - print ''; - } - } - - // Quality control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { - print ''; - print ''; - } - - // Other attributes - $parameters = array('colspan' => ' colspan="2"', 'cols' => 2); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Call Hook tabContentEditProduct + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentEditProduct', $parameters, $object, $action); if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit', $parameters); - } + print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print ''; - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print ''; - print '
'.$langs->trans("ManageLotSerial").''; - $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); - - print $form->selectarray('status_batch', $statutarray, GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch); - - print ''; - - print ''; - - if ($object->status_batch) { - // Display message to make user know that all batch will be move into global stock - print ''; - - // Display message to explain that if the product currently have a quantity higher or equal to 2, switching to this choice means we will still have a product with different objects of the same batch (while we want a unique serial number) - if ($object->status_batch == 1) { - print ''; - } - } - - print '
'.$langs->trans("ManageLotMask").''; - print $form->textwithpicto('', $tooltip, 1, 1); - // Add javascript to sho/hide field for custom mask - if (!empty($conf->use_javascript_ajax)) { - print ''; - } - print '
'.$langs->trans('BarcodeType').''; - if (GETPOSTISSET('fk_barcode_type')) { - $fk_barcode_type = GETPOST('fk_barcode_type'); - } else { - $fk_barcode_type = $object->barcode_type; - if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { - $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; - } - } - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; - $formbarcode = new FormBarCode($db); - print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); - print '
'.$langs->trans("BarcodeValue").''; - $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { - $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); - } - print ''; - print '
'.$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', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); - $doleditor->Create(); - - print "
'.$langs->trans("PublicUrl").''; - print img_picto('', 'globe', 'class="pictofixedwidth"'); - print ''; - print '
'.$langs->trans("DefaultWarehouse").''; - print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); - print $formproduct->selectWarehouses((GETPOSTISSET('fk_default_warehouse') ? GETPOST('fk_default_warehouse') : $object->fk_default_warehouse), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); - print ' '; - print ''; - print '
'.$langs->trans("StockLimit").''; - print ''; - print ''.$langs->trans("DesiredStock").''; - print ''; - print '
'.$langs->trans("DefaultWorkstation").''; - print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); - print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); - print '
'.$langs->trans("Duration").''; - print ' '; - print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); - - // Mandatory period - print '       '; - print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; - print ''; - - print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - print $formproduct->selectProductNature('finished', (GETPOSTISSET('finished') ? GETPOST('finished') : $object->finished)); - print '
'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; - $bomkey = "Bom:bom/class/bom.class.php:0:(t.status:=:1) AND (t.fk_product:=:".((int) $object->id).')'; - print $form->selectForForms($bomkey, 'fk_default_bom', (GETPOSTISSET('fk_default_bom') ? GETPOST('fk_default_bom') : $object->fk_default_bom), 1); - print '
'.$langs->trans("Weight").''; - print ' '; - print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units') : $object->weight_units, 0, 2); - print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print 'x'; - print 'x'; - print ' '; - print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units, 0, 2); - print '
'.$langs->trans("Surface").''; - print ' '; - print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units, 0, 2); - print '
'.$langs->trans("Volume").''; - print ' '; - print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units') : $object->volume_units, 0, 2); - print '
'.$langs->trans("NetMeasure").''; - print ' '; - print $formproduct->selectMeasuringUnits("net_measure_units", "", GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units') : $object->net_measure_units, 0, 0); - print '
'.$langs->trans('DefaultUnitToShow').''; - print $form->selectUnits($object->fk_unit, 'units'); - print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; - print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print '
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; - } else { - print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; - } - - print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code); - print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'; - // Tags-Categories - if (isModEnabled('categorie')) { - print ''; + } else { + print ''; + } + + // Label + print ''; + + // Status To sell + print ''; + + // Status To Buy + print ''; + + // Batch number managment + if (isModEnabled('productbatch')) { + if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + print ''; + if (!empty($object->status_batch) || !empty($conf->use_javascript_ajax)) { + $langs->load("admin"); + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); + $tooltip .= '
'.$langs->trans("GenericMaskCodes2"); + $tooltip .= '
'.$langs->trans("GenericMaskCodes3"); + $tooltip .= '
'.$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); + $tooltip .= '
'.$langs->trans("GenericMaskCodes5"); + print ''; + $mask = ''; + if ($object->status_batch == '1' && getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') { + $mask = !empty($object->batch_mask) ? $object->batch_mask : getDolGlobalString('LOT_ADVANCED_MASK'); + } + if ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced') { + $mask = !empty($object->batch_mask) ? $object->batch_mask : getDolGlobalString('SN_ADVANCED_MASK'); + } + $inherited_mask_lot = getDolGlobalString('LOT_ADVANCED_MASK'); + $inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK'); + print ''; + } } } - if (GETPOSTISARRAY('categories')) { - foreach (GETPOST('categories', 'array') as $cat) { - $arrayselected[] = $cat; - } + + // Barcode + $showbarcode = isModEnabled('barcode'); + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { + $showbarcode = 0; } - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print ""; - } - // Note private - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - print ''; + print ''; + } - $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4, '90%'); + // Description (used in invoice, propal...) + print '"; - } + print "\n"; - print '
'.$langs->trans("Categories").''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_PRODUCT); - $arrayselected = array(); - if (is_array($cats)) { - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + // Ref + if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { + print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + print ''; + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + print ''; + print '
'.$langs->trans("ManageLotSerial").''; + $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); + + print $form->selectarray('status_batch', $statutarray, GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch); + + print ''; + + print ''; + + if ($object->status_batch) { + // Display message to make user know that all batch will be move into global stock + print ''; + + // Display message to explain that if the product currently have a quantity higher or equal to 2, switching to this choice means we will still have a product with different objects of the same batch (while we want a unique serial number) + if ($object->status_batch == 1) { + print ''; + } + } + + print '
'.$langs->trans("ManageLotMask").''; + print $form->textwithpicto('', $tooltip, 1, 1); + // Add javascript to sho/hide field for custom mask + if (!empty($conf->use_javascript_ajax)) { + print ''; + } + print '
'.$langs->trans("NoteNotVisibleOnBill").''; + if ($showbarcode) { + print '
'.$langs->trans('BarcodeType').''; + if (GETPOSTISSET('fk_barcode_type')) { + $fk_barcode_type = GETPOST('fk_barcode_type'); + } else { + $fk_barcode_type = $object->barcode_type; + if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; + } + } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; + $formbarcode = new FormBarCode($db); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); + print '
'.$langs->trans("BarcodeValue").''; + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { + $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); + } + print ''; + print '
'.$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', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); $doleditor->Create(); print "
'; - - print '
'; - - print ''; - - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { - if (isModEnabled('accounting')) { - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_sell_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_sell_export - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - - // Accountancy_code_buy_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_buy_export - print ''; - print ''; - } else { - // For external software - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_sell_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_sell_export - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - - // Accountancy_code_buy_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_buy_export - print ''; - print ''; } + + // Stock + if ($object->isProduct() && isModEnabled('stock')) { + // Default warehouse + print ''; + /* + print "".''; + + print ''; + */ + } + + if ($object->isService() && $conf->workstation->enabled) { + // Default workstation + print ''; + } + + /* + else + { + print ''; + print ''; + }*/ + + if ($object->isService()) { + // Duration + print ''; + } else { + if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + // Nature + print ''; + } + } + + if (!$object->isService() && isModEnabled('bom')) { + print ''; + } + + if (!$object->isService()) { + if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + // Brut Weight + print ''; + } + + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + // Brut Length + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + // Brut Surface + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + // Brut Volume + print ''; + } + + if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + // Net Measure + print ''; + } + } + // Units + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + print ''; + print ''; + } + + // Custom code + if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { + print ''; + // Origin country + print ''; + print ''; + + // State + if (empty($conf->global->PRODUCT_DISABLE_STATE)) { + print ''; + if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + print ''; + print ''; + } + } + + // Quality control + if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + print ''; + print ''; + } + + // Other attributes + $parameters = array('colspan' => ' colspan="2"', 'cols' => 2); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'edit', $parameters); + } + + // Tags-Categories + if (isModEnabled('categorie')) { + print '"; + } + + // Note private + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + print '"; + } + + print '
'.$langs->trans("ProductAccountancySellCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancySellExportCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); - print '
'.$langs->trans("ProductAccountancySellCode").''; - print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - print '
'.$langs->trans("ProductAccountancySellExportCode").''; - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; - print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + // Public Url + if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + print '
'.$langs->trans("PublicUrl").''; + print img_picto('', 'globe', 'class="pictofixedwidth"'); + print ''; print '
'.$langs->trans("DefaultWarehouse").''; + print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); + print $formproduct->selectWarehouses((GETPOSTISSET('fk_default_warehouse') ? GETPOST('fk_default_warehouse') : $object->fk_default_warehouse), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print ' '; + print ''; + print '
'.$langs->trans("StockLimit").''; + print ''; + print ''.$langs->trans("DesiredStock").''; + print ''; + print '
'.$langs->trans("DefaultWorkstation").''; + print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); + print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); + print '
'.$langs->trans("Duration").''; + print ' '; + print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); + + // Mandatory period + print '       '; + print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; + print ''; + + print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; + print $formproduct->selectProductNature('finished', (GETPOSTISSET('finished') ? GETPOST('finished') : $object->finished)); + print '
'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; + $bomkey = "Bom:bom/class/bom.class.php:0:(t.status:=:1) AND (t.fk_product:=:".((int) $object->id).')'; + print $form->selectForForms($bomkey, 'fk_default_bom', (GETPOSTISSET('fk_default_bom') ? GETPOST('fk_default_bom') : $object->fk_default_bom), 1); + print '
'.$langs->trans("Weight").''; + print ' '; + print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units') : $object->weight_units, 0, 2); + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print 'x'; + print 'x'; + print ' '; + print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units, 0, 2); + print '
'.$langs->trans("Surface").''; + print ' '; + print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units, 0, 2); + print '
'.$langs->trans("Volume").''; + print ' '; + print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units') : $object->volume_units, 0, 2); + print '
'.$langs->trans("NetMeasure").''; + print ' '; + print $formproduct->selectMeasuringUnits("net_measure_units", "", GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units') : $object->net_measure_units, 0, 0); + print '
'.$langs->trans('DefaultUnitToShow').''; + print $form->selectUnits($object->fk_unit, 'units'); + print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; + print img_picto('', 'globe-americas', 'class="paddingrightonly"'); + print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print '
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; + } else { + print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; + } + + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code); + print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_PRODUCT); + $arrayselected = array(); + if (is_array($cats)) { + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + } + if (GETPOSTISARRAY('categories')) { + foreach (GETPOST('categories', 'array') as $cat) { + $arrayselected[] = $cat; + } + } + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print "
'.$langs->trans("NoteNotVisibleOnBill").''; + + $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4, '90%'); + $doleditor->Create(); + + print "
'; + + print '
'; + + print ''; + + if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + if (isModEnabled('accounting')) { + // Accountancy_code_sell + print ''; + print ''; + + // Accountancy_code_sell_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_sell_export + print ''; + print ''; + + // Accountancy_code_buy + print ''; + print ''; + + // Accountancy_code_buy_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_buy_export + print ''; + print ''; + } else { + // For external software + // Accountancy_code_sell + print ''; + print ''; + + // Accountancy_code_sell_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_sell_export + print ''; + print ''; + + // Accountancy_code_buy + print ''; + print ''; + + // Accountancy_code_buy_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_buy_export + print ''; + print ''; + } + } + print '
'.$langs->trans("ProductAccountancySellCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancySellIntraCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancySellExportCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print '
'.$langs->trans("ProductAccountancySellCode").''; + print '
'.$langs->trans("ProductAccountancySellIntraCode").''; + print '
'.$langs->trans("ProductAccountancySellExportCode").''; + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; + print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + print '
'; } - print ''; print dol_get_fiche_end(); From 20b99b6a987c70d481a1dc2bab61fcba44bd967e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 19:59:23 +0100 Subject: [PATCH 157/323] add hook tabContentViewProduct (#26435) Co-authored-by: Christophe Battarel --- htdocs/product/card.php | 717 ++++++++++++++++++++-------------------- 1 file changed, 361 insertions(+), 356 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 25a7aa81358..5b9abc36961 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2405,401 +2405,406 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref'); + // Call Hook tabContentViewProduct + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentViewProduct', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; - print '
'; - print '
'; + print '
'; + print ''; - print '
'; - print '
'; - - // Type - if (isModEnabled("product") && isModEnabled("service")) { - $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); - print ''; - } - - if ($showbarcode) { - // Barcode type - print ''; } - $fk_barcode_type = ''; - if ($action == 'editbarcodetype') { - print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); - $fk_barcode_type = $object->barcode_type; - } else { - $object->fetch_barcode(); - $fk_barcode_type = $object->barcode_type; - print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); - } - print ''."\n"; - - // Barcode value - print '
'."\n"; - } + $fk_barcode_type = ''; + if ($action == 'editbarcodetype') { + print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); + $fk_barcode_type = $object->barcode_type; + } else { + $object->fetch_barcode(); + $fk_barcode_type = $object->barcode_type; + print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); + } + print ''."\n"; - // Batch number management (to batch) - if (isModEnabled('productbatch')) { - if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print '
'."\n"; + } + + // Batch number management (to batch) + if (isModEnabled('productbatch')) { + if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + print ''; + if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') + || ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) { + print ''; + } + } + } + + if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + // Accountancy sell code + print ''; - if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') - || ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) { - print ''; + } + + // Accountancy sell code export + print ''; + + // Accountancy buy code + print ''; + + // Accountancy buy code intra-community + if ($mysoc->isInEEC()) { + print ''; + } + + // Accountancy buy code export + print ''; + } + + // Description + print ''; + + // Public URL + if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + print ''; + } + + // Default warehouse + if ($object->isProduct() && isModEnabled('stock')) { + $warehouse = new Entrepot($db); + $warehouse->fetch($object->fk_default_warehouse); + + print ''; + } + + if ($object->isService() && isModEnabled('workstation')) { + $workstation = new Workstation($db); + $res = $workstation->fetch($object->fk_default_workstation); + + print ''; + } + + // Parent product. + if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) { + $combination = new ProductCombination($db); + + if ($combination->fetchByFkProductChild($object->id) > 0) { + $prodstatic = new Product($db); + $prodstatic->fetch($combination->fk_product_parent); + + // Parent product + print ''; } } - } - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { - // Accountancy sell code - print '
'; - print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); - print ''; - print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); - print '
'; - print ''; - if (($action != 'editbarcodetype') && $usercancreate && $createbarcode) { - print ''; - } - print '
'; - print $langs->trans("BarcodeType"); - print 'id.'&token='.newToken().'">'.img_edit($langs->trans('Edit'), 1).'
'; - print '
'; - if ($action == 'editbarcodetype' || $action == 'editbarcode') { - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; - $formbarcode = new FormBarCode($db); + // Type + if (isModEnabled("product") && isModEnabled("service")) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print '
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); + print '
'; - print ''; - if (($action != 'editbarcode') && $usercancreate && $createbarcode) { - print ''; - } - print '
'; - print $langs->trans("BarcodeValue"); - print 'id.'&token='.newToken().'">'.img_edit($langs->trans('Edit'), 1).'
'; - print '
'; - if ($action == 'editbarcode') { - $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { - $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); + if ($showbarcode) { + // Barcode type + print '
'; + print ''; + if (($action != 'editbarcodetype') && $usercancreate && $createbarcode) { + print ''; + } + print '
'; + print $langs->trans("BarcodeType"); + print 'id.'&token='.newToken().'">'.img_edit($langs->trans('Edit'), 1).'
'; + print '
'; + if ($action == 'editbarcodetype' || $action == 'editbarcode') { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; + $formbarcode = new FormBarCode($db); } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print showValueWithClipboardCPButton($object->barcode); - } - print '
'.$langs->trans("ManageLotSerial").''; - print $object->getLibStatut(0, 2); + // Barcode value + print '
'; + print ''; + if (($action != 'editbarcode') && $usercancreate && $createbarcode) { + print ''; + } + print '
'; + print $langs->trans("BarcodeValue"); + print 'id.'&token='.newToken().'">'.img_edit($langs->trans('Edit'), 1).'
'; + print '
'; + if ($action == 'editbarcode') { + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { + $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ' '; + print '
'; + } else { + print showValueWithClipboardCPButton($object->barcode); + } + print '
'.$langs->trans("ManageLotSerial").''; + print $object->getLibStatut(0, 2); + print '
'.$langs->trans("ManageLotMask").''; + print $object->batch_mask; + print '
'; + print $langs->trans("ProductAccountancySellCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_sell)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $object->accountancy_code_sell, 1); + + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_sell; + } print '
'.$langs->trans("ManageLotMask").''; - print $object->batch_mask; + + // Accountancy sell code intra-community + if ($mysoc->isInEEC()) { + print '
'; + print $langs->trans("ProductAccountancySellIntraCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_sell_intra)) { + $accountingaccount2 = new AccountingAccount($db); + $accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1); + + print $accountingaccount2->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_sell_intra; + } + print '
'; + print $langs->trans("ProductAccountancySellExportCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_sell_export)) { + $accountingaccount3 = new AccountingAccount($db); + $accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1); + + print $accountingaccount3->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_sell_export; + } + print '
'; + print $langs->trans("ProductAccountancyBuyCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_buy)) { + $accountingaccount4 = new AccountingAccount($db); + $accountingaccount4->fetch('', $object->accountancy_code_buy, 1); + + print $accountingaccount4->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_buy; + } + print '
'; + print $langs->trans("ProductAccountancyBuyIntraCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_buy_intra)) { + $accountingaccount5 = new AccountingAccount($db); + $accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1); + + print $accountingaccount5->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_buy_intra; + } + print '
'; + print $langs->trans("ProductAccountancyBuyExportCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_buy_export)) { + $accountingaccount6 = new AccountingAccount($db); + $accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1); + + print $accountingaccount6->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_buy_export; + } + print '
'.$langs->trans("Description").''.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'
'.$langs->trans("PublicUrl").''; + print dol_print_url($object->url, '_blank', 128); + print '
'.$langs->trans("DefaultWarehouse").''; + print (!empty($warehouse->id) ? $warehouse->getNomUrl(1) : ''); + print '
'.$langs->trans("DefaultWorkstation").''; + print (!empty($workstation->id) ? $workstation->getNomUrl(1) : ''); + print '
'.$langs->trans("ParentProduct").''; + print $prodstatic->getNomUrl(1); print '
'; - print $langs->trans("ProductAccountancySellCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_sell)) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $object->accountancy_code_sell, 1); + print '
'; + print '
'; + print '
'; - print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + print '
'; + print ''; + + if ($object->isService()) { + // Duration + print ''; } else { - print $object->accountancy_code_sell; + if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + // Nature + print ''; + } } - print ''; - // Accountancy sell code intra-community - if ($mysoc->isInEEC()) { - print ''; + } - print $accountingaccount2->getNomUrl(0, 1, 1, '', 1); + if (!$object->isService()) { + // Brut Weight + if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + print '\n"; } - print ''; - } - // Accountancy sell code export - print ''; - - // Accountancy buy code - print ''; - - // Accountancy buy code intra-community - if ($mysoc->isInEEC()) { - print '\n"; } - print ''; - } - - // Accountancy buy code export - print ''; - } - - // Description - print ''; - - // Public URL - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { - print ''; - } - - // Default warehouse - if ($object->isProduct() && isModEnabled('stock')) { - $warehouse = new Entrepot($db); - $warehouse->fetch($object->fk_default_warehouse); - - print ''; - } - - if ($object->isService() && isModEnabled('workstation')) { - $workstation = new Workstation($db); - $res = $workstation->fetch($object->fk_default_workstation); - - print ''; - } - - // Parent product. - if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) { - $combination = new ProductCombination($db); - - if ($combination->fetchByFkProductChild($object->id) > 0) { - $prodstatic = new Product($db); - $prodstatic->fetch($combination->fk_product_parent); - - // Parent product - print ''; - } - } - - print '
'.$langs->trans("Duration").''; + print $object->duration_value; + if ($object->duration_value > 1) { + $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + } elseif ($object->duration_value > 0) { + $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } + print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); + + // Mandatory period + if ($object->duration_value > 0) { + print '       '; + } + $htmltooltip = $langs->trans("mandatoryHelper"); + print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled>'; + print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0); + + print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; + print $object->getLibFinished(); + print '
'; - print $langs->trans("ProductAccountancySellIntraCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_sell_intra)) { - $accountingaccount2 = new AccountingAccount($db); - $accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1); + if (!$object->isService() && isModEnabled('bom') && $object->finished) { + print '
'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; + if ($object->fk_default_bom) { + $bom_static = new BOM($db); + $bom_static->fetch($object->fk_default_bom); + print $bom_static->getNomUrl(1); + } + print '
'.$langs->trans("Weight").''; + if ($object->weight != '') { + print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); + } else { + print ' '; } - } else { - print $object->accountancy_code_sell_intra; + print "
'; - print $langs->trans("ProductAccountancySellExportCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_sell_export)) { - $accountingaccount3 = new AccountingAccount($db); - $accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1); - - print $accountingaccount3->getNomUrl(0, 1, 1, '', 1); - } - } else { - print $object->accountancy_code_sell_export; - } - print '
'; - print $langs->trans("ProductAccountancyBuyCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_buy)) { - $accountingaccount4 = new AccountingAccount($db); - $accountingaccount4->fetch('', $object->accountancy_code_buy, 1); - - print $accountingaccount4->getNomUrl(0, 1, 1, '', 1); - } - } else { - print $object->accountancy_code_buy; - } - print '
'; - print $langs->trans("ProductAccountancyBuyIntraCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_buy_intra)) { - $accountingaccount5 = new AccountingAccount($db); - $accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1); - - print $accountingaccount5->getNomUrl(0, 1, 1, '', 1); + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + // Brut Length + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + if ($object->length != '' || $object->width != '' || $object->height != '') { + print $object->length; + if ($object->width) { + print " x ".$object->width; + } + if ($object->height) { + print " x ".$object->height; + } + print ' '.measuringUnitString(0, "size", $object->length_units); + } else { + print ' '; } - } else { - print $object->accountancy_code_buy_intra; + print "
'; - print $langs->trans("ProductAccountancyBuyExportCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_buy_export)) { - $accountingaccount6 = new AccountingAccount($db); - $accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1); - - print $accountingaccount6->getNomUrl(0, 1, 1, '', 1); - } - } else { - print $object->accountancy_code_buy_export; - } - print '
'.$langs->trans("Description").''.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'
'.$langs->trans("PublicUrl").''; - print dol_print_url($object->url, '_blank', 128); - print '
'.$langs->trans("DefaultWarehouse").''; - print (!empty($warehouse->id) ? $warehouse->getNomUrl(1) : ''); - print '
'.$langs->trans("DefaultWorkstation").''; - print (!empty($workstation->id) ? $workstation->getNomUrl(1) : ''); - print '
'.$langs->trans("ParentProduct").''; - print $prodstatic->getNomUrl(1); - print '
'; - print '
'; - print '
'; - - print '
'; - print ''; - - if ($object->isService()) { - // Duration - print ''; - } else { - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { - // Nature - print ''; - } - } - - if (!$object->isService() && isModEnabled('bom') && $object->finished) { - print ''; - } - - if (!$object->isService()) { - // Brut Weight - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { - print '\n"; - } - - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - // Brut Length - print '\n"; + } + if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + // Brut Volume + print '\n"; } - print "\n"; - } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Brut Surface - print ''; } - print "\n"; - } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Brut Volume - print '\n"; } - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { - // Net Measure - print ''; } - } - // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { - $unit = $object->getLabelOfUnit(); + // Custom code + if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { + print ''; - print ''; } - print ''; - } - // Custom code - if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { - print ''; - - // Origin country code - print ''; + print ''; } - print ''; + + // Other attributes + $parameters = array(); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + // Categories + if (isModEnabled('categorie')) { + print '"; + } + + // Note private + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + print ' '."\n"; + print ''."\n"; + print ' '."\n"; + } + + print "
'.$langs->trans("Duration").''; - print $object->duration_value; - if ($object->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); - } elseif ($object->duration_value > 0) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); - } - print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); - - // Mandatory period - if ($object->duration_value > 0) { - print '       '; - } - $htmltooltip = $langs->trans("mandatoryHelper"); - print 'mandatory_period == 1 ? ' checked="checked"' : '').' disabled>'; - print $form->textwithpicto($langs->trans("mandatoryperiod"), $htmltooltip, 1, 0); - - print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - print $object->getLibFinished(); - print '
'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; - if ($object->fk_default_bom) { - $bom_static = new BOM($db); - $bom_static->fetch($object->fk_default_bom); - print $bom_static->getNomUrl(1); - } - print '
'.$langs->trans("Weight").''; - if ($object->weight != '') { - print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); - } else { - print ' '; - } - print "
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - if ($object->length != '' || $object->width != '' || $object->height != '') { - print $object->length; - if ($object->width) { - print " x ".$object->width; + if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + // Brut Surface + print '
'.$langs->trans("Surface").''; + if ($object->surface != '') { + print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); + } else { + print ' '; } - if ($object->height) { - print " x ".$object->height; + print "
'.$langs->trans("Volume").''; + if ($object->volume != '') { + print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); + } else { + print ' '; } - print ' '.measuringUnitString(0, "size", $object->length_units); - } else { - print ' '; + print "
'.$langs->trans("Surface").''; - if ($object->surface != '') { - print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); - } else { - print ' '; + + if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + // Net Measure + print '
'.$langs->trans("NetMeasure").''; + if ($object->net_measure != '') { + print $object->net_measure." ".measuringUnitString($object->net_measure_units); + } else { + print ' '; + } + print '
'.$langs->trans("Volume").''; - if ($object->volume != '') { - print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); - } else { - print ' '; - } - print "
'.$langs->trans("NetMeasure").''; - if ($object->net_measure != '') { - print $object->net_measure." ".measuringUnitString($object->net_measure_units); - } else { - print ' '; + // Unit + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $unit = $object->getLabelOfUnit(); + + print '
'.$langs->trans('DefaultUnitToShow').''; + if ($unit !== '') { + print $langs->trans($unit); } print '
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans('DefaultUnitToShow').''; - if ($unit !== '') { - print $langs->trans($unit); + // Origin country code + print '
'.$langs->trans("Origin").''.getCountry($object->country_id, 0, $db); + if (!empty($object->state_id)) { + print ' - '.getState($object->state_id, 0, $db); + } + print '
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("Origin").''.getCountry($object->country_id, 0, $db); - if (!empty($object->state_id)) { - print ' - '.getState($object->state_id, 0, $db); + // Quality Control + if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + print '
'.$langs->trans("LifeTime").''.$object->lifetime.'
'.$langs->trans("QCFrequency").''.$object->qc_frequency.'
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); + print "
'.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private) ? $object->note_private : dol_nl2br($object->note_private, 1, true)).'
\n"; + print '
'; + + print '
'; + print '
'; } - // Quality Control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { - print ''.$langs->trans("LifeTime").''.$object->lifetime.''; - print ''.$langs->trans("QCFrequency").''.$object->qc_frequency.''; - } - - // Other attributes - $parameters = array(); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - // Categories - if (isModEnabled('categorie')) { - print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); - print ""; - } - - // Note private - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - print ' '."\n"; - print ''.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private) ? $object->note_private : dol_nl2br($object->note_private, 1, true)).''."\n"; - print ' '."\n"; - } - - print "\n"; - print '
'; - - print '
'; - print '
'; - print dol_get_fiche_end(); } } elseif ($action != 'create') { From 5c3069e51a20be6fe62ab9e525dbae9796cd354d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 20:58:04 +0100 Subject: [PATCH 158/323] add hook tabContentCreateProduct (#26434) Co-authored-by: Christophe Battarel --- htdocs/product/card.php | 912 ++++++++++++++++++++-------------------- 1 file changed, 459 insertions(+), 453 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5b9abc36961..b9395315d71 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1360,492 +1360,498 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print dol_get_fiche_head(''); - print ''; + // Call Hook tabContentCreateProduct + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateProduct', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { - print ''; - $tmpcode = ''; - if (!empty($modCodeProduct->code_auto)) { - $tmpcode = $modCodeProduct->getNextValue($object, $type); - } - print ''; + $tmpcode = ''; + if (!empty($modCodeProduct->code_auto)) { + $tmpcode = $modCodeProduct->getNextValue($object, $type); + } + print ''; } + + // Label + print ''; + + // On sell + print ''; - } - // Label - print ''; - - // On sell - print ''; - - // To buy - print ''; - - // Batch number management - if (isModEnabled('productbatch')) { - print ''; - // Product specific batch number management - $status_batch = GETPOST('status_batch'); - if ($status_batch !== '0') { - $langs->load("admin"); - $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); - $tooltip .= '
'.$langs->trans("GenericMaskCodes2"); - $tooltip .= '
'.$langs->trans("GenericMaskCodes3"); - $tooltip .= '
'.$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch")); - $tooltip .= '
'.$langs->trans("GenericMaskCodes5"); - if ((getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') - || (getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced')) { - print ''; - $inherited_mask_lot = getDolGlobalString('LOT_ADVANCED_MASK'); - $inherited_mask_sn = getDolGlobalString('SN_ADVANCED_MASK'); - print ''; + '; + print ''; + } } } - } - $showbarcode = isModEnabled('barcode'); - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { - $showbarcode = 0; - } + $showbarcode = isModEnabled('barcode'); + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { + $showbarcode = 0; + } - if ($showbarcode) { - print ''; + print ''; + print ''; } - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; - $formbarcode = new FormBarCode($db); - print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); - print ''; - print ''; - print '"; + + if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + // Public URL + print ''; } - print img_picto('', 'barcode', 'class="pictofixedwidth"'); - print ''; - print ''; - } - // Description (used in invoice, propal...) - print '"; - - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { - // Public URL - print ''; - } - - if ($type != 1 && isModEnabled('stock')) { - // Default warehouse - print ''; - print ''; - - if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { - // Stock min level - print ''; print ''; - // Stock desired level - print ''; - } - } else { - if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { - print ''; - print ''; - } - } + if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { + // Stock min level + print ''; + print ''; - if ($type == $object::TYPE_SERVICE && isModEnabled("workstation")) { - // Default workstation - print ''; - } - - // Duration - if ($type == 1) { - print ''; - } - - if ($type != 1) { // Nature, Weight and volume only applies to products and not to services - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { - // Nature - print ''; - } - } - - if ($type != 1) { - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { - // Brut Weight - print ''; - } - - // Brut Length - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { - print ''; - } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { - // Brut Surface - print ''; - } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { - // Brut Volume - print ''; - } - - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { - // Net Measure - print ''; - } - } - - // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { - print ''; - print ''; - } - - // Custom code - if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) { - print ''; - - // Origin country - print ''; - print ''; - - // State - if (empty($conf->global->PRODUCT_DISABLE_STATE)) { - print ''; - if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { - print ''; } - - print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state($object->state_id, $object->country_code); - print ''; - } - } - - // Quality control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { - print ''; - print ''; - } - - // Other attributes - $parameters = array('colspan' => ' colspan="2"', 'cols'=>2); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) { - print $object->showOptionals($extrafields, 'create', $parameters); - } - - // Note (private, no output on invoices, propales...) - //if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode - //{ - print '"; - //} - - if (isModEnabled('categorie')) { - // Categories - print '"; - } - - print '
'.$langs->trans("ProductRef").''; - if ($refalreadyexists) { - print $langs->trans("RefAlreadyExists"); + if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + print '
'.$langs->trans("ProductRef").''; + if ($refalreadyexists) { + print $langs->trans("RefAlreadyExists"); + } + print '
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + print $form->selectarray('statut', $statutarray, GETPOST('statut')); print '
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - $statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); - print $form->selectarray('statut', $statutarray, GETPOST('statut')); - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - $statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); - print $form->selectarray('statut_buy', $statutarray, GETPOST('statut_buy')); - print '
'.$langs->trans("ManageLotSerial").''; - $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); - print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch')); + // To buy + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + $statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); + print $form->selectarray('statut_buy', $statutarray, GETPOST('statut_buy')); print '
'.$langs->trans("ManageLotMask").''; - print $form->textwithpicto('', $tooltip, 1, 1); - print ''; - print '
'.$langs->trans('BarcodeType').''; - if (GETPOSTISSET('fk_barcode_type')) { - $fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0; - } else { - if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { - $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); + if ($showbarcode) { + print '
'.$langs->trans('BarcodeType').''; + if (GETPOSTISSET('fk_barcode_type')) { + $fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0; } else { - $fk_barcode_type=0; + if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); + } else { + $fk_barcode_type=0; + } } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; + $formbarcode = new FormBarCode($db); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); + print '
'.$langs->trans("BarcodeValue").''; + $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; + if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { + $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); + } + print img_picto('', 'barcode', 'class="pictofixedwidth"'); + print ''; + print '
'.$langs->trans("BarcodeValue").''; - $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; - if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { - $tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type); + + // Description (used in invoice, propal...) + print '
'.$langs->trans("Description").''; + $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); + $doleditor->Create(); + print "
'.$langs->trans("PublicUrl").''; + print img_picto('', 'globe', 'class="pictofixedwidth"'); + print ''; + print '
'.$langs->trans("Description").''; - $doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%'); - $doleditor->Create(); - print "
'.$langs->trans("PublicUrl").''; - print img_picto('', 'globe', 'class="pictofixedwidth"'); - print ''; - print '
'.$langs->trans("DefaultWarehouse").''; - print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); - print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500'); - print ' '; - print ''; - print ''; - print '
'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; - print ''; + if ($type != 1 && isModEnabled('stock')) { + // Default warehouse + print '
'.$langs->trans("DefaultWarehouse").''; + print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); + print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500'); + print ' '; + print ''; + print ''; print '
'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; - print ''; - print '
'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; + print ''; + print '
'.$langs->trans("DefaultWorkstation").''; - print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); - print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); - print '
'.$langs->trans("Duration").''; - print img_picto('', 'clock', 'class="pictofixedwidth"'); - print ''; - print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOST('duration_value', 'alpha') : 'h'), 0, 1); - - // Mandatory period - print '       '; - print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; - print ''; - - print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - print $formproduct->selectProductNature('finished', $object->finished); - print '
'.$langs->trans("Weight").''; - print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); - print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); - print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print img_picto('', 'fa-ruler', 'class="pictofixedwidth"'); - print ' x '; - print ' x '; - print ''; - print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2); - print '
'.$langs->trans("Surface").''; - print ''; - print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2); - print '
'.$langs->trans("Volume").''; - print ''; - print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2); - print '
'.$langs->trans("NetMeasure").''; - print ''; - print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); - print '
'.$langs->trans('DefaultUnitToShow').''; - print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, 'units'); - print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; - print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx maxwidth500'); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print '
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; - } else { - print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; + // Stock desired level + print '
'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; + print ''; + print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'.$langs->trans("NoteNotVisibleOnBill").''; - - // 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('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%'); - $doleditor->Create(); - - print "
'.$langs->trans("Categories").''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print "
'; - - print '
'; - - if (empty($conf->global->PRODUCT_DISABLE_PRICES)) { - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - // We do no show price array on create when multiprices enabled. - // We must set them on prices tab. - print ''; - // VAT - print ''; - - print '
'.$langs->trans("VATRate").''; - $defaultva = get_default_tva($mysoc, $mysoc); - print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); - print '
'; - - print '
'; } else { - print ''; - - // Price - print ''; - print ''; - - // Min price - print ''; - print ''; - - // VAT - print ''; - - print '
'.$langs->trans("SellingPrice").''; - print $form->selectPriceBaseType($conf->global->PRODUCT_PRICE_BASE_TYPE, "price_base_type"); - print '
'.$langs->trans("MinPrice").''; - print '
'.$langs->trans("VATRate").''; - $defaultva = get_default_tva($mysoc, $mysoc); - print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); - print '
'; - - print '
'; + if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { + print ''; + print ''; + } } - } - // Accountancy codes - print ''."\n"; - print ''; - - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { - if (isModEnabled('accounting')) { - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_sell_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } + } - // Accountancy_code_sell_export - print ''; - print ''; + // Duration + if ($type == 1) { + print ''; - print ''; + // Mandatory period + print '       '; + print 'mandatory_period == 1 ? ' checked="checked"' : '').'>'; + print ''; - // Accountancy_code_buy_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_buy_export - print ''; - print ''; - } else {// For external software - if (!empty($accountancy_code_sell)) { - $object->accountancy_code_sell = $accountancy_code_sell; - } - if (!empty($accountancy_code_sell_intra)) { - $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; - } - if (!empty($accountancy_code_sell_export)) { - $object->accountancy_code_sell_export = $accountancy_code_sell_export; - } - if (!empty($accountancy_code_buy)) { - $object->accountancy_code_buy = $accountancy_code_buy; - } - if (!empty($accountancy_code_buy_intra)) { - $object->accountancy_code_buy_intra = $accountancy_code_buy_intra; - } - if (!empty($accountancy_code_buy_export)) { - $object->accountancy_code_buy_export = $accountancy_code_buy_export; - } - - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_sell_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_sell_export - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - - // Accountancy_code_buy_intra - if ($mysoc->isInEEC()) { - print ''; - print ''; - } - - // Accountancy_code_buy_export - print ''; - print ''; } + + if ($type != 1) { // Nature, Weight and volume only applies to products and not to services + if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + // Nature + print ''; + } + } + + if ($type != 1) { + if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + // Brut Weight + print ''; + } + + // Brut Length + if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + // Brut Surface + print ''; + } + if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + // Brut Volume + print ''; + } + + if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + // Net Measure + print ''; + } + } + + // Units + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + print ''; + print ''; + } + + // Custom code + if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) { + print ''; + + // Origin country + print ''; + print ''; + + // State + if (empty($conf->global->PRODUCT_DISABLE_STATE)) { + print ''; + if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + print ''; + } + } + + // Quality control + if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + print ''; + print ''; + } + + // Other attributes + $parameters = array('colspan' => ' colspan="2"', 'cols'=>2); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'create', $parameters); + } + + // Note (private, no output on invoices, propales...) + //if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode + //{ + print '"; + //} + + if (isModEnabled('categorie')) { + // Categories + print '"; + } + + print '
'.$langs->trans("ProductAccountancySellCode").''; - if ($type == 0) { - $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_ACCOUNT")); - } else { - $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); - print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - if ($type == 0) { - $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT")); - } else { - $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + if ($type == $object::TYPE_SERVICE && isModEnabled("workstation")) { + // Default workstation + print '
'.$langs->trans("DefaultWorkstation").''; + print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); + print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); print '
'.$langs->trans("ProductAccountancySellExportCode").''; - if ($type == 0) { - $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT")); - } else { - $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); - print '
'.$langs->trans("Duration").''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); + print ''; + print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOST('duration_value', 'alpha') : 'h'), 0, 1); - // Accountancy_code_buy - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - if ($type == 0) { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_ACCOUNT")); - } else { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_SERVICE_BUY_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); - print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; - if ($type == 0) { - $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT")); - } else { - $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); - print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; - if ($type == 0) { - $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT")); - } else { - $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT")); - } - print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); - print '
'.$langs->trans("ProductAccountancySellCode").''; - print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - print '
'.$langs->trans("ProductAccountancySellExportCode").''; - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; - print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; + print $formproduct->selectProductNature('finished', $object->finished); + print '
'.$langs->trans("Weight").''; + print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); + print ''; + print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print img_picto('', 'fa-ruler', 'class="pictofixedwidth"'); + print ' x '; + print ' x '; + print ''; + print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2); + print '
'.$langs->trans("Surface").''; + print ''; + print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2); + print '
'.$langs->trans("Volume").''; + print ''; + print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2); + print '
'.$langs->trans("NetMeasure").''; + print ''; + print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); + print '
'.$langs->trans('DefaultUnitToShow').''; + print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, 'units'); + print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; + print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx maxwidth500'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print '
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; + } else { + print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; + } + + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state($object->state_id, $object->country_code); + print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'.$langs->trans("NoteNotVisibleOnBill").''; + + // 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('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%'); + $doleditor->Create(); + + print "
'.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print "
'; + + print '
'; + + if (empty($conf->global->PRODUCT_DISABLE_PRICES)) { + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + // We do no show price array on create when multiprices enabled. + // We must set them on prices tab. + print ''; + // VAT + print ''; + + print '
'.$langs->trans("VATRate").''; + $defaultva = get_default_tva($mysoc, $mysoc); + print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); + print '
'; + + print '
'; + } else { + print ''; + + // Price + print ''; + print ''; + + // Min price + print ''; + print ''; + + // VAT + print ''; + + print '
'.$langs->trans("SellingPrice").''; + print $form->selectPriceBaseType($conf->global->PRODUCT_PRICE_BASE_TYPE, "price_base_type"); + print '
'.$langs->trans("MinPrice").''; + print '
'.$langs->trans("VATRate").''; + $defaultva = get_default_tva($mysoc, $mysoc); + print $form->load_tva("tva_tx", $defaultva, $mysoc, $mysoc, 0, 0, '', false, 1); + print '
'; + + print '
'; + } + } + + // Accountancy codes + print ''."\n"; + print ''; + + if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + if (isModEnabled('accounting')) { + // Accountancy_code_sell + print ''; + print ''; + + // Accountancy_code_sell_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_sell_export + print ''; + print ''; + + // Accountancy_code_buy + print ''; + print ''; + + // Accountancy_code_buy_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_buy_export + print ''; + print ''; + } else {// For external software + if (!empty($accountancy_code_sell)) { + $object->accountancy_code_sell = $accountancy_code_sell; + } + if (!empty($accountancy_code_sell_intra)) { + $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; + } + if (!empty($accountancy_code_sell_export)) { + $object->accountancy_code_sell_export = $accountancy_code_sell_export; + } + if (!empty($accountancy_code_buy)) { + $object->accountancy_code_buy = $accountancy_code_buy; + } + if (!empty($accountancy_code_buy_intra)) { + $object->accountancy_code_buy_intra = $accountancy_code_buy_intra; + } + if (!empty($accountancy_code_buy_export)) { + $object->accountancy_code_buy_export = $accountancy_code_buy_export; + } + + // Accountancy_code_sell + print ''; + print ''; + + // Accountancy_code_sell_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_sell_export + print ''; + print ''; + + // Accountancy_code_buy + print ''; + print ''; + + // Accountancy_code_buy_intra + if ($mysoc->isInEEC()) { + print ''; + print ''; + } + + // Accountancy_code_buy_export + print ''; + print ''; + } + } + print '
'.$langs->trans("ProductAccountancySellCode").''; + if ($type == 0) { + $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_ACCOUNT")); + } else { + $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancySellIntraCode").''; + if ($type == 0) { + $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT")); + } else { + $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancySellExportCode").''; + if ($type == 0) { + $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT")); + } else { + $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + if ($type == 0) { + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_ACCOUNT")); + } else { + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_SERVICE_BUY_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; + if ($type == 0) { + $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT")); + } else { + $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + if ($type == 0) { + $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT")); + } else { + $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT")); + } + print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print '
'.$langs->trans("ProductAccountancySellCode").''; + print '
'.$langs->trans("ProductAccountancySellIntraCode").''; + print '
'.$langs->trans("ProductAccountancySellExportCode").''; + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; + print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + print '
'; } - print ''; print dol_get_fiche_end(); From bd2fe307cda9e5e16939797e13b1f8656d3a4da5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 20:58:15 +0100 Subject: [PATCH 159/323] add hook tabContentCreateSupplierProposal (#26433) Co-authored-by: Christophe Battarel --- htdocs/supplier_proposal/card.php | 448 +++++++++++++++--------------- 1 file changed, 227 insertions(+), 221 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1bdbacf434e..13820292dc3 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1254,236 +1254,242 @@ if ($action == 'create') { print dol_get_fiche_head(); - print ''; - - // Reference - print ''; - - // Third party - print ''; - print ''; - if ($socid > 0) { - print ''; - } else { - print ''; - } - print ''."\n"; - - if ($soc->id > 0) { - // Discounts for third party - print ''; - } - - // Terms of payment - print ''; - - // Mode of payment - print ''; - - // Bank Account - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { - print ''; - } - - // Shipping Method - if (isModEnabled("expedition")) { - print ''; - } - - // Delivery date (or manufacturing) - print ''; - print ''; - - - // Model - print ''; - print ''; - print '"; - - // Project - if (isModEnabled('project')) { - $langs->load("projects"); - - $formproject = new FormProjets($db); - - if ($origin == 'project') { - $projectid = ($originid ? $originid : 0); - } - - print ''; - print ''; - print ''; - } - - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters = array('colspan' => ' colspan="3"', 'cols' => 3); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Call Hook tabContentCreateSupplierProposal + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateSupplierProposal', $parameters, $object, $action); if (empty($reshook)) { - print $object->showOptionals($extrafields, 'create', $parameters); - } + print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('Supplier').''; - print $soc->getNomUrl(1, 'supplier'); - print ''; - print ''; - $filter = '((s.fournisseur:=:1) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company((empty($socid) ? '' : $socid), 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); - // reload page to retrieve customer informations - if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { - print ''; - } - print ' '; - print '
'.$langs->trans('Discounts').''; - - $absolute_discount = $soc->getAvailableDiscounts('', '', 0, 1); - - $thirdparty = $soc; - $discount_type = 1; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); - print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank', 'class="pictofixedwidth"'); - $form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); - print '
'.$langs->trans('BankAccount').''; - $form->select_comptes(GETPOST('fk_account') > 0 ? GETPOST('fk_account', 'int') : $fk_account, 'fk_account', 0, '', 1); - print '
'.$langs->trans('SendingMethod').''; - print img_picto('', 'dolly', 'class="pictofixedwidth"'); - $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : "", 'shipping_method_id', '', 1); - print '
'.$langs->trans("DeliveryDate").''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - $datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty - $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - print $form->selectDate($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); - } else { - print $form->selectDate($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); - } - print '
'.$langs->trans("DefaultModel").''; - print img_picto('', 'pdf', 'class="pictofixedwidth"'); - $list = ModelePDFSupplierProposal::liste_modeles($db); - $preselected = (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT) ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT : $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF); - print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', '', 1); - print "
'.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); - print '   id).'">'; - - print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print img_picto('', 'currency', 'class="pictofixedwidth"'); - print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); - print '
'; + // Reference + print ''; - // Lines from source - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { - // TODO for compatibility - if ($origin == 'contrat') { - // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva - //$objectsrc->remise_absolue = $remise_absolue; - //$objectsrc->remise_percent = $remise_percent; - $objectsrc->update_price(1, 'auto', 1); - } - - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; - - print ''; - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 - print '"; - } - print '"; - - if (isModEnabled("multicurrency")) { - print ''; - print '"; - print '"; - } - } - - print "
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('CommRequest').''.$objectsrc->getNomUrl(1).'
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
\n"; - - - /* - * Combobox for copy function - */ - - if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { - print ''; - } - - if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { - print '
'; - - // For backward compatibility + // Third party print ''; - print ''; - print ''; - print ''; + if ($socid > 0) { + print ''; } else { - dol_print_error($db); + print ''; + } + print ''."\n"; + + if ($soc->id > 0) { + // Discounts for third party + print ''; + } + + // Terms of payment + print ''; + + // Mode of payment + print ''; + + // Bank Account + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { + print ''; + } + + // Shipping Method + if (isModEnabled("expedition")) { + print ''; + } + + // Delivery date (or manufacturing) + print ''; + print ''; - print ''; - print ''; - } - if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { - print '
'.$langs->trans("CopyAskFrom").' '; - $liste_ask = array(); - $liste_ask [0] = ''; - - $sql = "SELECT p.rowid as id, p.ref, s.nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal p"; - $sql .= ", ".MAIN_DB_PREFIX."societe s"; - $sql .= " WHERE s.rowid = p.fk_soc"; - $sql .= " AND p.entityy IN (".getEntity('supplier_proposal').")"; - $sql .= " AND p.fk_statut <> ".SupplierProposal::STATUS_DRAFT; - $sql .= " ORDER BY Id"; - - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) { - $row = $db->fetch_row($resql); - $askPriceSupplierRefAndSocName = $row[1]." - ".$row[2]; - $liste_ask[$row[0]] = $askPriceSupplierRefAndSocName; - $i++; - } - print $form->selectarray("copie_supplier_proposal", $liste_ask, 0); + print ''.$langs->trans('Supplier').''; + print $soc->getNomUrl(1, 'supplier'); + print ''; + print ''; + $filter = '((s.fournisseur:=:1) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company((empty($socid) ? '' : $socid), 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx'); + // reload page to retrieve customer informations + if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { + print ''; + } + print ' '; + print '
'.$langs->trans('Discounts').''; + + $absolute_discount = $soc->getAvailableDiscounts('', '', 0, 1); + + $thirdparty = $soc; + $discount_type = 1; + $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + print $form->getSelectConditionsPaiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + $form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); + print '
'.$langs->trans('BankAccount').''; + $form->select_comptes(GETPOST('fk_account') > 0 ? GETPOST('fk_account', 'int') : $fk_account, 'fk_account', 0, '', 1); + print '
'.$langs->trans('SendingMethod').''; + print img_picto('', 'dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : "", 'shipping_method_id', '', 1); + print '
'.$langs->trans("DeliveryDate").''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + $datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); + if (is_numeric(getDolGlobalString('DATE_LIVRAISON_WEEK_DELAY'))) { // If value set to 0 or a num, not empty + $tmpdte = time() + (7 * getDolGlobalInt('DATE_LIVRAISON_WEEK_DELAY') * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + print $form->selectDate($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); + } else { + print $form->selectDate($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); } print '
'.$langs->trans("CreateEmptyAsk").'
'; + // Model + print ''; + print ''.$langs->trans("DefaultModel").''; + print ''; + print img_picto('', 'pdf', 'class="pictofixedwidth"'); + $list = ModelePDFSupplierProposal::liste_modeles($db); + $preselected = (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT) ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT : $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF); + print $form->selectarray('model', $list, $preselected, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print ""; + + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + + $formproject = new FormProjets($db); + + if ($origin == 'project') { + $projectid = ($originid ? $originid : 0); + } + + print ''; + print ''.$langs->trans("Project").''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print '   id).'">'; + + print ''; + print ''; + } + + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print ''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); + print ''; + } + + // Other attributes + $parameters = array('colspan' => ' colspan="3"', 'cols' => 3); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'create', $parameters); + } + + + // Lines from source + if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + // TODO for compatibility + if ($origin == 'contrat') { + // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva + //$objectsrc->remise_absolue = $remise_absolue; + //$objectsrc->remise_percent = $remise_percent; + $objectsrc->update_price(1, 'auto', 1); + } + + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + + print ''.$langs->trans('CommRequest').''.$objectsrc->getNomUrl(1).''; + print ''.$langs->trans('AmountHT').''.price($objectsrc->total_ht).''; + print ''.$langs->trans('AmountVAT').''.price($objectsrc->total_tva).""; + if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { // Localtax1 + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1).""; + } + + if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { // Localtax2 + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2).""; + } + print ''.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc).""; + + if (isModEnabled("multicurrency")) { + print ''.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).''; + print ''.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva).""; + print ''.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc).""; + } + } + + print "\n"; + + + /* + * Combobox for copy function + */ + + if (empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { + print ''; + } + + if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { + print '
'; + + // For backward compatibility + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + } + + if (!empty($conf->global->SUPPLIER_PROPOSAL_CLONE_ON_CREATE_PAGE)) { + print '
'.$langs->trans("CopyAskFrom").' '; + $liste_ask = array(); + $liste_ask [0] = ''; + + $sql = "SELECT p.rowid as id, p.ref, s.nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal p"; + $sql .= ", ".MAIN_DB_PREFIX."societe s"; + $sql .= " WHERE s.rowid = p.fk_soc"; + $sql .= " AND p.entityy IN (".getEntity('supplier_proposal').")"; + $sql .= " AND p.fk_statut <> ".SupplierProposal::STATUS_DRAFT; + $sql .= " ORDER BY Id"; + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $row = $db->fetch_row($resql); + $askPriceSupplierRefAndSocName = $row[1]." - ".$row[2]; + $liste_ask[$row[0]] = $askPriceSupplierRefAndSocName; + $i++; + } + print $form->selectarray("copie_supplier_proposal", $liste_ask, 0); + } else { + dol_print_error($db); + } + print '
'.$langs->trans("CreateEmptyAsk").'
'; + } } print dol_get_fiche_end(); From 975b49b2692b756afed4042ae943a7aef1b1e15c Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 20:58:24 +0100 Subject: [PATCH 160/323] add hook tabContentViewSupplierProposal (#26432) Co-authored-by: Christophe Battarel --- htdocs/supplier_proposal/card.php | 541 +++++++++++++++--------------- 1 file changed, 273 insertions(+), 268 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 13820292dc3..84df1cf5e60 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1634,315 +1634,320 @@ if ($action == 'create') { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + // Call Hook tabContentViewSupplierProposal + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentViewSupplierProposal', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; + print '
'; - print '
'; - print '
'; - print '
'; + print ''; - print '
'; + // Relative and absolute discounts + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } else { + $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')"; + $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; + } - // Relative and absolute discounts - if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { - $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - } else { - $filterabsolutediscount = "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')"; - $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS PAID)%')"; - } + print ''; - print ''; + // Payment term + print ''; + print ''; - // Payment term - print ''; - print ''; + // Delivery date + $langs->load('deliveries'); + print ''; + print ''; - // Delivery date - $langs->load('deliveries'); - print ''; - print ''; - - // Payment mode - print ''; - print ''; - - // Multicurrency - if (isModEnabled("multicurrency")) { - // Multicurrency code + // Payment mode print ''; print ''; - // Multicurrency rate - if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + // Multicurrency + if (isModEnabled("multicurrency")) { + // Multicurrency code print ''; print ''; - } - } - /* Not for supplier proposals - if ($soc->outstanding_limit) { - // Outstanding Bill - print ''; - print ''; - }*/ - - if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { - // Bank Account - print ''; - print ''; - } - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'.$langs->trans('Discounts').''; - print '
'.$langs->trans('Discounts').''; + $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); + $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote, 0, 1); + $absolute_discount = price2num($absolute_discount, 'MT'); + $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount, 0, 1); - $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote, 0, 1); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + $thirdparty = $soc; + $discount_type = 1; + $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - $thirdparty = $soc; - $discount_type = 1; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + print '
'; + print ''; + if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { + print ''; + } + print '
'; + print $langs->trans('PaymentConditionsShort'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'
'; + print '
'; + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); + } else { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1); + } + print '
'; - print ''; - if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { - print ''; - } - print '
'; - print $langs->trans('PaymentConditionsShort'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'
'; - print '
'; - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 1); - } - print '
'; + print ''; + if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { + print ''; + } + print '
'; + print $langs->trans('DeliveryDate'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'
'; + print '
'; + if ($action == 'editdate_livraison') { + print '
'; + print ''; + print ''; + print ''; + print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); + print ''; + print '
'; + } else { + print dol_print_date($object->delivery_date, 'daytext'); + } + print '
'; - print ''; - if ($action != 'editdate_livraison' && $object->statut == SupplierProposal::STATUS_VALIDATED) { - print ''; - } - print '
'; - print $langs->trans('DeliveryDate'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1).'
'; - print '
'; - if ($action == 'editdate_livraison') { - print '
'; - print ''; - print ''; - print ''; - print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); - print ''; - print '
'; - } else { - print dol_print_date($object->delivery_date, 'daytext'); - } - print '
'; - print ''; - if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { - print ''; - } - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; - print '
'; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print '
'; print ''; - if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED) { - print ''; + if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) { + print ''; } print '
'; - print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); + print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; print '
'; - if ($action == 'editmulticurrencycode') { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); } else { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print '
'; print ''; - if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print ''; + if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_VALIDATED) { + print ''; } print '
'; - print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); + print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; print '
'; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if ($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + if ($action == 'editmulticurrencycode') { + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; - } + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); } print '
'; - print $langs->trans('OutstandingBill'); - print ''; - $arrayoutstandingbills = $soc->getOutstandingBills('supplier'); - $outstandingBills = $arrayoutstandingbills['opened']; - print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); - print '
'; - print ''; - if ($action != 'editbankaccount' && $usercancreate) { - print ''; - } - print '
'; - print $langs->trans('BankAccount'); - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; - print '
'; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); - } - print '
'; - - print '
'; - print '
'; - print '
'; - - print ''; - - print ''; - // Amount HT - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount HT - print ''; - } - print ''; - - print ''; - // Amount VAT - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount VAT - print ''; - } - print ''; - - // Amount Local Taxes - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; + // Multicurrency rate + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; } + } + + /* Not for supplier proposals + if ($soc->outstanding_limit) { + // Outstanding Bill + print ''; + print ''; + }*/ + + if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && isModEnabled("banque")) { + // Bank Account + print ''; print ''; } - } - print ''; - // Amount TTC - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - // Multicurrency Amount TTC - print ''; - } - print ''; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; + print ''; + if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_VALIDATED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print ''; + } + print '
'; + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; + print '
'; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if ($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } + } + print '
'; + print $langs->trans('OutstandingBill'); + print ''; + $arrayoutstandingbills = $soc->getOutstandingBills('supplier'); + $outstandingBills = $arrayoutstandingbills['opened']; + print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); + print '
'; + print ''; + if ($action != 'editbankaccount' && $usercancreate) { + print ''; + } + print '
'; + print $langs->trans('BankAccount'); + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; + print '
'; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; + print ''; - // Margin Infos - /*if (isModEnabled('margin')) { - $formmargin->displayMarginInfos($object); - }*/ + print '
'; + print '
'; + print '
'; - print '
'; - print '
'; + print ''; - print '

'; - - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - /* - * Lines - */ - - // Show object lines - $result = $object->getLinesArray(); - - print ' - - - - - - '; - - if (!empty($conf->use_javascript_ajax) && $object->statut == SupplierProposal::STATUS_DRAFT) { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - print '
'; - - // Add free products/services form - global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; - $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; - $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty. - if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) { - $senderissupplier = 1; - } - - if (!empty($object->lines)) { - $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); - } - - // Form to add new line - if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) { - if ($action != 'editline') { - // Add products/services form - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine($dateSelector, $soc, $mysoc); + print ''; + // Amount HT + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount HT + print ''; } - } + print ''; - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - print '
'; - print "\n"; + print ''; + // Amount VAT + print '' . $langs->trans('AmountVAT') . ''; + print '' . price($object->total_tva, '', $langs, 0, -1, -1, $conf->currency) . ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount VAT + print '' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . ''; + } + print ''; + + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { + print ''; + print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ''; + print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $conf->currency) . ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print '' . price($object->total_localtax1, '', $langs, 0, -1, -1, $object->multicurrency_code) . ''; + } + print ''; + + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { + print ''; + print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ''; + print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $conf->currency) . ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print '' . price($object->total_localtax2, '', $langs, 0, -1, -1, $object->multicurrency_code) . ''; + } + print ''; + } + } + + print ''; + // Amount TTC + print '' . $langs->trans('AmountTTC') . ''; + print '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + // Multicurrency Amount TTC + print '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . ''; + } + print ''; + + print ''; + + // Margin Infos + /*if (isModEnabled('margin')) { + $formmargin->displayMarginInfos($object); + }*/ + + print '
'; + print '
'; + + print '

'; + + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + /* + * Lines + */ + + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + + '; + + if (!empty($conf->use_javascript_ajax) && $object->statut == SupplierProposal::STATUS_DRAFT) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + print ''; + + // Add free products/services form + global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; + $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; + $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty. + if (!empty($conf->global->SUPPLIER_PROPOSAL_WITH_PREDEFINED_PRICES_ONLY)) { + $senderissupplier = 1; + } + + if (!empty($object->lines)) { + $object->printObjectLines($action, $soc, $mysoc, $lineid, $dateSelector); + } + + // Form to add new line + if ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) { + if ($action != 'editline') { + // Add products/services form + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine($dateSelector, $soc, $mysoc); + } + } + + print '
'; + print '
'; + print "
\n"; + } print dol_get_fiche_end(); From 12ae62b2afc6d61c455d2ffd062977729da87805 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 20:58:33 +0100 Subject: [PATCH 161/323] NEW : add hook tabContentViewSupplierInvoice (#26431) * add hook tabContentViewSupplierInvoice * wrong hook name --------- Co-authored-by: Christophe Battarel --- htdocs/fourn/facture/card.php | 1356 +++++++++++++++++---------------- 1 file changed, 681 insertions(+), 675 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2c8c02d2a66..c5addee05b2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3189,751 +3189,757 @@ if ($action == 'create') { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + // Call Hook tabContentViewSupplierInvoice + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentViewSupplierInvoice', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Type - print ''; + if (isset($objectidnext) && $objectidnext > 0) { + $facthatreplace = new FactureFournisseur($db); - - // Relative and absolute discounts - print ''."\n"; - print ''; - - // Label - print ''; - print ''; - print ''; - print ''; - - //$form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate && ($object->getSommePaiement() <= 0); - $form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate; - - // Date - print ''; - - // Default terms of the settlement - $langs->load('bills'); - print '"; - print ''; - - // Due date - print ''; - - // Mode of payment - $langs->load('bills'); - print ''; - - // Multicurrency - if (isModEnabled("multicurrency")) { - // Multicurrency code - print ''; - print ''; - // Multicurrency rate - if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { - print ''; - print ''; - } - } - // Bank Account - if (isModEnabled("banque")) { + // Relative and absolute discounts + print ''."\n"; + print ''; + + // Label + print ''; + print ''; + print ''; + print ''; + + //$form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate && ($object->getSommePaiement() <= 0); + $form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate; + + // Date + print ''; + + // Default terms of the settlement + $langs->load('bills'); print '
'.$langs->trans('Type').''; - print ''; - print $object->getLibType(); - print $object->getSubtypeLabel('facture_fourn'); - print ''; - if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) { - $facreplaced = new FactureFournisseur($db); - $facreplaced->fetch($object->fk_facture_source); - print ' '.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).''; - } - if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { - if ($object->fk_facture_source > 0) { - $facusing = new FactureFournisseur($db); - $facusing->fetch($object->fk_facture_source); - print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).''; - } else { - $langs->load("errors"); - print ' '.$langs->transnoentities("WarningCorrectedInvoiceNotFound").''; - } - } - - $facidavoir = $object->getListIdAvoirFromInvoice(); - if (count($facidavoir) > 0) { - $invoicecredits = array(); - foreach ($facidavoir as $id) { - $facavoir = new FactureFournisseur($db); - $facavoir->fetch($id); - $invoicecredits[] = $facavoir->getNomUrl(1); - } - print ' '.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); + // Type + print '
'.$langs->trans('Type').''; + print ''; + print $object->getLibType(); + print $object->getSubtypeLabel('facture_fourn'); print ''; - } - if (isset($objectidnext) && $objectidnext > 0) { - $facthatreplace = new FactureFournisseur($db); - - $facthatreplace->fetch($objectidnext); - print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).''; - } - if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { - $discount = new DiscountAbsolute($db); - $result = $discount->fetch(0, 0, $object->id); - if ($result > 0) { - print ' '; - $s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}'); - $s = str_replace('{s1}', $object->getLibType(1), $s); - $s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s); - print $s; - print '
'; + if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) { + $facreplaced = new FactureFournisseur($db); + $facreplaced->fetch($object->fk_facture_source); + print ' '.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).''; + } + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { + if ($object->fk_facture_source > 0) { + $facusing = new FactureFournisseur($db); + $facusing->fetch($object->fk_facture_source); + print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).''; + } else { + $langs->load("errors"); + print ' '.$langs->transnoentities("WarningCorrectedInvoiceNotFound").''; + } } - } - if ($object->fk_fac_rec_source > 0) { - $tmptemplate = new FactureFournisseurRec($db); - $result = $tmptemplate->fetch($object->fk_fac_rec_source); - if ($result > 0) { - print ' '; - $link = ''.dol_escape_htmltag($tmptemplate->titre).''; - $s = $langs->transnoentities("GeneratedFromSupplierTemplate", $link); - - print $s; + $facidavoir = $object->getListIdAvoirFromInvoice(); + if (count($facidavoir) > 0) { + $invoicecredits = array(); + foreach ($facidavoir as $id) { + $facavoir = new FactureFournisseur($db); + $facavoir->fetch($id); + $invoicecredits[] = $facavoir->getNomUrl(1); + } + print ' '.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); print ''; } - } - print '
'.$langs->trans('DiscountStillRemaining'); - print ''; - - $thirdparty = $societe; - $discount_type = 1; - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'.$form->editfieldkey("Label", 'label', $object->label, $object, $usercancreate).''.$form->editfieldval("Label", 'label', $object->label, $object, $usercancreate).'
'; - print $form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker'); - print ''; - print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker'); - print '
'; - print ''; - } - print '
'; - print $langs->trans('PaymentConditions'); - print ''; - if ($action != 'editconditions' && $form_permission) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; - print '
'; - if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); - } - print "
'; - print $form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); - print ''; - print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); - if ($action != 'editdate_lim_reglement' && $object->hasDelay()) { - print img_warning($langs->trans('Late')); - } - print '
'; - print ''; - if ($action != 'editmode' && $form_permission) { - print ''; - } - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; - print '
'; - if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print '
'; - print ''; - if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { - print ''; + $facthatreplace->fetch($objectidnext); + print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).''; } - print '
'; - print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; - print '
'; - if ($action == 'editmulticurrencycode') { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); - } else { - $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, 0, $object->id); + if ($result > 0) { + print ' '; + $s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}'); + $s = str_replace('{s1}', $object->getLibType(1), $s); + $s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s); + print $s; + print '
'; + } + } + + if ($object->fk_fac_rec_source > 0) { + $tmptemplate = new FactureFournisseurRec($db); + $result = $tmptemplate->fetch($object->fk_fac_rec_source); + if ($result > 0) { + print ' '; + $link = ''.dol_escape_htmltag($tmptemplate->titre).''; + $s = $langs->transnoentities("GeneratedFromSupplierTemplate", $link); + + print $s; + print ''; + } } print '
'; - print ''; - if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print ''; - } - print '
'; - print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; - print '
'; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if ($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); - } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; - } - } - print '
'.$langs->trans('DiscountStillRemaining'); + print ''; + + $thirdparty = $societe; + $discount_type = 1; + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$form->editfieldkey("Label", 'label', $object->label, $object, $usercancreate).''.$form->editfieldval("Label", 'label', $object->label, $object, $usercancreate).'
'; + print $form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker'); + print ''; + print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker'); + print '
'; - print '"; print ''; - } - // Vat reverse-charge by default - if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + // Due date + print ''; + + // Mode of payment + $langs->load('bills'); print ''; - } - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - } + // Multicurrency + if (isModEnabled("multicurrency")) { + // Multicurrency code + print ''; + print ''; - // Intracomm report - if (isModEnabled('intracommreport')) { - $langs->loadLangs(array("intracommreport")); - print ''; - print ''; - } - - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; - print $langs->trans('BankAccount'); + print ''; + if ($action != 'editconditions' && $form_permission) { + print ''; } print '
'; + print $langs->trans('PaymentConditions'); print ''; - if ($action != 'editbankaccount' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; - if ($action == 'editbankaccount') { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + if ($action == 'editconditions') { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); } else { - $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); } print "
'; + print $form->editfieldkey("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); + print ''; + print $form->editfieldval("DateMaxPayment", 'date_lim_reglement', $object->date_echeance, $object, $form_permission, 'datepicker'); + if ($action != 'editdate_lim_reglement' && $object->hasDelay()) { + print img_warning($langs->trans('Late')); + } + print '
'; - print ''; + print '
'; - print $langs->trans('VATReverseCharge'); - print ''; - if ($action != 'editvatreversecharge' && $usercancreate) { - print 'id.'">'.img_edit($langs->trans('SetVATReverseCharge'), 1).'
'; + if ($action != 'editmode' && $form_permission) { + print ''; } print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print '
'; - if ($action == 'editvatreversecharge') { - print '
'; - print ''; - print ''; - - print 'vat_reverse_charge == '1' ? ' checked ' : '') . '>'; - - print ''; - print '
'; + if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1); } else { - print 'vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>'; + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print '
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($usercancreate) { - print ''.img_edit().''; - } else { - print ' '; - } - print '
'; - print '
'; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); - } - print '
'; + print ''; + if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT) { + print ''; + } + print '
'; + print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; + print '
'; + if ($action == 'editmulticurrencycode') { + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'multicurrency_code'); + } else { + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, 'none'); + } + print '
'; - print ''; - if ($action != 'edittransportmode' && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))) { - print ''; - } - print '
'; - print $langs->trans('IntracommReportTransportMode'); - print 'id.'">'.img_edit().'
'; - print '
'; - if ($action == 'edittransportmode') { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1); - } else { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none'); - } - print '
'; - print ''; - - print '
'; - print '
'; - - print ''; - - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - - if ($societe->localtax1_assuj == "1") { //Localtax1 - print ''; - print ''; - print ''; - print ''; - } - if ($societe->localtax2_assuj == "1") { //Localtax2 - print ''; - print ''; - print ''; - print ''; - } - - print ''; - print ''; - print ''; - if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { - print ''; - } - print ''; - - print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . ''; - if (GETPOST('calculationrule')) { - $calculationrule = GETPOST('calculationrule', 'alpha'); - } else { - $calculationrule = (empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND) ? 'totalofround' : 'roundoftotal'); - } - if ($calculationrule == 'totalofround') { - $calculationrulenum = 1; - } else { - $calculationrulenum = 2; - } - // Show link for "recalculate" - if ($object->getVentilExportCompta() == 0) { - $s = '' . $langs->trans("ReCalculate") . ' '; - $s .= '' . $langs->trans("Mode1") . ''; - $s .= ' / '; - $s .= '' . $langs->trans("Mode2") . ''; - print '
'; - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '
' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); - print '       '; - print '
'; - } - print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency); - print '
' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $societe->country_code) . '' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $societe->country_code) . '' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; - - - // List of payments - - $totalpaid = 0; - - $sign = 1; - if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { - $sign = - 1; - } - - $nbrows = 9; $nbcols = 3; - if (isModEnabled('project')) { - $nbrows++; - } - if (isModEnabled("banque")) { - $nbrows++; $nbcols++; - } - if (isModEnabled('incoterm')) { - $nbrows++; - } - if (isModEnabled("multicurrency")) { - $nbrows += 5; - } - - // Local taxes - if ($societe->localtax1_assuj == "1") { - $nbrows++; - } - if ($societe->localtax2_assuj == "1") { - $nbrows++; - } - - $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,'; - $sql .= ' c.id as payment_type, c.code as payment_code,'; - $sql .= ' pf.amount,'; - $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid'; - $sql .= ' WHERE pf.fk_facturefourn = '.((int) $object->id); - $sql .= ' ORDER BY p.datep, p.tms'; - - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (isModEnabled("banque")) { - print ''; - } - print ''; - print ''; - print ''; - - if ($num > 0) { - while ($i < $num) { - $objp = $db->fetch_object($result); - - $paymentstatic->id = $objp->rowid; - $paymentstatic->datepaye = $db->jdate($objp->dp); - $paymentstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); - $paymentstatic->num_payment = $objp->num_payment; - - $paymentstatic->paiementcode = $objp->payment_code; - $paymentstatic->type_code = $objp->payment_code; - $paymentstatic->type_label = $objp->payment_type; - - print ''; - print ''; + print ''; + } + } - print '"; + print ''; + } + + // Vat reverse-charge by default + if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + } + + // Intracomm report + if (isModEnabled('intracommreport')) { + $langs->loadLangs(array("intracommreport")); + print ''; + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; - print $paymentstatic->getNomUrl(1); + // Multicurrency rate + if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print '
'; + print ''; - print ''; - $s = $form->form_modes_reglement(null, $objp->payment_type, 'none', '', 1, 0, '', 1).' '.$objp->num_payment; - print ''; - if (isModEnabled("banque")) { - $bankaccountstatic->id = $objp->baid; - $bankaccountstatic->ref = $objp->baref; - $bankaccountstatic->label = $objp->baref; - $bankaccountstatic->number = $objp->banumber; - - if (isModEnabled('accounting')) { - $bankaccountstatic->account_number = $objp->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->fk_accountancy_journal); - $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print ''; + } + print '
'; + print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''.dol_print_date($db->jdate($objp->dp), 'day').''; - print $s; - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; + print '
'; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if ($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } + } + print '
'; - if ($objp->baid > 0) { - print $bankaccountstatic->getNomUrl(1, 'transactions'); + // Bank Account + if (isModEnabled("banque")) { + print '
'; + print ''; + } + print '
'; + print $langs->trans('BankAccount'); + print ''; + if ($action != 'editbankaccount' && $usercancreate) { + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; + print '
'; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print "
'; + print ''; + } + print '
'; + print $langs->trans('VATReverseCharge'); + print ''; + if ($action != 'editvatreversecharge' && $usercancreate) { + print 'id.'">'.img_edit($langs->trans('SetVATReverseCharge'), 1).'
'; + print '
'; + if ($action == 'editvatreversecharge') { + print '
'; + print ''; + print ''; + + print 'vat_reverse_charge == '1' ? ' checked ' : '') . '>'; + + print ''; + print '
'; + } else { + print 'vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>'; + } + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($usercancreate) { + print ''.img_edit().''; + } else { + print ' '; + } + print '
'; + print '
'; + if ($action != 'editincoterm') { + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); + } else { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print '
'; + print ''; + if ($action != 'edittransportmode' && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))) { + print ''; + } + print '
'; + print $langs->trans('IntracommReportTransportMode'); + print 'id.'">'.img_edit().'
'; + print '
'; + if ($action == 'edittransportmode') { + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1, 1); + } else { + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?id='.$object->id, $object->transport_mode_id, 'none'); + } + print '
'; + print '
'; + + print '
'; + print '
'; + + print ''; + + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print ''; + } + print ''; + + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print ''; + } + print ''; + + if ($societe->localtax1_assuj == "1") { //Localtax1 + print ''; + print ''; + print ''; + print ''; + } + if ($societe->localtax2_assuj == "1") { //Localtax2 + print ''; + print ''; + print ''; + print ''; + } + + print ''; + print ''; + print ''; + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + print ''; + } + print ''; + + print '
' . $langs->trans('AmountHT') . '' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->trans('AmountVAT') . ''; + if (GETPOST('calculationrule')) { + $calculationrule = GETPOST('calculationrule', 'alpha'); + } else { + $calculationrule = (empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND) ? 'totalofround' : 'roundoftotal'); + } + if ($calculationrule == 'totalofround') { + $calculationrulenum = 1; + } else { + $calculationrulenum = 2; + } + // Show link for "recalculate" + if ($object->getVentilExportCompta() == 0) { + $s = '' . $langs->trans("ReCalculate") . ' '; + $s .= '' . $langs->trans("Mode1") . ''; + $s .= ' / '; + $s .= '' . $langs->trans("Mode2") . ''; + print '
'; + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '
' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); + print '       '; + print '
'; + } + print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency); + print '
' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
' . $langs->transcountry("AmountLT1", $societe->country_code) . '' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $societe->country_code) . '' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '
' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '
'; + + + // List of payments + + $totalpaid = 0; + + $sign = 1; + if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) { + $sign = - 1; + } + + $nbrows = 9; $nbcols = 3; + if (isModEnabled('project')) { + $nbrows++; + } + if (isModEnabled("banque")) { + $nbrows++; $nbcols++; + } + if (isModEnabled('incoterm')) { + $nbrows++; + } + if (isModEnabled("multicurrency")) { + $nbrows += 5; + } + + // Local taxes + if ($societe->localtax1_assuj == "1") { + $nbrows++; + } + if ($societe->localtax2_assuj == "1") { + $nbrows++; + } + + $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,'; + $sql .= ' c.id as payment_type, c.code as payment_code,'; + $sql .= ' pf.amount,'; + $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid'; + $sql .= ' WHERE pf.fk_facturefourn = '.((int) $object->id); + $sql .= ' ORDER BY p.datep, p.tms'; + + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i = 0; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + if (isModEnabled("banque")) { + print ''; + } + print ''; + print ''; + print ''; + + if ($num > 0) { + while ($i < $num) { + $objp = $db->fetch_object($result); + + $paymentstatic->id = $objp->rowid; + $paymentstatic->datepaye = $db->jdate($objp->dp); + $paymentstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); + $paymentstatic->num_payment = $objp->num_payment; + + $paymentstatic->paiementcode = $objp->payment_code; + $paymentstatic->type_code = $objp->payment_code; + $paymentstatic->type_label = $objp->payment_type; + + print ''; + print ''; + print ''; + $s = $form->form_modes_reglement(null, $objp->payment_type, 'none', '', 1, 0, '', 1).' '.$objp->num_payment; + print ''; + if (isModEnabled("banque")) { + $bankaccountstatic->id = $objp->baid; + $bankaccountstatic->ref = $objp->baref; + $bankaccountstatic->label = $objp->baref; + $bankaccountstatic->number = $objp->banumber; + + if (isModEnabled('accounting')) { + $bankaccountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->fk_accountancy_journal); + $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + + print ''; + } + print ''; + print ''; + print ''; + $totalpaid += $objp->amount; + $i++; } - print ''; - print ''; - print ''; - $totalpaid += $objp->amount; - $i++; + } else { + print ''; } - } else { - print ''; - } - /* - if ($object->paye == 0) - { - print ''; - print ''; + /* + if ($object->paye == 0) + { + print ''; + print ''; - $resteapayer = $object->total_ttc - $totalpaid; + $resteapayer = $object->total_ttc - $totalpaid; - print ''; - print ''; - } - */ - - $db->free($result); - } else { - dol_print_error($db); - } - - if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { - // Total already paid - print ''; - - //$resteapayer = $object->total_ttc - $totalpaid; - $resteapayeraffiche = $resteapayer; - - $cssforamountpaymentcomplete = 'amountpaymentcomplete'; - - // Loop on each credit note or deposit amount applied - $creditnoteamount = 0; - $depositamount = 0; - - $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; - $sql .= " re.description, re.fk_invoice_supplier_source"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re"; - $sql .= " WHERE fk_invoice_supplier = ".((int) $object->id); - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - $invoice = new FactureFournisseur($db); - while ($i < $num) { - $obj = $db->fetch_object($resql); - $invoice->fetch($obj->fk_invoice_supplier_source); - print ''; - print ''; - print ''; - $i++; - if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { - $creditnoteamount += $obj->amount_ttc; - } - if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) { - $depositamount += $obj->amount_ttc; - } + print ''; + print ''; } + */ + + $db->free($result); } else { dol_print_error($db); } - // Paye partiellement 'escompte' - if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { - print ''; - $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = 'amountpaymentneutral'; - } - // Paye partiellement ou Abandon 'badsupplier' - if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { - print ''; - // $resteapayeraffiche=0; - $cssforamountpaymentcomplete = 'amountpaymentneutral'; - } - // Paye partiellement ou Abandon 'product_returned' - if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { - print ''; - $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = 'amountpaymentneutral'; - } - // Paye partiellement ou Abandon 'abandon' - if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { - print ''; - $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = 'amountpaymentneutral'; - } - - // Billed - print ''; - - // Remainder to pay - print ''; - print ''; - - // Remainder to pay Multicurrency - if (isModEnabled('multicurreny') && $object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { + // Total already paid print ''; + + //$resteapayer = $object->total_ttc - $totalpaid; + $resteapayeraffiche = $resteapayer; + + $cssforamountpaymentcomplete = 'amountpaymentcomplete'; + + // Loop on each credit note or deposit amount applied + $creditnoteamount = 0; + $depositamount = 0; + + $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; + $sql .= " re.description, re.fk_invoice_supplier_source"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re"; + $sql .= " WHERE fk_invoice_supplier = ".((int) $object->id); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $invoice = new FactureFournisseur($db); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $invoice->fetch($obj->fk_invoice_supplier_source); + print ''; + print ''; + print ''; + $i++; + if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { + $creditnoteamount += $obj->amount_ttc; + } + if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) { + $depositamount += $obj->amount_ttc; + } + } + } else { + dol_print_error($db); + } + + // Paye partiellement 'escompte' + if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; + } + // Paye partiellement ou Abandon 'badsupplier' + if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { + print ''; + // $resteapayeraffiche=0; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; + } + // Paye partiellement ou Abandon 'product_returned' + if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; + } + // Paye partiellement ou Abandon 'abandon' + if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { + print ''; + $resteapayeraffiche = 0; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; + } + + // Billed + print ''; + + // Remainder to pay + print ''; - print ''; - } - } else { // Credit note - $cssforamountpaymentcomplete = 'amountpaymentneutral'; + print ''; - // Total already paid back - print ''; + // Remainder to pay Multicurrency + if (isModEnabled('multicurreny') && $object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + } + } else { // Credit note + $cssforamountpaymentcomplete = 'amountpaymentneutral'; - // Billed - print ''; + // Total already paid back + print ''; - // Remainder to pay back - print ''; - print ''; - print ''; + // Billed + print ''; - // Remainder to pay back Multicurrency - if (isModEnabled('multicurreny') && $object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + // Remainder to pay back print ''; - print ''; + print ''; + print ''; + + // Remainder to pay back Multicurrency + if (isModEnabled('multicurreny') && $object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) { + print ''; + print ''; + } + + // Sold credit note + // print ''; + // print ''; } - // Sold credit note - // print ''; - // print ''; - } + print '
'.($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').''.$langs->trans('Amount').' 
'; + print $paymentstatic->getNomUrl(1); + print ''.dol_print_date($db->jdate($objp->dp), 'day').''; + print $s; + print ''; + if ($objp->baid > 0) { + print $bankaccountstatic->getNomUrl(1, 'transactions'); + } + print ''.price($sign * $objp->amount).''; + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { + print 'rowid.'">'; + print img_delete(); + print ''; } print '
'.price($sign * $objp->amount).''; - if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { - print 'rowid.'">'; - print img_delete(); - print ''; - } - print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'.$langs->trans('AlreadyPaid').' :'.price($totalpaid).'
'.$langs->trans("Billed").' :'.price($object->total_ttc).'
'.$langs->trans('AlreadyPaid').' :'.price($totalpaid).'
'.$langs->trans("Billed").' :'.price($object->total_ttc).'
'.$langs->trans('RemainderToPay').' :'.price($resteapayer).'
'; - print ''; - if ($object->type != FactureFournisseur::TYPE_DEPOSIT) { - print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); - } else { - print $langs->trans('AlreadyPaid'); - } - print ''; - print ' 0) ? ' class="amountalreadypaid"' : '').'>'.price($totalpaid).' 
'; - if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { - print $langs->trans("CreditNote").' '; - } - if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) { - print $langs->trans("Deposit").' '; - } - print $invoice->getNomUrl(0); - print ' :'.price($obj->amount_ttc).''; - print 'rowid.'">'; - print img_picto($langs->transnoentitiesnoconv("RemoveDiscount"), 'unlink'); - print ''; - print '
'.$langs->trans('RemainderToPay').' :'.price($resteapayer).'
'; - print ''; - print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1); - print ''; - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; - print ''; - print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1); - print ''; - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; - print ''; - print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1); - print ''; - print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; - $text = $langs->trans("HelpAbandonOther"); - if ($object->close_note) { - $text .= '

'.$langs->trans("Reason").':'.$object->close_note; - } - print ''; - print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1); - print ''; - print '
'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; - print ''; - print $langs->trans("Billed"); - print ''; - print ''.price($object->total_ttc).' 
'; - print ''; - print $langs->trans('RemainderToPay'); - if ($resteapayeraffiche < 0) { - print ' ('.$langs->trans('NegativeIfExcessPaid').')'; - } - print ''; - print ''.price($resteapayeraffiche).' 
'; print ''; - print $langs->trans('RemainderToPayMulticurrency'); + if ($object->type != FactureFournisseur::TYPE_DEPOSIT) { + print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); + } else { + print $langs->trans('AlreadyPaid'); + } + print ''; + print ' 0) ? ' class="amountalreadypaid"' : '').'>'.price($totalpaid).' 
'; + if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) { + print $langs->trans("CreditNote").' '; + } + if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) { + print $langs->trans("Deposit").' '; + } + print $invoice->getNomUrl(0); + print ' :'.price($obj->amount_ttc).''; + print 'rowid.'">'; + print img_picto($langs->transnoentitiesnoconv("RemoveDiscount"), 'unlink'); + print ''; + print '
'; + print ''; + print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1); + print ''; + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; + print ''; + print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1); + print ''; + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; + print ''; + print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1); + print ''; + print ''.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; + $text = $langs->trans("HelpAbandonOther"); + if ($object->close_note) { + $text .= '

'.$langs->trans("Reason").':'.$object->close_note; + } + print ''; + print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1); + print ''; + print '
'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid).' 
'; + print ''; + print $langs->trans("Billed"); + print ''; + print ''.price($object->total_ttc).' 
'; + print ''; + print $langs->trans('RemainderToPay'); if ($resteapayeraffiche < 0) { print ' ('.$langs->trans('NegativeIfExcessPaid').')'; } print ''; print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($multicurrency_resteapayer, 'MT')).' 
'.price($resteapayeraffiche).' 
'; - print $langs->trans('AlreadyPaidBack'); - print ' :'.price($sign * $totalpaid).' 
'; + print ''; + print $langs->trans('RemainderToPayMulticurrency'); + if ($resteapayeraffiche < 0) { + print ' ('.$langs->trans('NegativeIfExcessPaid').')'; + } + print ''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($multicurrency_resteapayer, 'MT')).' 
'.$langs->trans("Billed").' :'.price($sign * $object->total_ttc).' 
'; + print $langs->trans('AlreadyPaidBack'); + print ' :'.price($sign * $totalpaid).' 
'; - print ''; - print $langs->trans('RemainderToPayBack'); - if ($resteapayeraffiche > 0) { - print ' ('.$langs->trans('NegativeIfExcessRefunded').')'; - } - print ''.price($sign * $resteapayeraffiche).' 
'.$langs->trans("Billed").' :'.price($sign * $object->total_ttc).' 
'; print ''; - print $langs->trans('RemainderToPayBackMulticurrency'); - if ($resteapayeraffiche> 0) { + print $langs->trans('RemainderToPayBack'); + if ($resteapayeraffiche > 0) { print ' ('.$langs->trans('NegativeIfExcessRefunded').')'; } - print ''; print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($sign * $object->multicurrency_tx * $resteapayeraffiche, 'MT')).' 
'.price($sign * $resteapayeraffiche).' 
'; + print ''; + print $langs->trans('RemainderToPayBackMulticurrency'); + if ($resteapayeraffiche> 0) { + print ' ('.$langs->trans('NegativeIfExcessRefunded').')'; + } + print ''; + print ''.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($sign * $object->multicurrency_tx * $resteapayeraffiche, 'MT')).' 
'.$langs->trans('TotalTTC').' :'.price($sign * + // $object->total_ttc).' 
'.$langs->trans('TotalTTC').' :'.price($sign * - // $object->total_ttc).' 
'; + print '
'; - print '
'; - print '
'; + print '
'; + print '
'; - print '
'; - print '
'; + print '

'; - print '

'; - - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { - $colwidth = 20; - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - } - - - /* - * Lines - */ - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - if (!empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) { - include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; - } - - print '
'; - print ''; - - global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; - $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; - $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. - //if (!empty($conf->global->SUPPLIER_INVOICE_WITH_NOPRICEDEFINED)) $senderissupplier=2; - if (!empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY)) { - $senderissupplier = 1; - } - - // Show object lines (result may vary according to hidden option MAIN_NO_INPUT_PRICE_WITH_TAX) - if (!empty($object->lines)) { - $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); - } - - $num = count($object->lines); - - // Form to add new line - if ($object->statut == FactureFournisseur::STATUS_DRAFT && $usercancreate) { - if ($action != 'editline') { - // Add free products/services - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) - $object->formAddObjectLine(1, $societe, $mysoc); + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; } - } - print '
'; - print '
'; - print '
'; + if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + $colwidth = 20; + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; + } + + + /* + * Lines + */ + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + if (!empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + print ''; + + global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax; + $forceall = 1; $dateSelector = 0; $inputalsopricewithtax = 1; + $senderissupplier = 2; // $senderissupplier=2 is same than 1 but disable test on minimum qty and disable autofill qty with minimum. + //if (!empty($conf->global->SUPPLIER_INVOICE_WITH_NOPRICEDEFINED)) $senderissupplier=2; + if (!empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY)) { + $senderissupplier = 1; + } + + // Show object lines (result may vary according to hidden option MAIN_NO_INPUT_PRICE_WITH_TAX) + if (!empty($object->lines)) { + $object->printObjectLines($action, $societe, $mysoc, $lineid, 1); + } + + $num = count($object->lines); + + // Form to add new line + if ($object->statut == FactureFournisseur::STATUS_DRAFT && $usercancreate) { + if ($action != 'editline') { + // Add free products/services + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if (empty($reshook)) + $object->formAddObjectLine(1, $societe, $mysoc); + } + } + + print '
'; + print '
'; + print '
'; + } print dol_get_fiche_end(); From 8f54413a69e157344354b504c32de2cebdb4b34a Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Fri, 3 Nov 2023 20:58:49 +0100 Subject: [PATCH 162/323] add hook tabContentCreateSupplierInvoice (#26430) Co-authored-by: Christophe Battarel --- htdocs/fourn/facture/card.php | 1068 +++++++++++++++++---------------- 1 file changed, 537 insertions(+), 531 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c5addee05b2..e6fdf22ff3b 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2235,571 +2235,577 @@ if ($action == 'create') { print dol_get_fiche_head(); - print ''; + // Call Hook tabContentCreateSupplierInvoice + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateSupplierInvoice', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - // Ref - print ''; + // Ref + print ''; - $exampletemplateinvoice = new FactureFournisseurRec($db); - $invoice_predefined = new FactureFournisseurRec($db); - if (empty($origin) && empty($originid) && $fac_recid > 0) { - $invoice_predefined->fetch($fac_recid); - } + $exampletemplateinvoice = new FactureFournisseurRec($db); + $invoice_predefined = new FactureFournisseurRec($db); + if (empty($origin) && empty($originid) && $fac_recid > 0) { + $invoice_predefined->fetch($fac_recid); + } - // Third party - print ''; - print ''; + print ''; + + // Overwrite some values if creation of invoice is from a predefined invoice + if (empty($origin) && empty($originid) && $fac_recid > 0) { + $invoice_predefined->fetch($fac_recid); + + $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later + if (empty($projectid)) { + $projectid = $invoice_predefined->fk_project; + } + $cond_reglement_id = $invoice_predefined->cond_reglement_id; + $mode_reglement_id = $invoice_predefined->mode_reglement_id; + $fk_account = $invoice_predefined->fk_account; + $note_public = $invoice_predefined->note_public; + $note_private = $invoice_predefined->note_private; + + if (!empty($invoice_predefined->multicurrency_code)) { + $currency_code = $invoice_predefined->multicurrency_code; + } + if (!empty($invoice_predefined->multicurrency_tx)) { + $currency_tx = $invoice_predefined->multicurrency_tx; + } + + $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r'; + $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid; + + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + + if ($num > 0) { + print ''; + } + $db->free($resql); + } else { + dol_print_error($db); + } + } + + // Ref supplier + print ''; + print ''; + + print ''; - - // Overwrite some values if creation of invoice is from a predefined invoice - if (empty($origin) && empty($originid) && $fac_recid > 0) { - $invoice_predefined->fetch($fac_recid); - - $dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later - if (empty($projectid)) { - $projectid = $invoice_predefined->fk_project; - } - $cond_reglement_id = $invoice_predefined->cond_reglement_id; - $mode_reglement_id = $invoice_predefined->mode_reglement_id; - $fk_account = $invoice_predefined->fk_account; - $note_public = $invoice_predefined->note_public; - $note_private = $invoice_predefined->note_private; - - if (!empty($invoice_predefined->multicurrency_code)) { - $currency_code = $invoice_predefined->multicurrency_code; - } - if (!empty($invoice_predefined->multicurrency_tx)) { - $currency_tx = $invoice_predefined->multicurrency_tx; - } - - $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r'; - $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid; - - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - if ($num > 0) { - print ''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); + print $desc; + print ''; } - $db->free($resql); - } else { - dol_print_error($db); } - } - - // Ref supplier - print ''; - print ''; - - print ''; + + + // Invoice Subtype + if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { + print ''; + } + + if (!empty($societe->id) && $societe->id > 0) { + // Discounts for third party + print ''; + } + + // Label + print ''; + + // Date invoice + print ''; + + // Payment term + print ''; + + // Due date + print ''; + + // Payment mode + print ''; + + // Bank Account + if (isModEnabled("banque")) { + print ''; + } + + // Project + if (isModEnabled('project')) { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + print ''; + } + + // Vat reverse-charge by default + if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; + print ''; - - - // Invoice Subtype - if (getDolGlobalInt('INVOICE_SUBTYPE_ENABLED')) { - print ''; - } - - if (!empty($societe->id) && $societe->id > 0) { - // Discounts for third party - print ''; - } - - // Label - print ''; - - // Date invoice - print ''; - - // Payment term - print ''; - - // Due date - print ''; - - // Payment mode - print ''; - - // Bank Account - if (isModEnabled("banque")) { - print ''; - } - - // Project - if (isModEnabled('project')) { - $formproject = new FormProjets($db); - - $langs->load('projects'); - print ''; - } - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - print ''; - } - - // Vat reverse-charge by default - if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; - print ''; } - print ''; - print ''; - } - - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''; - print ''; - } - - // Help of substitution key - $htmltext = ''; - if ($fac_recid > 0) { - $dateexample = $newdateinvoice ? $newdateinvoice : $dateinvoice; - if (empty($dateexample)) { - $dateexample = dol_now(); - } - $substitutionarray = array( - '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', - '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', - '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')', - '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')', - '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')', - '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')', - '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')', - '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', - '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', - '__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', - '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')' - ); - - $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; - foreach ($substitutionarray as $key => $val) { - $htmltext .= $key.' = '.$langs->trans($val).'
'; - } - $htmltext .= '
'; - } - - // Intracomm report - if (isModEnabled('intracommreport')) { - $langs->loadLangs(array("intracommreport")); - print ''; - } - - if (empty($reshook)) { - print $object->showOptionals($extrafields, 'create'); - } - - // Public note - print ''; - print ''; - // print ''; - print ''; - - // Private note - print ''; - print ''; - // print ''; - print ''; - - - if (!empty($objectsrc) && is_object($objectsrc)) { - print "\n"; - print "\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; - - $txt = $langs->trans($classname); - if ($classname == 'CommandeFournisseur') { - $langs->load('orders'); - $txt = $langs->trans("SupplierOrder"); - } - print ''; - print ''; - print '"; - if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { //Localtax1 - print '"; - } - - if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { //Localtax2 - print '"; - } - print '"; - + // Multicurrency if (isModEnabled("multicurrency")) { - print ''; - print '"; - print '"; + print ''; + print ''; + print ''; } + + // Help of substitution key + $htmltext = ''; + if ($fac_recid > 0) { + $dateexample = $newdateinvoice ? $newdateinvoice : $dateinvoice; + if (empty($dateexample)) { + $dateexample = dol_now(); + } + $substitutionarray = array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')', + '__INVOICE_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach ($substitutionarray as $key => $val) { + $htmltext .= $key.' = '.$langs->trans($val).'
'; + } + $htmltext .= '
'; + } + + // Intracomm report + if (isModEnabled('intracommreport')) { + $langs->loadLangs(array("intracommreport")); + print ''; + } + + if (empty($reshook)) { + print $object->showOptionals($extrafields, 'create'); + } + + // Public note + print ''; + print ''; + // print ''; + print ''; + + // Private note + print ''; + print ''; + // print ''; + print ''; + + + if (!empty($objectsrc) && is_object($objectsrc)) { + print "\n"; + print "\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + + $txt = $langs->trans($classname); + if ($classname == 'CommandeFournisseur') { + $langs->load('orders'); + $txt = $langs->trans("SupplierOrder"); + } + print ''; + print ''; + print '"; + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { //Localtax1 + print '"; + } + + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { //Localtax2 + print '"; + } + print '"; + + if (isModEnabled("multicurrency")) { + print ''; + print '"; + print '"; + } + } + + // Other options + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + + print "
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Supplier').''; + // Third party + print '
'.$langs->trans('Supplier').''; - if (!empty($societe->id) && $societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) { - $absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1); - print $societe->getNomUrl(1, 'supplier'); - print ''; - } else { - $filter = '((s.fournisseur:=:1) AND (s.status:=:1))'; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500'); - // reload page to retrieve supplier informations - if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) { - print ''; + } + if ($fac_recid <= 0) { + print ' '; + } + } + print '
'.$langs->trans('CreateFromRepeatableInvoice').''; + //print ''; + print ''; + // Option to reload page to retrieve customer informations. Note, this clear other input + if (empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED)) { + print ''; + } + print '
'.$langs->trans('RefSupplier').'id) && $societe->id > 0) { + print ' autofocus'; + } + print '>
'.$langs->trans('Type').''; + + print '
'."\n"; + + // Standard invoice + print '
'; + $tmp = ' '; + $desc = $form->textwithpicto($tmp.'', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + + if (empty($origin) || ($origin == 'order_supplier' && !empty($originid))) { + // Deposit - Down payment + if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { + print '
'; + $tmp=' '; + print ''; + + $tmp = $tmp.''; + $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); + print ''; + print ''; + if ($origin == 'order_supplier') { + print ''; + print ''; + } + print '
'; + print $desc; + print ''; + $arraylist = array( + 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), + 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), + 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') + ); + print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); + print ''; + print ''.$langs->trans("AmountOrPercent").''; + print '
'; + + print '
'; + } + } + + /* Not yet supported for supplier + if ($societe->id > 0) + { + // Replacement + if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + { + // Type invoice + $facids = $facturestatic->list_replacable_supplier_invoices($societe->id); + if ($facids < 0) { + dol_print_error($db, $facturestatic->error, $facturestatic->errors); + exit(); + } + $options = ""; + foreach ($facids as $facparam) + { + $options .= ''; + } + + print ''; + print '
'; + $tmp=' + jQuery(document).ready(function() { + jQuery("#fac_replacement").change(function() { + jQuery("#radio_replacement").prop("checked", true); }); }); '; - } - if ($fac_recid <= 0) { - print ' '; - } - } - print '
'.$langs->trans('CreateFromRepeatableInvoice').''; - //print ''; - print 'trans("NoReplacableInvoice") . ''; } - print ''; - // Option to reload page to retrieve customer informations. Note, this clear other input - if (empty($conf->global->RELOAD_PAGE_ON_TEMPLATE_CHANGE_DISABLED)) { - print ''; - } - print '
'.$langs->trans('RefSupplier').'id) && $societe->id > 0) { - print ' autofocus'; - } - print '>
'.$langs->trans('Type').''; - - print '
'."\n"; - - // Standard invoice - print '
'; - $tmp = ' '; - $desc = $form->textwithpicto($tmp.'', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; - - if (empty($origin) || ($origin == 'order_supplier' && !empty($originid))) { - // Deposit - Down payment - if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { - print '
'; - $tmp=' '; - print ''; - - $tmp = $tmp.''; - $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3); - print ''; - print ''; - if ($origin == 'order_supplier') { - print ''; - print ''; - } - print '
'; - print $desc; - print ''; - $arraylist = array( - 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), - 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')), - 'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines') - ); - print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); - print ''; - print ''.$langs->trans("AmountOrPercent").''; - print '
'; - - print '
'; - } - } - - /* Not yet supported for supplier - if ($societe->id > 0) - { - // Replacement - if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT)) + else { - // Type invoice - $facids = $facturestatic->list_replacable_supplier_invoices($societe->id); - if ($facids < 0) { - dol_print_error($db, $facturestatic->error, $facturestatic->errors); - exit(); - } - $options = ""; - foreach ($facids as $facparam) - { - $options .= ''; - } - - print ''; print '
'; - $tmp=' - jQuery(document).ready(function() { - jQuery("#fac_replacement").change(function() { - jQuery("#radio_replacement").prop("checked", true); - }); - }); - '; - $text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' '; - $text .= ''; + $tmp=' '; + $text = $tmp.$langs->trans("InvoiceReplacement") . ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; } - } - else - { - print '
'; - $tmp=' '; - $text = $tmp.$langs->trans("InvoiceReplacement") . ' '; - $text.= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; - } - */ + */ - if (empty($origin)) { - if (!empty($societe->id) && $societe->id > 0) { - // Credit note - if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) { - // Show link for credit note - $facids = $facturestatic->list_qualified_avoir_supplier_invoices($societe->id); - if ($facids < 0) { - dol_print_error($db, $facturestatic->error, $facturestatic->errors); - exit; - } - $optionsav = ""; - $newinvoice_static = new FactureFournisseur($db); - foreach ($facids as $key => $valarray) { - $newinvoice_static->id = $key; - $newinvoice_static->ref = $valarray ['ref']; - $newinvoice_static->statut = $valarray ['status']; - $newinvoice_static->type = $valarray ['type']; - $newinvoice_static->paye = $valarray ['paye']; - - $optionsav .= ''; - } + $optionsav = ""; + $newinvoice_static = new FactureFournisseur($db); + foreach ($facids as $key => $valarray) { + $newinvoice_static->id = $key; + $newinvoice_static->ref = $valarray ['ref']; + $newinvoice_static->statut = $valarray ['status']; + $newinvoice_static->type = $valarray ['type']; + $newinvoice_static->paye = $valarray ['paye']; + $optionsav .= ''; + } + + print '
'; + $tmp = 'global->INVOICE_CREDIT_NOTE_STANDALONE)) { + $tmp .= ' disabled'; + } + $tmp .= '> '; + // Show credit note options only if we checked credit note + print ''; + $text = $tmp.' '; + // $text.=''; + $text .= ''; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); + print $desc; + + print '
'; + print '    0 ? 'checked' : '').' /> '; + print '"; + print '
    0 ? 'checked' : '').' /> '; + print '"; + print '
'; + + print '
'; + } + } else { print '
'; - $tmp = 'global->INVOICE_CREDIT_NOTE_STANDALONE)) { - $tmp .= ' disabled'; - } - $tmp .= '> '; - // Show credit note options only if we checked credit note - print ''; - $text = $tmp.' '; - // $text.=''; - $text .= ' '; } else { - $text .= ''; + $tmp=' '; } - $text .= ''; + $text = $tmp.$langs->trans("InvoiceAvoir").' '; + $text .= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); print $desc; - - print '
'; - print '    0 ? 'checked' : '').' /> '; - print '"; - print '
    0 ? 'checked' : '').' /> '; - print '"; - print '
'; - - print '
'; + print '
'."\n"; } - } else { - print '
'; - if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) { - $tmp = ' '; + } + + print '
'; + + print '
'.$langs->trans('InvoiceSubtype').''; + print $form->getSelectInvoiceSubtype(GETPOST('subtype'), 'subtype', 1, 0, ''); + print '
'.$langs->trans('Discounts').''; + + $thirdparty = $societe; + $discount_type = 1; + $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$societe->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); + include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; + + print '
'.$langs->trans('Label').'
'.$langs->trans('DateInvoice').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($dateinvoice, '', '', '', '', "add", 1, 1); + print '
'.$langs->trans('PaymentConditionsShort').''; + print img_picto('', 'payment', 'class="pictofixedwidth"'); + print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1); + + print '
'.$langs->trans('DateMaxPayment').''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); + $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'DBIT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans('BankAccount').''; + // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print '
'.$langs->trans('Project').''; + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print ' id) ? $soc->id : 0).($fac_recid > 0 ? '&fac_rec='.$fac_recid : '')).'">'; + print '
'; + print img_picto('', 'incoterm', 'class="pictofixedwidth"'); + print $form->select_incoterms(GETPOSTISSET('incoterm_id') ? GETPOST('incoterm_id', 'alphanohtml') : (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), GETPOSTISSET('location_incoterms') ? GETPOST('location_incoterms', 'alphanohtml') : (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : '')); + print '
' . $langs->trans('VATReverseCharge') . ''; + // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed + if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) { + $vat_reverse_charge = 1; } else { - $tmp=' '; + $vat_reverse_charge = 0; } - $text = $tmp.$langs->trans("InvoiceAvoir").' '; - $text .= '('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3); - print $desc; - print ''."\n"; - } - } - print ''; - - print '
'.$langs->trans('InvoiceSubtype').''; - print $form->getSelectInvoiceSubtype(GETPOST('subtype'), 'subtype', 1, 0, ''); - print '
'.$langs->trans('Discounts').''; - - $thirdparty = $societe; - $discount_type = 1; - $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$societe->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid')); - include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php'; - - print '
'.$langs->trans('Label').'
'.$langs->trans('DateInvoice').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($dateinvoice, '', '', '', '', "add", 1, 1); - print '
'.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', -1, 1); - - print '
'.$langs->trans('DateMaxPayment').''; - print img_picto('', 'action', 'class="pictofixedwidth"'); - print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); - print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank', 'class="pictofixedwidth"'); - $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'DBIT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('BankAccount').''; - // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); - print '
'.$langs->trans('Project').''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); - print ' id) ? $soc->id : 0).($fac_recid > 0 ? '&fac_rec='.$fac_recid : '')).'">'; - print '
'; - print img_picto('', 'incoterm', 'class="pictofixedwidth"'); - print $form->select_incoterms(GETPOSTISSET('incoterm_id') ? GETPOST('incoterm_id', 'alphanohtml') : (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), GETPOSTISSET('location_incoterms') ? GETPOST('location_incoterms', 'alphanohtml') : (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : '')); - print '
' . $langs->trans('VATReverseCharge') . ''; - // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed - if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) { - $vat_reverse_charge = 1; - } else { - $vat_reverse_charge = 0; + print ''; + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print img_picto('', 'currency', 'class="pictofixedwidth"'); - print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ?GETPOST('multicurrency_code', 'alpha') : $currency_code), 'multicurrency_code'); - print '
'.$langs->trans('IntracommReportTransportMode').''; - $form->selectTransportMode(GETPOSTISSET('transport_mode_id') ? GETPOST('transport_mode_id') : $transport_mode_id, 'transport_mode_id'); - print '
'.$langs->trans('NotePublic').''; - $doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'restricthtml') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - print '
'.$langs->trans('NotePrivate').''; - $doleditor = new DolEditor('note_private', (GETPOSTISSET('note_private') ?GETPOST('note_private', 'restricthtml') : $note_private), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); - print $doleditor->Create(1); - print '
'.$txt.''.$objectsrc->getNomUrl(1); - // We check if Origin document (id and type is known) has already at least one invoice attached to it - $objectsrc->fetchObjectLinked($originid, $origin, '', 'invoice_supplier'); - - $invoice_supplier = $objectsrc->linkedObjects['invoice_supplier']; - - // count function need a array as argument (Note: the array must implement Countable too) - if (is_array($invoice_supplier)) { - $cntinvoice = count($invoice_supplier); - - if ($cntinvoice >= 1) { - setEventMessages('WarningBillExist', null, 'warnings'); - echo ' ('.$langs->trans('LatestRelatedBill').end($invoice_supplier)->getNomUrl(1).')'; - } - } - - print '
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ?GETPOST('multicurrency_code', 'alpha') : $currency_code), 'multicurrency_code'); + print '
'.$langs->trans('IntracommReportTransportMode').''; + $form->selectTransportMode(GETPOSTISSET('transport_mode_id') ? GETPOST('transport_mode_id') : $transport_mode_id, 'transport_mode_id'); + print '
'.$langs->trans('NotePublic').''; + $doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'restricthtml') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + print '
'.$langs->trans('NotePrivate').''; + $doleditor = new DolEditor('note_private', (GETPOSTISSET('note_private') ?GETPOST('note_private', 'restricthtml') : $note_private), '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + print $doleditor->Create(1); + print '
'.$txt.''.$objectsrc->getNomUrl(1); + // We check if Origin document (id and type is known) has already at least one invoice attached to it + $objectsrc->fetchObjectLinked($originid, $origin, '', 'invoice_supplier'); + + $invoice_supplier = $objectsrc->linkedObjects['invoice_supplier']; + + // count function need a array as argument (Note: the array must implement Countable too) + if (is_array($invoice_supplier)) { + $cntinvoice = count($invoice_supplier); + + if ($cntinvoice >= 1) { + setEventMessages('WarningBillExist', null, 'warnings'); + echo ' ('.$langs->trans('LatestRelatedBill').end($invoice_supplier)->getNomUrl(1).')'; + } + } + + print '
'.$langs->trans('AmountHT').''.price($objectsrc->total_ht).'
'.$langs->trans('AmountVAT').''.price($objectsrc->total_tva)."
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($objectsrc->total_localtax1)."
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($objectsrc->total_localtax2)."
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
\n"; } - // Other options - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - - print "\n"; - print dol_get_fiche_end(); print $form->buttonsSaveCancel("CreateDraft"); From 51341524a26f68f0f84b8b4f9080279082742a1c Mon Sep 17 00:00:00 2001 From: thibdrev Date: Fri, 3 Nov 2023 22:51:51 +0100 Subject: [PATCH 163/323] fix missing 2 translation keys used in commande/list.php (#26458) * modify the translation keys in commande/list.php * create the error translation key in en_US/errors.lang * create the error translation key in fr_FR/errors.lang --- htdocs/commande/list.php | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 7391b304758..970a2045a9b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -718,9 +718,9 @@ if ($action == 'shipped' && $permissiontoadd) { if ($objecttmp->fetch($checked)) { if ($objecttmp->statut == 1 || $objecttmp->statut == 2) { if ($objecttmp->cloture($user)) { - setEventMessages($langs->trans('PassedInClosedStatus', $objecttmp->ref), null, 'mesgs'); + setEventMessages($langs->trans('StatusOrderDelivered', $objecttmp->ref), null, 'mesgs'); } else { - setEventMessages($langs->trans('CantBeClosed'), null, 'errors'); + setEventMessages($langs->trans('ErrorOrderStatusCantBeSetToDelivered'), null, 'errors'); $error++; } } else { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index c2bcdd614c0..51b550f9480 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -103,6 +103,7 @@ ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the ErrorNumRefModel=A reference exists into database (%s) and is not compatible with this numbering rule. Remove record or renamed reference to activate this module. ErrorQtyTooLowForThisSupplier=Quantity too low for this vendor or no price defined on this product for this vendor ErrorOrdersNotCreatedQtyTooLow=Some orders haven't been created because of too-low quantities +ErrorOrderStatusCantBeSetToDelivered=Order status can't be set to delivered. ErrorModuleSetupNotComplete=Setup of module %s looks to be uncomplete. Go on Home - Setup - Modules to complete. ErrorBadMask=Error on mask ErrorBadMaskFailedToLocatePosOfSequence=Error, mask without sequence number diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 2ae0f90bc67..1cecc490b36 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -103,6 +103,7 @@ ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est ErrorNumRefModel=Une référence existe en base (%s) et est incompatible avec cette numérotation. Supprimez la ligne ou renommez la référence pour activer ce module. ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur ErrorOrdersNotCreatedQtyTooLow=Certaines commandes n'ont pas été créées en raison de quantités trop faibles +ErrorOrderStatusCantBeSetToDelivered=La commande ne peut pas être classé livrée. ErrorModuleSetupNotComplete=La configuration du module %s semble incomplète. Aller sur la page Accueil - Configuration - Modules pour corriger. ErrorBadMask=Erreur sur le masque ErrorBadMaskFailedToLocatePosOfSequence=Erreur, masque sans numéro de séquence From 73524c2f815e7cd629ef8ac3a63172d0ee462fcf Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Fri, 3 Nov 2023 23:01:57 +0100 Subject: [PATCH 164/323] [modulebuilder] FIX handling of the $filter parameter in fetchAll() method (#25931) * FIX handling of the $filter parameter for fetchAll: the previous version can result in invalid SQL * Remove #[AllowDynamicProperties] attribute from Conf class (cf. PR #25931) * Ensure sql-building strings are detectably sanitized to avoid PR rejection --- htdocs/core/class/conf.class.php | 1 - .../template/class/myobject.class.php | 46 ++++++++++++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index c01a8e70367..b6e15e6e844 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -29,7 +29,6 @@ /** * Class to stock current configuration */ -#[AllowDynamicProperties] class Conf { /** diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 08f6a76764c..f4234e54944 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -438,7 +438,7 @@ class MyObject extends CommonObject * @param string $sortfield Sort field * @param int $limit limit * @param int $offset Offset - * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param array $filter Filter array. Example array('mystringfield'=>'value', 'myintfield'=>4, 'customsql'=>...) * @param string $filtermode Filter mode (AND or OR) * @return array|int int <0 if KO, array of pages if OK */ @@ -463,16 +463,40 @@ class MyObject extends CommonObject $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - if ($key == 't.rowid') { - $sqlwhere[] = $key." = ".((int) $value); - } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { - $sqlwhere[] = $key." = '".$this->db->idate($value)."'"; - } elseif ($key == 'customsql') { - $sqlwhere[] = $value; // For this case, $value never come from a user input but is a hard coded value in code - } elseif (strpos($value, '%') === false) { - $sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")"; - } else { - $sqlwhere[] = $key." LIKE '%".$this->db->escapeforlike($this->db->escape($value))."%'"; + $columnName = preg_replace('/^t\./', '', $key); + if ($key === 'customsql') { + // Never use 'customsql' with a value from user input since it is injected as is. The value must be hard coded. + $sqlwhere[] = $value; + continue; + } elseif (isset($this->fields[$columnName])) { + $type = $this->fields[$columnName]['type']; + if (preg_match('/^integer/', $type)) { + if (is_int($value)) { + // single value + $sqlwhere[] = $key . " = " . intval($value); + } elseif (is_array($value)) { + if (empty($value)) continue; + $sqlwhere[] = $key . ' IN (' . $this->db->sanitize(implode(',', array_map('intval', $value))) . ')'; + } + continue; + } elseif (in_array($type, array('date', 'datetime', 'timestamp'))) { + $sqlwhere[] = $key . " = '" . $this->db->idate($value) . "'"; + continue; + } + } + + // when the $key doesn't fall into the previously handled categories, we do as if the column were a varchar/text + if (is_array($value) && count($value)) { + $value = implode(',', array_map(function ($v) { + return "'" . $this->db->sanitize($this->db->escape($v)) . "'"; + }, $value)); + $sqlwhere[] = $key . ' IN (' . $this->db->sanitize($value, true) . ')'; + } elseif (is_scalar($value)) { + if (strpos($value, '%') === false) { + $sqlwhere[] = $key . " = '" . $this->db->sanitize($this->db->escape($value)) . "'"; + } else { + $sqlwhere[] = $key . " LIKE '%" . $this->db->escapeforlike($this->db->escape($value)) . "%'"; + } } } } From 93746a805ad95affae123b2af4ab88998a2287ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Nov 2023 13:02:18 +0100 Subject: [PATCH 165/323] Close #321 --- htdocs/public/members/new.php | 7 +++++-- htdocs/public/payment/newpayment.php | 10 ++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index dade87545c5..4b8b6d8b0aa 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -872,17 +872,20 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW $objp = $db->fetch_object($result); // Load the member type and information on it print ''; + // Label print ''.dol_escape_htmltag($objp->label).''; - print ''; + // Duration + print ''; $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); print max(1, intval($objp->duration)).' '.$units[$unit]; print ''; + // Amount print ''; $displayedamount = max(intval($objp->amount), intval(getDolGlobalInt("MEMBER_MIN_AMOUNT"))); $caneditamount = $objp->caneditamount; if ($objp->subscription) { if ($displayedamount > 0 || !$caneditamount) { - print $displayedamount.' '.strtoupper($conf->currency); + print price($displayedamount, 1, $langs, 1, 0, -1, $conf->currency); } if ($caneditamount && $displayedamount>0) { print $form->textwithpicto('', $langs->transnoentities("CanEditAmountShortForValues"), 1, 'help', '', 0, 3); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 27343c4c56c..0077e8d39f8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -919,10 +919,16 @@ if ($urllogo) { print ''; } print '
'; +} elseif ($creditor) { + print '
'; + print '
'; + print $creditor; + print '
'; + print '
'; } -if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) { +if (getDolGlobalString('MAIN_IMAGE_PUBLIC_PAYMENT')) { print '
'; - print ''; + print ''; print '
'; } From 2a2dec2f888da40d096d542826d5b8c8cbd40db6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Nov 2023 16:02:24 +0100 Subject: [PATCH 166/323] Debug v19 --- htdocs/bookcal/README.md | 4 +- htdocs/bookcal/availabilities_agenda.php | 14 +- htdocs/bookcal/calendar_agenda.php | 12 +- htdocs/bookcal/calendar_card.php | 45 +- htdocs/bookcal/class/availabilities.class.php | 6 +- htdocs/bookcal/class/calendar.class.php | 57 +- htdocs/bookcal/lib/bookcal_calendar.lib.php | 6 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/langs/en_US/bookcal.lang | 6 +- .../template/lib/mymodule_myobject.lib.php | 2 +- .../template/myobject_agenda.php | 9 +- htdocs/public/bookcal/booking.php | 588 ------------------ htdocs/public/bookcal/index.php | 484 ++++++++++++-- htdocs/public/payment/newpayment.php | 14 +- htdocs/theme/eldy/global.inc.php | 17 +- htdocs/theme/md/style.css.php | 17 +- 16 files changed, 518 insertions(+), 764 deletions(-) delete mode 100644 htdocs/public/bookcal/booking.php diff --git a/htdocs/bookcal/README.md b/htdocs/bookcal/README.md index 2077d7e1072..20e41a38217 100644 --- a/htdocs/bookcal/README.md +++ b/htdocs/bookcal/README.md @@ -1,8 +1,8 @@ -# BOOKCAL FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +# ONLINE APPOINTMENT FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) ## Features -Provide features to be able to record online booking. +Provides an online appointment booking system. This allow anyone to book rendez-vous, according to predefined ranges or availabilities. \n"; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); - if ($object->type == 'bank-transfer') { + print_liste_field_titre(($salaryBonPl ? "SalaryBill" : "Bill"), $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); + if ($object->type == 'bank-transfer' && !$salaryBonPl) { print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "f.ref_supplier", '', $param, '', $sortfield, $sortorder); } - print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("AmountInvoice", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre(($salaryBonPl ? "Employee" : "ThirdParty"), $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre(($salaryBonPl ? "AmountSalary": "AmountInvoice"), $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre(''); @@ -295,39 +308,47 @@ if ($resql) { $totalinvoices = 0; $totalamount_requested = 0; - $invoicetmpcustomer = new Facture($db); - $invoicetmpsupplier = new FactureFournisseur($db); + if ($salaryBonPl) { + $salarytmp = new Salary($db); + $usertmp = new User($db); + } else { + $invoicetmpcustomer = new Facture($db); + $invoicetmpsupplier = new FactureFournisseur($db); + } while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - - if ($obj->type == 'bank-transfer') { - $invoicetmp = $invoicetmpsupplier; + if ($salaryBonPl) { + $salarytmp->fetch($obj->salaryid); + $usertmp->fetch($obj->fk_user); } else { - $invoicetmp = $invoicetmpcustomer; + if ($obj->type == 'bank-transfer') { + $invoicetmp = $invoicetmpsupplier; + } else { + $invoicetmp = $invoicetmpcustomer; + } + $invoicetmp->fetch($obj->facid); + + $thirdpartytmp->fetch($obj->socid); } - $invoicetmp->fetch($obj->facid); - - $thirdpartytmp->fetch($obj->socid); - print ''; print '\n"; - if ($object->type == 'bank-transfer') { + if ($object->type == 'bank-transfer' && !$salaryBonPl) { print '\n"; } print '\n"; // Amount of invoice - print '\n"; + print '\n"; // Amount requested print '\n"; @@ -362,7 +383,7 @@ if ($resql) { if ($num > 0) { print ''; print ''; - if ($object->type == 'bank-transfer') { + if ($object->type == 'bank-transfer' && !$salaryBonPl) { print ''; } print ''; diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index bc81ee2bfbd..c0e4e81f87f 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -34,6 +34,7 @@ function prelevement_prepare_head(BonPrelevement $object) { global $langs, $conf, $user; + $salary = $object->checkIfSalaryBonPrelevement(); $langs->load("withdrawals"); $h = 0; @@ -50,7 +51,7 @@ function prelevement_prepare_head(BonPrelevement $object) $h++; $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id; - $head[$h][1] = $langs->trans("Bills"); + $head[$h][1] = ($salary <= 0 ? $langs->trans("Bills") : $langs->trans("Salaries")); $head[$h][2] = 'invoices'; $h++; @@ -104,3 +105,40 @@ function prelevement_check_config($type = 'direct-debit') } return 0; } + + /** + * Return array head with list of tabs to view object informations + * + * @param object $object Member + * @param int $nbOfInvoices No of invoices + * @param int $nbOfSalaryInvoice No of salary invoices + * @return array head + */ +function bon_prelevement_prepare_head(BonPrelevement $object, $nbOfInvoices, $nbOfSalaryInvoice) +{ + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer'; + $head[$h][1] = ($nbOfInvoices <= 0 ? $langs->trans("Invoices") : $langs->trans("Invoices").' '.$nbOfInvoices.''); + $head[$h][2] = 'invoice'; + $h++; + + // Salaries + + $head[$h][0] = DOL_URL_ROOT."/compta/prelevement/create.php?type=bank-transfer&sourcetype=salary"; + $head[$h][1] = ($nbOfSalaryInvoice <= 0 ? $langs->trans("Salaries") : $langs->trans("Salaries").' '.$nbOfSalaryInvoice.''); + $head[$h][2] = 'salary'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement'); + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'prelevement', 'remove'); + return $head; +} diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 7909773260f..689eb55910b 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -63,6 +63,11 @@ function salaries_prepare_head($object) $head[$h][2] = 'info'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id; + $head[$h][1] = $langs->trans("VirementOrder"); + $head[$h][2] = 'request_virement'; + $h++; + complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove'); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 4f0e1fed522..c602b54098e 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -641,4 +641,6 @@ MentionCategoryOfOperations=Category of operations MentionCategoryOfOperations0=Delivery of goods MentionCategoryOfOperations1=Provision of services MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services -InvoiceSubtype=Invoice Subtype +SalaryBill=Invoice salary +Salaries=Salaries +InvoiceSubtype=Invoice Subtype \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index df7dc2ac529..d9f071b5642 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1253,4 +1253,5 @@ ErrorFailedToDeleteLink= Failed to remove link '%s' ErrorFailedToUpdateLink= Failed to update link '%s' URLToLink=URL to link OverwriteIfExists=Overwrite if file exists +AmountSalary=Salary amount InvoiceSubtype=Invoice subtype diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index 0097e399d63..57720692c22 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -25,4 +25,9 @@ SalariesAndPayments=Salaries and payments ConfirmDeleteSalaryPayment=Do you want to delete this salary payment ? FillFieldFirst=Fill employee field first UpdateAmountWithLastSalary=Set amount of last salary -FillEndOfMonth=Fill with end of month \ No newline at end of file +MakeTransferRequest=Make transfer request +VirementOrder=Request virements +BankTransferAmount=Amount of bank transfer +WithdrawalReceipt=transfer order +OrderWaiting=Order waiting +FillEndOfMonth=Fill with end of month diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index fa16577d5a3..62a45034fac 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -163,3 +163,10 @@ WarningSomeDirectDebitOrdersAlreadyExists=Warning: There is already some pending WarningSomeCreditTransferAlreadyExists=Warning: There is already some pending Credit Transfer (%s) requested for an amount of %s UsedFor=Used for %s Societe_ribSigned=SEPA mandat Signed +NbOfInvoiceToPayByBankTransferForSalaries=No. of qualified salaries waiting for a payment by credit transfer +SalaryWaitingWithdraw=Salaries waiting for payment by credit transfer +RefSalary=Salary +SalaryInvoice=Salary invoice +NoSalaryInvoiceToWithdraw=No salary invoice with open '%s' is waiting. Go on tab '%s' on salary card to make a request. +SalaryInvoiceWaitingWithdraw=Salary invoice waiting for payment by credit transfer + diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 1feb9de40bb..234dbd4b86e 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -641,3 +641,5 @@ MentionCategoryOfOperations=Catégorie d'opérations MentionCategoryOfOperations0=Livraison de marchandises MentionCategoryOfOperations1=Prestation de services MentionCategoryOfOperations2=Mixte - Livraison de biens & prestation de services +SalaryBill=Facture salaire +Salaries=Salaires \ No newline at end of file diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 268519f3021..f80a85d16ff 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1240,3 +1240,4 @@ DateOfPrinting=Date d'impression ClickFullScreenEscapeToLeave=Cliquez ici pour passer en mode plein écran. Appuyez sur ÉCHAP pour quitter le mode plein écran. UserNotYetValid=Not yet valid UserExpired=Expiré +AmountSalary=Montant salaire diff --git a/htdocs/langs/fr_FR/salaries.lang b/htdocs/langs/fr_FR/salaries.lang index c39763133ff..917984f183a 100644 --- a/htdocs/langs/fr_FR/salaries.lang +++ b/htdocs/langs/fr_FR/salaries.lang @@ -25,4 +25,9 @@ SalariesAndPayments=Salaires et paiements ConfirmDeleteSalaryPayment=Voulez-vous supprimer ce paiement de salaire ? FillFieldFirst=Remplissez d'abord le champ de l'employé UpdateAmountWithLastSalary=Définir sur le montant du dernier salaire +MakeTransferRequest=Faire une demande de virement +VirementOrder=Ordres de virements +BankTransferAmount=Montant de la demande de virement : +WithdrawalReceipt=Ordre de virement +OrderWaiting=En attente de traitement FillEndOfMonth=Remplir avec la fin du mois diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index c2c6d4adf4a..66a4b255ef0 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -162,3 +162,10 @@ WarningSomeDirectDebitOrdersAlreadyExists=Attention : Il y a déjà des ordres WarningSomeCreditTransferAlreadyExists=Attention : Il y a déjà des virements en attente (%s) demandés pour un montant de %s UsedFor=Utilisé pour %s Societe_ribSigned=SEPA mandat signé +NbOfInvoiceToPayByBankTransferForSalaries=Nombre de salaires qualifiées en attente de paiement par virement +SalaryWaitingWithdraw=Salaire en attente de virement +RefSalary=Salarié +SalaryInvoice=Facture salarié +NoSalaryInvoiceToWithdraw=Aucune facture de salarié avec '%s' ouvert n'est en attente. Allez sur l'onglet '%s' sur la fiche de salaire pour faire une demande. +SalaryInvoiceWaitingWithdraw=Facture salarié en attente de paiement par virement bancaire + diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ffdf4b1ebb7..ab853ac9558 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -975,7 +975,6 @@ if ($id > 0) { $sql .= " AND p.fk_salary = salaire.rowid"; $sql .= " AND salaire.entity IN (".getEntity('tax').")"; $sql .= " ORDER BY dp DESC"; - //print $sql; $resql = $db->query($sql); if ($resql) { @@ -1107,6 +1106,9 @@ if ($id > 0) { print dolGetButtonAction('', $langs->trans('ClassifyPaid'), 'default', $_SERVER["PHP_SELF"].'?action=paid&token='.newToken().'&id='.$object->id, ''); } + //transfer request + print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id, ''); + // Clone if ($user->hasRight('salaries', 'write')) { print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id, ''); diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 0d7c814dd1c..9fab6254b7c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -792,4 +792,148 @@ class Salary extends CommonObject $return .= ''; return $return; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Create a withdrawal request for a direct debit order or a credit transfer order. + * Use the remain to pay excluding all existing open direct debit requests. + * + * @param User $fuser User asking the direct debit transfer + * @param float $amount Amount we request direct debit for + * @param string $type 'direct-debit' or 'bank-transfer' + * @param string $sourcetype Source ('facture' or 'supplier_invoice') + * @param int $checkduplicateamongall 0=Default (check among open requests only to find if request already exists). 1=Check also among requests completely processed and cancel if at least 1 request exists whatever is its status. + * @return int <0 if KO, 0 if a request already exists, >0 if OK + */ + public function demande_prelevement($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'salaire', $checkduplicateamongall = 0) + { + // phpcs:enable + global $conf; + + $error = 0; + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + if ($this->paye == 0) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $bac = new CompanyBankAccount($this->db); + $bac->fetch(0, $this->socid); + + $sql = "SELECT count(rowid) as nb"; + $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; + if ($type == 'salaire') { + $sql .= " WHERE fk_salary = ".((int) $this->id); + } else { + $sql .= " WHERE fk_facture = ".((int) $this->id); + } + $sql .= " AND type = 'ban'"; // To exclude record done for some online payments + if (empty($checkduplicateamongall)) { + $sql .= " AND traite = 0"; + } + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + if ($obj && $obj->nb == 0) { // If no request found yet + $now = dol_now(); + + $totalpaid = $this->getSommePaiement(); + // $totalcreditnotes = $this->getSumCreditNotesUsed(); + // $totaldeposits = $this->getSumDepositsUsed(); + //print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits; + + // We can also use bcadd to avoid pb with floating points + // For example print 239.2 - 229.3 - 9.9; does not return 0. + //$resteapayer=bcadd($this->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT); + //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); + // if (empty($amount)) { + // $amount = price2num($this->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); + // } + + if (is_numeric($amount) && $amount != 0) { + $sql = 'INSERT INTO '.$this->db->prefix().'prelevement_demande('; + if ($type == 'salaire') { + $sql .= 'fk_salary, '; + } else { + $sql .= 'fk_facture, '; + } + $sql .= ' amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib, sourcetype, type, entity)'; + $sql .= " VALUES (".((int) $this->id); + $sql .= ", ".((float) price2num($amount)); + $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", ".((int) $fuser->id); + $sql .= ", '".$this->db->escape($bac->code_banque)."'"; + $sql .= ", '".$this->db->escape($bac->code_guichet)."'"; + $sql .= ", '".$this->db->escape($bac->number)."'"; + $sql .= ", '".$this->db->escape($bac->cle_rib)."'"; + $sql .= ", '".$this->db->escape($sourcetype)."'"; + $sql .= ", 'ban'"; + $sql .= ", ".((int) $conf->entity); + $sql .= ")"; + + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::demandeprelevement Erreur'); + $error++; + } + } else { + $this->error = 'WithdrawRequestErrorNilAmount'; + dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount'); + $error++; + } + + if (!$error) { + // Force payment mode of invoice to withdraw + $payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1); + if ($payment_mode_id > 0) { + $result = $this->setPaymentMethods($payment_mode_id); + } + } + + if ($error) { + return -1; + } + return 1; + } else { + $this->error = "A request already exists"; + dol_syslog(get_class($this).'::demandeprelevement Can t create a request to generate a direct debit, a request already exists.'); + return 0; + } + } else { + $this->error = $this->db->error(); + dol_syslog(get_class($this).'::demandeprelevement Error -2'); + return -2; + } + } else { + $this->error = "Status of invoice does not allow this"; + dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->status, $this->paye, $this->mode_reglement_id"); + return -3; + } + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Remove a direct debit request or a credit transfer request + * + * @param User $fuser User making delete + * @param int $did ID of request to delete + * @return int <0 if OK, >0 if KO + */ + public function demande_prelevement_delete($fuser, $did) + { + // phpcs:enable + $sql = 'DELETE FROM '.$this->db->prefix().'prelevement_demande'; + $sql .= ' WHERE rowid = '.((int) $did); + $sql .= ' AND traite = 0'; + if ($this->db->query($sql)) { + return 0; + } else { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error); + return -1; + } + } } diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php new file mode 100644 index 00000000000..e867063df27 --- /dev/null +++ b/htdocs/salaries/virement_request.php @@ -0,0 +1,770 @@ + + * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2017-2019 Alexandre Spangaro + * Copyright (C) 2021 Gauthier VERDOL + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/salaries/info.php + * \ingroup salaries + * \brief Page with info about salaries contribution + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} + +// Load translation files required by the page +$langs->loadLangs(array("compta", "bills", "users", "salaries", "hrm")); + +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$type = 'salaire'; + +$label = GETPOST('label', 'alphanohtml'); +$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); + +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} + + + +$object = new Salary($db); +$extrafields = new ExtraFields($db); + +$childids = $user->getAllChildIds(1); + +// fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('salaryinfo', 'globalcard')); + +$object = new Salary($db); +if ($id > 0 || !empty($ref)) { + $object->fetch($id, $ref); + + // Check current user can read this salary + $canread = 0; + if (!empty($user->rights->salaries->readall)) { + $canread = 1; + } + if (!empty($user->rights->salaries->read) && $object->fk_user > 0 && in_array($object->fk_user, $childids)) { + $canread = 1; + } + if (!$canread) { + accessforbidden(); + } +} + +$permissiontoread = $user->rights->salaries->read; +$permissiontoadd = $user->rights->salaries->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +$permissiontodelete = $user->rights->salaries->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); + +$moreparam = ''; +if ($type == 'bank-transfer') { + $obj = new FactureFournisseur($db); + $moreparam = '&type='.$type; +} else { + $obj = new Facture($db); +} + +// Load object +if ($id > 0 || !empty($ref)) { + $ret = $object->fetch($id, $ref); + $isdraft = (($obj->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); + if ($ret > 0) { + $object->fetch_thirdparty(); + } +} + +$hookmanager->initHooks(array('directdebitcard', 'globalcard')); + +restrictedArea($user, 'salaries', $object->id, 'salary', ''); + + +/* + * Actions + */ + +// Link to a project +if ($action == 'classin' && $user->rights->banque->modifier) { + $object->fetch($id); + $object->setProject($projectid); +} + +// set label +if ($action == 'setlabel' && $user->rights->salaries->write) { + $object->fetch($id); + $object->label = $label; + $object->update($user); +} + +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + + +if ($action == "new") { + //var_dump($object);exit; + if ($object->id > 0) { + $db->begin(); + + $sourcetype = 'salaire'; + $newtype = 'salaire'; + $paymentservice = GETPOST('paymentservice'); + $result = $object->demande_prelevement($user, price2num(GETPOST('request_transfer', 'alpha')), $newtype, $sourcetype); + + if ($result > 0) { + $db->commit(); + + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } else { + dol_print_error($db, $error); + $db->rollback(); + setEventMessages($obj->error, $obj->errors, 'errors'); + } + } + $action = ''; +} + +if ($action == "delete" && $usercancreate) { + if ($object->id > 0) { + $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); + if ($result == 0) { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + } +} + + + + +/* + * View + */ + +if (isModEnabled('project')) $formproject = new FormProjets($db); + +$title = $langs->trans('Salary')." - ".$langs->trans('Info'); +$help_url = ""; +llxHeader("", $title, $help_url); + +$object->fetch($id); +$object->info($id); + +$head = salaries_prepare_head($object); + +print dol_get_fiche_head($head, 'request_virement', $langs->trans("SalaryPayment"), -1, 'salary'); + +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = '
'; + +$userstatic = new User($db); +$userstatic->fetch($object->fk_user); + + +// Label +if ($action != 'editlabel') { + $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + $morehtmlref .= $object->label; +} else { + $morehtmlref .= $langs->trans('Label').' : '; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; +} + +$morehtmlref .= '
'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1); + +$usercancreate = $permissiontoadd; + +// Project +if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if ($usercancreate) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } +} + +$morehtmlref .= '
'; + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', ''); + +print '
'; +print '
'; + +print '
'; + +print '
'; + +print '
'; - print $invoicetmp->getNomUrl(1); + print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); print "'; print dol_escape_htmltag($invoicetmp->ref_supplier); print "'; - print $thirdpartytmp->getNomUrl(1); + print ($salaryBonPl ? $usertmp->getNomUrl(1) : $thirdpartytmp->getNomUrl(1)); print "'.price($obj->total_ttc)."'.price(($salaryBonPl ? $obj->amount :$obj->total_ttc))."'.price($obj->amount_requested)."
'.$langs->trans("Total").'  
'; + +if ($action == 'edit') { + print '"; +} else { + print ""; + print ''; +} + +if ($action == 'edit') { + print '"; +} else { + print ""; + print ''; +} +if ($action == 'edit') { + print ''; +} else { + print ''; +} + +// Default mode of payment +print ''; + +// Default Bank Account +if (isModEnabled("banque")) { + print ''; + print ''; +} + +// Other attributes +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + +print '
'.$langs->trans("DateStartPeriod").""; + print $form->selectDate($object->datesp, 'datesp', 0, 0, 0, 'datesp', 1); + print "
' . $langs->trans("DateStartPeriod") . ''; + print dol_print_date($object->datesp, 'day'); + print '
'.$langs->trans("DateEndPeriod").""; + print $form->selectDate($object->dateep, 'dateep', 0, 0, 0, 'dateep', 1); + print "
' . $langs->trans("DateEndPeriod") . ''; + print dol_print_date($object->dateep, 'day'); + print '
' . $langs->trans("Amount") . '
' . $langs->trans("Amount") . '' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '
'; +print ''; +if ($action != 'editmode') + print ''; +print '
'; +print $langs->trans('DefaultPaymentMode'); +print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; +print '
'; + +if ($action == 'editmode') { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->type_payment, 'mode_reglement_id'); +} else { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->type_payment, 'none'); +} +print '
'; + print ''; + } + print '
'; + print $langs->trans('DefaultBankAccount'); + print ''; + if ($action != 'editbankaccount' && $user->rights->salaries->write) { + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; + print '
'; + if ($action == 'editbankaccount') { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); + } else { + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); + } + print '
'; +print '
'; + +$user_perms = $user->hasRight('virement', 'bons', 'creer'); +$buttonlabel = $langs->trans("MakeTransferRequest"); +$user_perms = $user->hasRight('paymentbybanktransfer', 'create'); + +print '
'; +/* + * Payments + */ + $sql = "SELECT p.rowid, p.num_payment as num_payment, p.datep as dp, p.amount,"; + $sql .= " c.code as type_code,c.libelle as paiement_type,"; + $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; + $sql .= ", ".MAIN_DB_PREFIX."salary as s"; + $sql .= " WHERE p.fk_salary = ".((int) $id); + $sql .= " AND p.fk_salary = s.rowid"; + $sql .= " AND s.entity IN (".getEntity('tax').")"; + $sql .= " ORDER BY dp DESC"; + + //print $sql; + $resql = $db->query($sql); +if ($resql) { + $totalpaid = 0; + + $num = $db->num_rows($resql); + + $i = 0; $total = 0; + + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print ''; + print ''; + print ''; + print ''; + print ''; + if (isModEnabled("banque")) { + print ''; + } + print ''; + print ''; + + if ($num > 0) { + $bankaccountstatic = new Account($db); + while ($i < $num) { + $objp = $db->fetch_object($resql); + + print ''; + print '\n"; + $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; + print "\n"; + if (isModEnabled("banque")) { + $bankaccountstatic->id = $objp->baid; + $bankaccountstatic->ref = $objp->baref; + $bankaccountstatic->label = $objp->baref; + $bankaccountstatic->number = $objp->banumber; + $bankaccountstatic->currency_code = $objp->bacurrency_code; + + if (isModEnabled('accounting')) { + $bankaccountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->fk_accountancy_journal); + $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } + + print ''; + } + print '\n"; + print ""; + $totalpaid += $objp->amount; + $i++; + } + } else { + print ''; + print ''; + print ''; + } + + // print '\n"; + // print '\n"; + + $resteapayer = $object->amount - $totalpaid; + // $cssforamountpaymentcomplete = 'amountpaymentcomplete'; + + // print '"; + // print '\n"; + + print "
'.$langs->trans("RefPayment").''.$langs->trans("Date").''.$langs->trans("Type").''.$langs->trans('BankAccount').''.$langs->trans("Amount").'
'; + print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'dayhour', 'tzuserrel')."".$labeltype.' '.$objp->num_payment."'; + if ($bankaccountstatic->id) + print $bankaccountstatic->getNomUrl(1, 'transactions'); + print ''.price($objp->amount)."
'.$langs->trans("None").'
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid)."
'.$langs->trans("AmountExpected").' :'.price($object->amount)."
'.$langs->trans("RemainderToPay")." :'.price($resteapayer)."
"; + print '
'; + + $db->free($resql); +} else { + dol_print_error($db); +} +print '
'; +print '
'; +print '
'; + + +print dol_get_fiche_end(); + +/**button */ +print '
'."\n"; + +$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; + $sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; + $sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; +if ($type == 'salaire') { + $sql .= " WHERE pfd.fk_salary = ".((int) $object->id); +} else { + $sql .= " WHERE fk_facture = ".((int) $object->id); +} + $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.type = 'ban'"; + $sql .= " ORDER BY pfd.date_demande DESC"; + $resql = $db->query($sql); + + $hadRequest = $db->num_rows($resql); +if ($object->paye == 0 && $hadRequest == 0) { + if ($resteapayer > 0) { + if ($user_perms) { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + + if (getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT_SHOW_OLD_BUTTON')) { // This is hidden, prefer to use mode enabled with STRIPE_SEPA_DIRECT_DEBIT + // TODO Replace this with a checkbox for each payment mode: "Send request to XXX immediatly..." + print "
"; + //add stripe sepa button + $buttonlabel = $langs->trans("MakeWithdrawRequestStripe"); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } + } else { + print ''.$buttonlabel.''; + } + } else { + print ''.$buttonlabel.''; + } +} else { + if ($hadRequest == 0) { + if ($object->paye > 0) { + print ''.$buttonlabel.''; + } else { + print ''.$buttonlabel.''; + } + } else { + print ''.$buttonlabel.''; + } +} + +print '
'; + +print '
'; + + +/* + * Withdraw receipts + */ +$bprev = new BonPrelevement($db); + +/* + * Withdrawals + */ + + print '
'; + print ''; + + print ''; + // Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + print ''; + print ''; + print ''; + print ''; +if ($type == 'bank-transfer') { + print ''; +} else { + print ''; +} + print ''; + // Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + print ''; + + $num = 0; +if ($resql) { + $i = 0; + + $tmpuser = new User($db); + + $num = $db->num_rows($result); + if ($num > 0) { + while ($i < $num) { + $obj = $db->fetch_object($resql); + + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + $tmpuser->status = $obj->user_status; + + print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + + // Date + print '\n"; + + // User + print ''; + + // Amount + print ''; + + // Date process + print ''; + + // Link to make payment now + print ''; + + // + print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + + print "\n"; + $i++; + } + } + + $db->free($resql); +} else { + dol_print_error($db); +} + + // Past requests when bon prelevement + + $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; + $sql .= " pfd.date_traite as date_traite, pfd.amount, pfd.fk_prelevement_bons,"; + $sql .= " pb.ref, pb.date_trans, pb.method_trans, pb.credite, pb.date_credit, pb.datec, pb.statut as status, pb.amount as pb_amount,"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; +if ($type == 'salaire') { + $sql .= " WHERE pfd.fk_salary = ".((int) $object->id); +} else { + $sql .= " WHERE fk_facture = ".((int) $object->id); +} + $sql .= " AND pfd.traite = 1"; + $sql .= " AND pfd.type = 'ban'"; + $sql .= " ORDER BY pfd.date_demande DESC"; + + $resql = $db->query($sql); +if ($resql) { + $numOfBp = $db->num_rows($resql); + $i = 0; + $tmpuser = new User($db); + if ($numOfBp > 0) { + while ($i < $numOfBp) { + $obj = $db->fetch_object($resql); + + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + $tmpuser->status = $obj->user_status; + + print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + + // Date + print '\n"; + + // User + print ''; + + // Amount + print ''; + + // Date process + print '\n"; + + // Link to payment request done + print '\n"; + + // + print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + + print "\n"; + $i++; + } + } + $db->free($resql); +} else { + dol_print_error($db); +} + +if ($num == 0 && $numOfBp == 0) { + print ''; +} + + print "
 '.$langs->trans("DateRequest").''.$langs->trans("User").''.$langs->trans("Amount").''.$langs->trans("DateProcess").''.$langs->trans("BankTransferReceipt").''.$langs->trans("WithdrawalReceipt").'  
'; + print ''; + print img_delete(); + print ''.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."'; + print $tmpuser->getNomUrl(-1, '', 0, 0, 0, 0, 'login'); + print ''.price($obj->amount).''.$langs->trans("OrderWaiting").''; + if ($obj->fk_prelevement_bons > 0) { + $withdrawreceipt = new BonPrelevement($db); + $withdrawreceipt->id = $obj->fk_prelevement_bons; + $withdrawreceipt->ref = $obj->ref; + $withdrawreceipt->date_trans = $db->jdate($obj->date_trans); + $withdrawreceipt->date_credit = $db->jdate($obj->date_credit); + $withdrawreceipt->date_creation = $db->jdate($obj->datec); + $withdrawreceipt->statut = $obj->status; + $withdrawreceipt->status = $obj->status; + $withdrawreceipt->amount = $obj->pb_amount; + //$withdrawreceipt->credite = $db->jdate($obj->credite); + + print $withdrawreceipt->getNomUrl(1); + } + + if ($type != 'bank-transfer') { + if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { + $langs->load("stripe"); + if ($obj->fk_prelevement_bons > 0) { + print '   '; + } + print 'rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").''; + } + } else { + if (!empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) { + $langs->load("stripe"); + if ($obj->fk_prelevement_bons > 0) { + print '   '; + } + print 'rowid.'&id='.$object->id.'&type='.urlencode($type).'">'.img_picto('', 'stripe', 'class="pictofixedwidth"').$langs->trans("RequestDirectDebitWithStripe").''; + } + } + print '-'; + print ''; + print img_delete(); + print '
 '.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."'; + print $tmpuser->getNomUrl(-1, '', 0, 0, 0, 0, 'login'); + print ''.price($obj->amount).''.dol_print_date($db->jdate($obj->date_traite), 'dayhour', 'tzuserrel')."'; + if ($obj->fk_prelevement_bons > 0) { + $withdrawreceipt = new BonPrelevement($db); + $withdrawreceipt->id = $obj->fk_prelevement_bons; + $withdrawreceipt->ref = $obj->ref; + $withdrawreceipt->date_trans = $db->jdate($obj->date_trans); + $withdrawreceipt->date_credit = $db->jdate($obj->date_credit); + $withdrawreceipt->date_creation = $db->jdate($obj->datec); + $withdrawreceipt->statut = $obj->status; + $withdrawreceipt->status = $obj->status; + $withdrawreceipt->fk_bank_account = $obj->fk_bank_account; + $withdrawreceipt->amount = $obj->pb_amount; + //$withdrawreceipt->credite = $db->jdate($obj->credite); + + print $withdrawreceipt->getNomUrl(1); + print ' '; + print $withdrawreceipt->getLibStatut(2); + + // Show the bank account + $fk_bank_account = $withdrawreceipt->fk_bank_account; + if (empty($fk_bank_account)) { + $fk_bank_account = ($object->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT); + } + if ($fk_bank_account > 0) { + $bankaccount = new Account($db); + $result = $bankaccount->fetch($fk_bank_account); + if ($result > 0) { + print ' - '; + print $bankaccount->getNomUrl(1); + } + } + } + print "  
'.$langs->trans("None").'
"; + print '
'; + +// End of page +llxFooter(); +$db->close(); From 7cd178e3f944b8459aee618952acac096b1c89c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 16:25:26 +0100 Subject: [PATCH 191/323] Debug v19 --- htdocs/compta/paymentbybanktransfer/index.php | 308 +++++++++--------- htdocs/fourn/facture/list.php | 70 ++-- 2 files changed, 194 insertions(+), 184 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 3e409c3355b..a67398034ce 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -65,6 +65,7 @@ if (prelevement_check_config('bank-transfer') < 0) { $langs->load("errors"); setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("PaymentByBankTransfer")), null, 'errors'); } + $thirdpartystatic = new Societe($db); $invoicestatic = new FactureFournisseur($db); $bprev = new BonPrelevement($db); @@ -82,186 +83,195 @@ print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"), $newcardbut print '
'; - - print '
'; print ''; print ''; -print ''; -print ''; +$totaltoshow = 0; -print ''; -print ''; +if (isModEnabled('supplier_invoice')) { + print ''; + print ''; + $totaltoshow += $bprev->SommeAPrelever('bank-transfer'); +} -print ''; +if (isModEnabled('salaries')) { + print ''; + print ''; + $totaltoshow += $bprev->SommeAPrelever('bank-transfer', 'salary'); +} + +print ''; print '
'.$langs->trans("Statistics").'
'.$langs->trans("NbOfInvoiceToPayByBankTransfer").''; -print ''; -print $bprev->nbOfInvoiceToPay('bank-transfer'); -print ''; -print '
'.$langs->trans("NbOfInvoiceToPayByBankTransferForSalaries").''; -print ''; -print $bprev->nbOfInvoiceToPay('bank-transfer', 'salary'); -print ''; -print '
'.$langs->trans("NbOfInvoiceToPayByBankTransfer").''; + print ''; + print $bprev->nbOfInvoiceToPay('bank-transfer'); + print ''; + print '
'.$langs->trans("AmountToTransfer").'
'.$langs->trans("NbOfInvoiceToPayByBankTransferForSalaries").''; + print ''; + print $bprev->nbOfInvoiceToPay('bank-transfer', 'salary'); + print ''; + print '
'.$langs->trans("Total").''; -print price(($bprev->SommeAPrelever('bank-transfer') + $bprev->SommeAPrelever('bank-transfer', 'salary')), '', '', 1, -1, -1, 'auto'); +print price($totaltoshow, '', '', 1, -1, -1, 'auto'); print '

'; /* * Invoices waiting for withdraw */ -$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,"; -$sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; -$sql .= " ".MAIN_DB_PREFIX."societe as s"; -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} -$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; -$sql .= " WHERE s.rowid = f.fk_soc"; -$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; -$sql .= " AND f.total_ttc > 0"; -if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { - $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; -} -$sql .= " AND pfd.traite = 0"; -$sql .= " AND pfd.ext_payment_id IS NULL"; -$sql .= " AND pfd.fk_facture_fourn = f.rowid"; -if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} -if ($socid) { - $sql .= " AND f.fk_soc = ".((int) $socid); -} - -$sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; -$resql = $db->query($sql); - -if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - if ($num) { - while ($i < $num && $i < 20) { - $obj = $db->fetch_object($resql); - - $invoicestatic->id = $obj->rowid; - $invoicestatic->ref = $obj->ref; - $invoicestatic->status = $obj->fk_statut; - $invoicestatic->statut = $obj->fk_statut; // For backward comaptibility - $invoicestatic->paye = $obj->paye; - $invoicestatic->type = $obj->type; - $invoicestatic->date = $db->jdate($obj->datef); - $invoicestatic->date_echeance = $db->jdate($obj->date_lim_reglement); - $invoicestatic->total_ttc = $obj->total_ttc; - $alreadypayed = $invoicestatic->getSommePaiement(); - - - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; - $thirdpartystatic->email = $obj->email; - $thirdpartystatic->tva_intra = $obj->tva_intra; - $thirdpartystatic->siren = $obj->idprof1; - $thirdpartystatic->siret = $obj->idprof2; - $thirdpartystatic->ape = $obj->idprof3; - $thirdpartystatic->idprof1 = $obj->idprof1; - $thirdpartystatic->idprof2 = $obj->idprof2; - $thirdpartystatic->idprof3 = $obj->idprof3; - $thirdpartystatic->idprof4 = $obj->idprof4; - $thirdpartystatic->idprof5 = $obj->idprof5; - $thirdpartystatic->idprof6 = $obj->idprof6; - - - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - print ''; - $i++; - } - } else { - $titlefortab = $langs->transnoentitiesnoconv("BankTransfer"); - print ''; +if (isModEnabled('supplier_invoice')) { + $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,"; + $sql .= " pfd.date_demande, pfd.amount,"; + $sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; + $sql .= " ".MAIN_DB_PREFIX."societe as s"; + if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " WHERE s.rowid = f.fk_soc"; + $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; + $sql .= " AND f.total_ttc > 0"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { + $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; + } + $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.ext_payment_id IS NULL"; + $sql .= " AND pfd.fk_facture_fourn = f.rowid"; + if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + if ($socid) { + $sql .= " AND f.fk_soc = ".((int) $socid); + } + + $sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; + $resql = $db->query($sql); + + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + + print '
'; + print '
'.$langs->trans("SupplierInvoiceWaitingWithdraw").' ('.$num.')
'; - print $invoicestatic->getNomUrl(1, 'withdraw'); - print ''; - print $thirdpartystatic->getNomUrl(1, 'supplier'); - print ''; - print ''.price($obj->amount).''; - print ''; - print dol_print_date($db->jdate($obj->date_demande), 'day'); - print ''; - print $invoicestatic->getLibStatut(3, $alreadypayed); - print '
'.$langs->trans("NoSupplierInvoiceToWithdraw", $titlefortab, $titlefortab).'
'; + print ''; + print ''; + if ($num) { + while ($i < $num && $i < 20) { + $obj = $db->fetch_object($resql); + + $invoicestatic->id = $obj->rowid; + $invoicestatic->ref = $obj->ref; + $invoicestatic->status = $obj->fk_statut; + $invoicestatic->statut = $obj->fk_statut; // For backward comaptibility + $invoicestatic->paye = $obj->paye; + $invoicestatic->type = $obj->type; + $invoicestatic->date = $db->jdate($obj->datef); + $invoicestatic->date_echeance = $db->jdate($obj->date_lim_reglement); + $invoicestatic->total_ttc = $obj->total_ttc; + $alreadypayed = $invoicestatic->getSommePaiement(); + + + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; + $thirdpartystatic->tva_intra = $obj->tva_intra; + $thirdpartystatic->siren = $obj->idprof1; + $thirdpartystatic->siret = $obj->idprof2; + $thirdpartystatic->ape = $obj->idprof3; + $thirdpartystatic->idprof1 = $obj->idprof1; + $thirdpartystatic->idprof2 = $obj->idprof2; + $thirdpartystatic->idprof3 = $obj->idprof3; + $thirdpartystatic->idprof4 = $obj->idprof4; + $thirdpartystatic->idprof5 = $obj->idprof5; + $thirdpartystatic->idprof6 = $obj->idprof6; + + + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + print ''; + $i++; + } + } else { + $titlefortab = $langs->transnoentitiesnoconv("BankTransfer"); + print ''; + } + print "
'.$langs->trans("SupplierInvoiceWaitingWithdraw").' ('.$num.')
'; + print $invoicestatic->getNomUrl(1, 'withdraw'); + print ''; + print $thirdpartystatic->getNomUrl(1, 'supplier'); + print ''; + print ''.price($obj->amount).''; + print ''; + print dol_print_date($db->jdate($obj->date_demande), 'day'); + print ''; + print $invoicestatic->getLibStatut(3, $alreadypayed); + print '
'.$langs->trans("NoSupplierInvoiceToWithdraw", $titlefortab, $titlefortab).'

"; + } else { + dol_print_error($db); } - print "

"; -} else { - dol_print_error($db); } -$resql2 = $db->query($sqlForSalary); -if ($resql2) { - $numRow = $db->num_rows($resql2); - $j = 0 ; +if (isModEnabled('salaries')) { + $resql2 = $db->query($sqlForSalary); + if ($resql2) { + $numRow = $db->num_rows($resql2); + $j = 0 ; - print '
'; - print ''; - print ''; - print ''; + print '
'; + print '
'.$langs->trans("SalaryInvoiceWaitingWithdraw").' ('.$numRow.')
'; + print ''; + print ''; - if ($numRow) { - while ($j < $numRow && $j<10) { - $objSalary = $db->fetch_object($resql2); - $user->fetch($objSalary->fk_user); - $salary->fetch($objSalary->fk_salary); - $alreadypayedS = $salary->getSommePaiement(); + if ($numRow) { + while ($j < $numRow && $j<10) { + $objSalary = $db->fetch_object($resql2); + $user->fetch($objSalary->fk_user); + $salary->fetch($objSalary->fk_salary); + $alreadypayedS = $salary->getSommePaiement(); - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - print ''; - $j++; + print ''; + print ''; + $j++; + } + } else { + $titlefortab = $langs->transnoentitiesnoconv("BankTransfer"); + print ''; } + print "
'.$langs->trans("SalaryInvoiceWaitingWithdraw").' ('.$numRow.')
'; - print $salary->getNomUrl(1); - print '
'; + print $salary->getNomUrl(1); + print ''; - print $user->getNomUrl(1); - print ''; + print $user->getNomUrl(1); + print ''; - print ''.price($objSalary->amount).''; - print ''; + print ''.price($objSalary->amount).''; + print ''; - print dol_print_date($db->jdate($objSalary->date_demande), 'day'); - print ''; + print dol_print_date($db->jdate($objSalary->date_demande), 'day'); + print ''; - print $salary->getLibStatut(3, $alreadypayedS); - print '
'; + print $salary->getLibStatut(3, $alreadypayedS); + print '
'.$langs->trans("NoSalaryInvoiceToWithdraw", $titlefortab, $titlefortab).'

"; } else { - $titlefortab = $langs->transnoentitiesnoconv("BankTransfer"); - print ''.$langs->trans("NoSalaryInvoiceToWithdraw", $titlefortab, $titlefortab).''; + dol_print_error($db); } - print "

"; -} else { - dol_print_error($db); } print '
'; - /* * Withdraw receipts */ diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3f920d6afae..dda61889b2c 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -469,7 +469,7 @@ if ($search_user > 0) { } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')'; @@ -747,10 +747,10 @@ if (!$resql) { $num = $db->num_rows($resql); -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { +// Direct jump if only one record found +if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->facid; - header("Location: ".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$id); exit; } @@ -949,6 +949,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-ci print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_invoice', 0, $newcardbutton, '', $limit, 0, 0, 1); +// Add code for pre mass action (confirmation or email presend form) $topicmail = "SendBillRef"; $modelmail = "invoice_supplier_send"; $objecttmp = new FactureFournisseur($db); @@ -1009,11 +1010,14 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -1275,8 +1279,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } if (!empty($arrayfields['f.ref']['checked'])) { @@ -1431,11 +1436,12 @@ if (!empty($arrayfields['f.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, '', $sortfield, $sortorder, 'right '); $totalarray['nbfield']++; } +// Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } -print "\n"; +print ''."\n"; $facturestatic = new FactureFournisseur($db); $supplierstatic = new Fournisseur($db); @@ -1783,8 +1789,6 @@ while ($i < $imaxinloop) { print ''.price($obj->total_ht)."\n"; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; } $totalarray['val']['f.total_ht'] += $obj->total_ht; @@ -1794,8 +1798,6 @@ while ($i < $imaxinloop) { print ''.price($obj->total_vat)."\n"; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat'; } $totalarray['val']['f.total_vat'] += $obj->total_vat; @@ -1805,8 +1807,6 @@ while ($i < $imaxinloop) { print ''.price($obj->total_localtax1)."\n"; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1'; } $totalarray['val']['f.total_localtax1'] += $obj->total_localtax1; @@ -1816,8 +1816,6 @@ while ($i < $imaxinloop) { print ''.price($obj->total_localtax2)."\n"; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2'; } $totalarray['val']['f.total_localtax2'] += $obj->total_localtax2; @@ -1827,8 +1825,6 @@ while ($i < $imaxinloop) { print ''.price($obj->total_ttc)."\n"; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; } $totalarray['val']['f.total_ttc'] += $obj->total_ttc; @@ -1843,6 +1839,9 @@ while ($i < $imaxinloop) { $nbLinks = Link::count($db, $facturestatic->element, $facturestatic->id); $nbTotal = $nbFiles + $nbLinks; echo ''.(empty($nbTotal)? '':$nbTotal).''; + if (!$i) { + $totalarray['nbfield']++; + } } // Author @@ -1863,8 +1862,6 @@ while ($i < $imaxinloop) { print ''.(!empty($totalpay) ?price($totalpay, 0, $langs) : '').''; // TODO Use a denormalized field if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'totalam'; } $totalarray['val']['totalam'] += $totalpay; @@ -1874,8 +1871,6 @@ while ($i < $imaxinloop) { print ''.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').''; // TODO Use a denormalized field if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'rtp'; } $totalarray['val']['rtp'] += $remaintopay; @@ -2019,22 +2014,27 @@ print '
'."\n"; print ''."\n"; -$hidegeneratedfilelistifempty = 1; -if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { - $hidegeneratedfilelistifempty = 0; +if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + $title = ''; + + print $formfile->showdocuments('massfilesarea_supplier_invoice', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } -// Show list of available documents -$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; -$urlsource .= str_replace('&', '&', $param); - -$filedir = $diroutputmassaction; -$genallowed = $user->hasRight('facture', 'lire'); -$delallowed = $user->hasRight('facture', 'creer'); -$title = ''; - -print $formfile->showdocuments('massfilesarea_supplier_invoice', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); - // End of page llxFooter(); $db->close(); From f1b436451ec54053ecb120cce4b1f1d72b301961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 16:26:44 +0100 Subject: [PATCH 192/323] Debug v19 --- htdocs/fourn/facture/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index dda61889b2c..a515c82adf6 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1377,6 +1377,7 @@ if (!empty($arrayfields['f.total_ttc']['checked'])) { } if (!empty($arrayfields['f.nb_docs']['checked'])) { print_liste_field_titre($arrayfields['f.nb_docs']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); From 56bb63c388bf3b1e881cebe535e48e8de5ef039a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 16:29:00 +0100 Subject: [PATCH 193/323] Debug v19 --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dc934d9661a..6433f63fe0d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5968,7 +5968,7 @@ class Facture extends CommonInvoice } if (method_exists($this, 'getLibStatut')) { $alreadypaid = (empty($arraydata['alreadypaid']) ? 0 : $arraydata['alreadypaid']); - $return .= '
'.$this->getLibStatut(3, $alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $alreadypaid).'
'; } $return .= '
'; $return .= '
'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a07498bbc54..f2f7318b3b4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3351,7 +3351,7 @@ class FactureFournisseur extends CommonInvoice } if (method_exists($this, 'getLibStatut')) { $alreadypaid = (empty($arraydata['alreadypaid']) ? 0 : $arraydata['alreadypaid']); - $return .= '
'.$this->getLibStatut(3, $alreadypaid).'
'; + $return .= '
'.$this->getLibStatut(3, $alreadypaid).'
'; } $return .= '
'; $return .= ''; From 27d2a1a2204ce65d4c8bd5b85a8eb0418eba5034 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 16:34:35 +0100 Subject: [PATCH 194/323] Debug v19 --- htdocs/core/lib/salaries.lib.php | 30 +++++++++++++++++++++++----- htdocs/salaries/virement_request.php | 4 +++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 689eb55910b..b8210bd65a3 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -39,6 +39,31 @@ function salaries_prepare_head($object) $head[$h][2] = 'card'; $h++; + if (isModEnabled('paymentbybanktransfer')) { + $nbStandingOrders = 0; + $sql = "SELECT COUNT(pfd.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " WHERE pfd.fk_salary = ".((int) $object->id); + $sql .= " AND type = 'ban'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj) { + $nbStandingOrders = $obj->nb; + } + } else { + dol_print_error($db); + } + $langs->load("banks"); + $head[$h][0] = DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id.'&type=bank-transfer'; + $head[$h][1] = $langs->trans('BankTransfer'); + if ($nbStandingOrders > 0) { + $head[$h][1] .= ''.$nbStandingOrders.''; + } + $head[$h][2] = 'request_virement'; + $h++; + } + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab @@ -63,11 +88,6 @@ function salaries_prepare_head($object) $head[$h][2] = 'info'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id; - $head[$h][1] = $langs->trans("VirementOrder"); - $head[$h][2] = 'request_virement'; - $h++; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'add', 'external'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove'); diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index e867063df27..ed6307f5f93 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -192,7 +192,9 @@ if ($action == "delete" && $usercancreate) { * View */ -if (isModEnabled('project')) $formproject = new FormProjets($db); +if (isModEnabled('project')) { + $formproject = new FormProjets($db); +} $title = $langs->trans('Salary')." - ".$langs->trans('Info'); $help_url = ""; From 6fc0a868f57c4d421c3907a38c6e10888b7a802e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 16:51:37 +0100 Subject: [PATCH 195/323] Debug v19 --- htdocs/compta/prelevement/create.php | 25 +++++++++++++++++-------- htdocs/compta/prelevement/demandes.php | 2 +- htdocs/core/lib/prelevement.lib.php | 4 ++-- htdocs/langs/en_US/withdrawals.lang | 5 +++-- htdocs/langs/fr_FR/withdrawals.lang | 4 ++-- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 742866715bd..2f81e38ea41 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -131,7 +131,15 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); } elseif ($result == 0) { - $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); + if ($type != 'bank-transfer') { + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); + } + if ($type == 'bank-transfer' && $sourcetype != 'salary') { + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawedSuppliers", $format); + } + if ($type == 'bank-transfer' && $sourcetype == 'salary') { + $mesg = $langs->trans("NoSalariesCouldBeWithdrawed", $format); + } setEventMessages($mesg, null, 'errors'); $mesg .= '
'."\n"; foreach ($bprev->invoice_in_error as $key => $val) { @@ -446,7 +454,7 @@ if ($resql) { if ($sourcetype != 'salary') { $tradinvoice = "SupplierInvoice"; } else { - $tradinvoice = "SalaryInvoice"; + $tradinvoice = "RefSalary"; } } @@ -459,16 +467,17 @@ if ($resql) { print ''.$form->showCheckAddButtons('checkforselect', 1).''; } } + // Ref invoice or salary print ''.$langs->trans($tradinvoice).''; - if ($type == 'bank-transfer') { - if ($sourcetype != 'salary') { - print ''.$langs->trans("RefSupplier").''; - } else { - print ''.$langs->trans("RefSalary").''; - } + // Ref supplier + if ($type == 'bank-transfer' && $sourcetype != 'salary') { + print ''.$langs->trans("RefSupplier").''; } + // Thirdparty or user if ($sourcetype != 'salary') { print ''.$langs->trans("ThirdParty").''; + } else { + print ''.$langs->trans("Employee").''; } print ''.$langs->trans("RIB").''; print ($sourcetype != 'salary'? ''.$langs->trans("RUM").'' : ''); diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 7edfcddab6c..43d5f749a38 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -251,7 +251,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort print ''; print ''; -print_liste_field_titre(($sourcetype ? "SalaryInvoice" : "Bill"), $_SERVER["PHP_SELF"]); +print_liste_field_titre(($sourcetype ? "RefSalary" : "Bill"), $_SERVER["PHP_SELF"]); print_liste_field_titre(($sourcetype ? "Employee" :"Company"), $_SERVER["PHP_SELF"]); print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right '); print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); diff --git a/htdocs/core/lib/prelevement.lib.php b/htdocs/core/lib/prelevement.lib.php index c0e4e81f87f..c7673d22683 100644 --- a/htdocs/core/lib/prelevement.lib.php +++ b/htdocs/core/lib/prelevement.lib.php @@ -122,14 +122,14 @@ function bon_prelevement_prepare_head(BonPrelevement $object, $nbOfInvoices, $nb $head = array(); $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer'; - $head[$h][1] = ($nbOfInvoices <= 0 ? $langs->trans("Invoices") : $langs->trans("Invoices").' '.$nbOfInvoices.''); + $head[$h][1] = ($nbOfInvoices <= 0 ? $langs->trans("Invoices") : $langs->trans("Invoices").''.$nbOfInvoices.''); $head[$h][2] = 'invoice'; $h++; // Salaries $head[$h][0] = DOL_URL_ROOT."/compta/prelevement/create.php?type=bank-transfer&sourcetype=salary"; - $head[$h][1] = ($nbOfSalaryInvoice <= 0 ? $langs->trans("Salaries") : $langs->trans("Salaries").' '.$nbOfSalaryInvoice.''); + $head[$h][1] = ($nbOfSalaryInvoice <= 0 ? $langs->trans("Salaries") : $langs->trans("Salaries").''.$nbOfSalaryInvoice.''); $head[$h][2] = 'salary'; $h++; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 62a45034fac..571ab14203e 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -47,7 +47,9 @@ MakeBankTransferOrder=Make a credit transfer request WithdrawRequestsDone=%s direct debit payment requests recorded BankTransferRequestsDone=%s credit transfer requests recorded ThirdPartyBankCode=Third-party bank code -NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. +NoInvoiceCouldBeWithdrawed=No invoice processed successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. +NoInvoiceCouldBeWithdrawedSupplier=No invoice processed successfully. Check that invoices are on companies with a valid IBAN. +NoSalariesCouldBeWithdrawed=No salary processed successfully. Check that salary are on users with a valid IBAN. WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries. ClassCredited=Classify credited ClassDebited=Classify debited @@ -166,7 +168,6 @@ Societe_ribSigned=SEPA mandat Signed NbOfInvoiceToPayByBankTransferForSalaries=No. of qualified salaries waiting for a payment by credit transfer SalaryWaitingWithdraw=Salaries waiting for payment by credit transfer RefSalary=Salary -SalaryInvoice=Salary invoice NoSalaryInvoiceToWithdraw=No salary invoice with open '%s' is waiting. Go on tab '%s' on salary card to make a request. SalaryInvoiceWaitingWithdraw=Salary invoice waiting for payment by credit transfer diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index 66a4b255ef0..24e9822ae61 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -48,6 +48,7 @@ WithdrawRequestsDone=%s demandes de prélèvements enregistrées BankTransferRequestsDone=%s demandes de prélèvements enregistrées ThirdPartyBankCode=Code banque du tiers NoInvoiceCouldBeWithdrawed=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide et que le BAN a un RUM avec le mode %s . +NoInvoiceCouldBeWithdrawedSupplier=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide. WithdrawalCantBeCreditedTwice=Le virement est déjà marqué comme étant crédité ; cela ne peut pas être fait deux fois, cela créerait potentiellement des paiements et des saisies bancaires en double. ClassCredited=Classer crédité ClassDebited=Classer Débité @@ -164,8 +165,7 @@ UsedFor=Utilisé pour %s Societe_ribSigned=SEPA mandat signé NbOfInvoiceToPayByBankTransferForSalaries=Nombre de salaires qualifiées en attente de paiement par virement SalaryWaitingWithdraw=Salaire en attente de virement -RefSalary=Salarié -SalaryInvoice=Facture salarié +RefSalary=Salaire NoSalaryInvoiceToWithdraw=Aucune facture de salarié avec '%s' ouvert n'est en attente. Allez sur l'onglet '%s' sur la fiche de salaire pour faire une demande. SalaryInvoiceWaitingWithdraw=Facture salarié en attente de paiement par virement bancaire From 96db44174e276fd2251ed88c660e6f6a1e35efe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 17:20:42 +0100 Subject: [PATCH 196/323] css --- htdocs/salaries/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ab853ac9558..f2c50b9fca3 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -577,8 +577,8 @@ if ($action == 'create' && $permissiontoadd) { // Amount print ''; print ''; From 09e504c18e68f005593ee9f30047f040c95328e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 17:26:13 +0100 Subject: [PATCH 197/323] Debug v19 --- htdocs/salaries/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index f2c50b9fca3..9622ece2267 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -618,7 +618,8 @@ if ($action == 'create' && $permissiontoadd) { // Type payment print ''; // Date payment From c154a72d8887415158602e437d9b3ad39e79e057 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 17:30:21 +0100 Subject: [PATCH 198/323] Debug v19 --- htdocs/comm/propal/card.php | 20 +- htdocs/comm/propal/class/propal.class.php | 12 +- htdocs/comm/propal/list.php | 642 ++++++++++-------- htdocs/compta/bank/card.php | 45 +- htdocs/compta/prelevement/card.php | 2 +- .../class/bonprelevement.class.php | 25 +- htdocs/compta/prelevement/create.php | 15 +- htdocs/compta/prelevement/demandes.php | 2 +- htdocs/compta/prelevement/factures.php | 50 +- htdocs/langs/en_US/banks.lang | 4 +- htdocs/langs/en_US/bills.lang | 1 - htdocs/langs/fr_FR/bills.lang | 1 - htdocs/salaries/virement_request.php | 3 +- htdocs/user/class/user.class.php | 1 + 14 files changed, 454 insertions(+), 369 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 494d2bbf121..3dd1c612943 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1959,16 +1959,6 @@ if ($action == 'create') { $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id', 'int') : ''), 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); print ''; - // Delivery delay - print ''; - // Shipping Method if (isModEnabled("expedition")) { if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { @@ -1989,6 +1979,16 @@ if ($action == 'create') { print ''; } + // Delivery delay + print ''; + // Delivery date (or manufacturing) print ''; print ''; if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.ref']['checked'])) { print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.ref_client']['checked'])) { print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['pr.ref']['checked'])) { print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['pr.title']['checked'])) { print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.name_alias']['checked'])) { print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.town']['checked'])) { print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['s.zip']['checked'])) { print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['state.nom']['checked'])) { print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['country.code_iso']['checked'])) { print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['typent.code']['checked'])) { print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.date']['checked'])) { print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fin_validite']['checked'])) { print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_livraison']['checked'])) { print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_signature']['checked'])) { print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['ava.rowid']['checked'])) { print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_input_reason']['checked'])) { print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_mode_reglement']['checked'])) { print_liste_field_titre($arrayfields['p.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ht']['checked'])) { print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_tva']['checked'])) { print_liste_field_titre($arrayfields['p.total_tva']['label'], $_SERVER["PHP_SELF"], 'p.total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ttc']['checked'])) { print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) { print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.total_invoiced']['checked'])) { print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_code']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_code', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_tx']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_tx', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ht']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_total_ht']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_tva']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_total_tva']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_tva', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ttc']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_total_ttc']['label'], $_SERVER['PHP_SELF'], 'p.multicurrency_total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_ht_invoiced']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.multicurrency_total_invoiced']['checked'])) { print_liste_field_titre($arrayfields['p.multicurrency_total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'class="center"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['sale_representative']['checked'])) { print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['total_pa']['checked'])) { print_liste_field_titre($arrayfields['total_pa']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin']['checked'])) { print_liste_field_titre($arrayfields['total_margin']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['total_margin_rate']['checked'])) { print_liste_field_titre($arrayfields['total_margin_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['total_mark_rate']['checked'])) { print_liste_field_titre($arrayfields['total_mark_rate']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1612,30 +1656,38 @@ if ($resql) { print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.tms']['checked'])) { print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.date_cloture']['checked'])) { print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.note_public']['checked'])) { print_liste_field_titre($arrayfields['p.note_public']['label'], $_SERVER["PHP_SELF"], "p.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.note_private']['checked'])) { print_liste_field_titre($arrayfields['p.note_private']['label'], $_SERVER["PHP_SELF"], "p.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + $totalarray['nbfield']++; } if (!empty($arrayfields['p.fk_statut']['checked'])) { print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); + $totalarray['nbfield']++; } if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; } print ''."\n"; - $now = dol_now(); - $i = 0; + // Loop on record + // -------------------------------------------------------------------- $typenArray = null; + $now = dol_now(); $with_margin_info = false; if (isModEnabled('margin') && ( @@ -1650,13 +1702,16 @@ if ($resql) { $total_ht = 0; $total_margin = 0; + $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; - $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; @@ -1721,9 +1776,8 @@ if ($resql) { } // Output Kanban $userstatic->fetch($obj->fk_user_author); - $objectstatic->author = $userstatic->getNomUrl(1); - $objectstatic->fk_project = $projectstatic->getNomUrl(1); - print $objectstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); + $arrayofparams = array('selected' => in_array($object->id, $arrayofselected), 'authorlink' => $userstatic->getNomUrl(-2), 'projectlink' => $projectstatic->getNomUrl(2)); + print $objectstatic->getKanbanView('', $arrayofparams); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -2326,24 +2380,26 @@ if ($resql) { print ''."\n"; - $hidegeneratedfilelistifempty = 1; - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { - $hidegeneratedfilelistifempty = 0; + if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) { + $hidegeneratedfilelistifempty = 1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; + } + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource .= str_replace('&', '&', $param); + + $filedir = $diroutputmassaction; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; + + print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } - // Show list of available documents - $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource .= str_replace('&', '&', $param); - - $filedir = $diroutputmassaction; - $genallowed = $user->hasRight('propal', 'lire'); - $delallowed = $user->hasRight('propal', 'creer'); - - print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); + // End of page + llxFooter(); + $db->close(); diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index e18d0c01e28..f3c590e6ff1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -581,9 +581,11 @@ if ($action == 'create') { } if (isModEnabled('paymentbybanktransfer')) { - print ''; - print ''; + if ($mysoc->isInEEC()) { + print ''; + print ''; + } } print '
'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; - print ' '; - print '
'; print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; - $form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", ''); + print img_picto('', 'bank', 'class="pictofixedwidth"'); + print $form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", ''); print '
'.$langs->trans('AvailabilityPeriod'); - if (isModEnabled('commande')) { - print ' ('.$langs->trans('AfterOrder').')'; - } - print ''; - print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id', 'int') : ''), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); - print '
'.$langs->trans('AvailabilityPeriod'); + if (isModEnabled('commande')) { + print ' ('.$langs->trans('AfterOrder').')'; + } + print ''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id', 'int') : ''), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + print '
'.$langs->trans("DeliveryDate").''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ed48120e624..ef4df465154 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4010,17 +4010,17 @@ class Propal extends CommonObject if ($selected >= 0) { $return .= ''; } - if (property_exists($this, 'fk_project')) { - $return .= ' | '.$this->fk_project.''; + if (!empty($arraydata['projectlink'])) { + $return .= ' | '.$arraydata['projectlink'].''; } - if (property_exists($this, 'author')) { - $return .= '
'.$this->author.''; + if (!empty($arraydata['authorlink'])) { + $return .= '
'.$arraydata['authorlink'].''; } if (property_exists($this, 'total_ht')) { - $return .='
'.$langs->trans("AmountHT").' : '.price($this->total_ht).''; + $return .='
'.price($this->total_ht).''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } $return .= ''; $return .= ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index db1cd738592..6424a67f38c 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -317,85 +317,86 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_categ = ''; - $search_user = ''; - $search_sale = ''; - $search_ref = ''; - $search_refcustomer = ''; - $search_refproject = ''; - $search_project = ''; - $search_societe = ''; - $search_societe_alias = ''; - $search_montant_ht = ''; - $search_montant_vat = ''; - $search_montant_ttc = ''; - $search_warehouse = ''; - $search_multicurrency_code = ''; - $search_multicurrency_tx = ''; - $search_multicurrency_montant_ht = ''; - $search_multicurrency_montant_vat = ''; - $search_multicurrency_montant_ttc = ''; - $search_login = ''; - $search_product_category = ''; - $search_town = ''; - $search_zip = ""; - $search_state = ""; - $search_type = ''; - $search_country = ''; - $search_type_thirdparty = ''; - $search_date_startday = ''; - $search_date_startmonth = ''; - $search_date_startyear = ''; - $search_date_endday = ''; - $search_date_endmonth = ''; - $search_date_endyear = ''; - $search_date_start = ''; - $search_date_end = ''; - $search_date_end_startday = ''; - $search_date_end_startmonth = ''; - $search_date_end_startyear = ''; - $search_date_end_endday = ''; - $search_date_end_endmonth = ''; - $search_date_end_endyear = ''; - $search_date_end_start = ''; - $search_date_end_end = ''; - $search_date_delivery_startday = ''; - $search_date_delivery_startmonth = ''; - $search_date_delivery_startyear = ''; - $search_date_delivery_endday = ''; - $search_date_delivery_endmonth = ''; - $search_date_delivery_endyear = ''; - $search_date_delivery_start = ''; - $search_date_delivery_end = ''; - $search_availability = ''; - $search_status = ''; - $object_statut = ''; - $toselect = array(); - $search_array_options = array(); - $search_categ_cus = 0; - $search_fk_cond_reglement = ''; - $search_fk_shipping_method = ''; - $search_fk_input_reason = ''; - $search_fk_mode_reglement = ''; - $search_date_signature_startday = ''; - $search_date_signature_startmonth = ''; - $search_date_signature_startyear = ''; - $search_date_signature_endday = ''; - $search_date_signature_endmonth = ''; - $search_date_signature_endyear = ''; - $search_date_signature_start = ''; - $search_date_signature_end = ''; -} -if ($object_statut != '') { - $search_status = $object_statut; -} - - if (empty($reshook)) { + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $search_categ = ''; + $search_user = ''; + $search_sale = ''; + $search_ref = ''; + $search_refcustomer = ''; + $search_refproject = ''; + $search_project = ''; + $search_societe = ''; + $search_societe_alias = ''; + $search_montant_ht = ''; + $search_montant_vat = ''; + $search_montant_ttc = ''; + $search_warehouse = ''; + $search_multicurrency_code = ''; + $search_multicurrency_tx = ''; + $search_multicurrency_montant_ht = ''; + $search_multicurrency_montant_vat = ''; + $search_multicurrency_montant_ttc = ''; + $search_login = ''; + $search_product_category = ''; + $search_town = ''; + $search_zip = ""; + $search_state = ""; + $search_type = ''; + $search_country = ''; + $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_end_startday = ''; + $search_date_end_startmonth = ''; + $search_date_end_startyear = ''; + $search_date_end_endday = ''; + $search_date_end_endmonth = ''; + $search_date_end_endyear = ''; + $search_date_end_start = ''; + $search_date_end_end = ''; + $search_date_delivery_startday = ''; + $search_date_delivery_startmonth = ''; + $search_date_delivery_startyear = ''; + $search_date_delivery_endday = ''; + $search_date_delivery_endmonth = ''; + $search_date_delivery_endyear = ''; + $search_date_delivery_start = ''; + $search_date_delivery_end = ''; + $search_availability = ''; + $search_status = ''; + $object_statut = ''; + $search_categ_cus = 0; + $search_fk_cond_reglement = ''; + $search_fk_shipping_method = ''; + $search_fk_input_reason = ''; + $search_fk_mode_reglement = ''; + $search_date_signature_startday = ''; + $search_date_signature_startmonth = ''; + $search_date_signature_startyear = ''; + $search_date_signature_endday = ''; + $search_date_signature_endmonth = ''; + $search_date_signature_endyear = ''; + $search_date_signature_start = ''; + $search_date_signature_end = ''; + $toselect = array(); + $search_array_options = array(); + } + if ($object_statut != '') { + $search_status = $object_statut; + } + + // Mass actions $objectclass = 'Propal'; $objectlabel = 'Proposals'; $uploaddir = $conf->propal->multidir_output[$conf->entity]; @@ -828,6 +829,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $db->free($resql); } +// Complete request and execute it with limit $sql .= $db->order($sortfield, $sortorder); $sql .= ', p.ref DESC'; if ($limit) { @@ -835,213 +837,216 @@ if ($limit) { } $resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} -if ($resql) { $objectstatic = new Propal($db); $userstatic = new User($db); - if ($socid > 0) { - $soc = new Societe($db); - $soc->fetch($socid); - $title = $langs->trans('Proposals').' - '.$soc->name; - if (empty($search_societe)) { - $search_societe = $soc->name; - } - } else { - $title = $langs->trans('Proposals'); +if ($socid > 0) { + $soc = new Societe($db); + $soc->fetch($socid); + $title = $langs->trans('Proposals').' - '.$soc->name; + if (empty($search_societe)) { + $search_societe = $soc->name; } +} else { + $title = $langs->trans('Proposals'); +} $num = $db->num_rows($resql); $arrayofselected = is_array($toselect) ? $toselect : array(); - if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { - $obj = $db->fetch_object($resql); +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { + $obj = $db->fetch_object($resql); - $id = $obj->rowid; + $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id); - exit; - } + header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id); + exit; +} $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; llxHeader('', $title, $help_url); $param = '&search_status='.urlencode($search_status); - if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); - } - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.((int) $limit); - } - if ($sall) { - $param .= '&sall='.urlencode($sall); - } - if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); - } - if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); - } - if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); - } - if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); - } - if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); - } - if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); - } - if ($search_date_end_startday) { - $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); - } - if ($search_date_end_startmonth) { - $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); - } - if ($search_date_end_startyear) { - $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); - } - if ($search_date_end_endday) { - $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); - } - if ($search_date_end_endmonth) { - $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); - } - if ($search_date_end_endyear) { - $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); - } - if ($search_date_delivery_startday) { - $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); - } - if ($search_date_delivery_startmonth) { - $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); - } - if ($search_date_delivery_startyear) { - $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); - } - if ($search_date_delivery_endday) { - $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); - } - if ($search_date_delivery_endmonth) { - $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); - } - if ($search_date_delivery_endyear) { - $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_refcustomer) { - $param .= '&search_refcustomer='.urlencode($search_refcustomer); - } - if ($search_refproject) { - $param .= '&search_refproject='.urlencode($search_refproject); - } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); - } - if ($search_societe_alias) { - $param .= '&search_societe_alias='.urlencode($search_societe_alias); - } - if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); - } - if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); - } - if ($search_montant_ht) { - $param .= '&search_montant_ht='.urlencode($search_montant_ht); - } - if ($search_multicurrency_code != '') { - $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code); - } - if ($search_multicurrency_tx != '') { - $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx); - } - if ($search_multicurrency_montant_ht != '') { - $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht); - } - if ($search_multicurrency_montant_vat != '') { - $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); - } - if ($search_multicurrency_montant_ttc != '') { - $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); - } - if ($search_login) { - $param .= '&search_login='.urlencode($search_login); - } - if ($search_town) { - $param .= '&search_town='.urlencode($search_town); - } - if ($search_zip) { - $param .= '&search_zip='.urlencode($search_zip); - } - if ($socid > 0) { - $param .= '&socid='.urlencode($socid); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); - } - if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); - } - if ($search_fk_cond_reglement > 0) { - $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); - } - if ($search_fk_shipping_method > 0) { - $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); - } - if ($search_fk_input_reason > 0) { - $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); - } - if ($search_fk_mode_reglement > 0) { - $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); - } - if ($search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); - } - if ($search_town) { - $param .= '&search_town='.urlencode($search_town); - } - if ($search_zip) { - $param .= '&search_zip='.urlencode($search_zip); - } - if ($search_state) { - $param .= '&search_state='.urlencode($search_state); - } - if ($search_town) { - $param .= '&search_town='.urlencode($search_town); - } - if ($search_country) { - $param .= '&search_country='.urlencode($search_country); - } - if ($search_date_signature_startday) { - $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday); - } - if ($search_date_signature_startmonth) { - $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth); - } - if ($search_date_signature_startyear) { - $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear); - } - if ($search_date_signature_endday) { - $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday); - } - if ($search_date_signature_endmonth) { - $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth); - } - if ($search_date_signature_endyear) { - $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear); - } +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); +} +if ($sall) { + $param .= '&sall='.urlencode($sall); +} +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); +} +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_date_end_startday) { + $param .= '&search_date_end_startday='.urlencode($search_date_end_startday); +} +if ($search_date_end_startmonth) { + $param .= '&search_date_end_startmonth='.urlencode($search_date_end_startmonth); +} +if ($search_date_end_startyear) { + $param .= '&search_date_end_startyear='.urlencode($search_date_end_startyear); +} +if ($search_date_end_endday) { + $param .= '&search_date_end_endday='.urlencode($search_date_end_endday); +} +if ($search_date_end_endmonth) { + $param .= '&search_date_end_endmonth='.urlencode($search_date_end_endmonth); +} +if ($search_date_end_endyear) { + $param .= '&search_date_end_endyear='.urlencode($search_date_end_endyear); +} +if ($search_date_delivery_startday) { + $param .= '&search_date_delivery_startday='.urlencode($search_date_delivery_startday); +} +if ($search_date_delivery_startmonth) { + $param .= '&search_date_delivery_startmonth='.urlencode($search_date_delivery_startmonth); +} +if ($search_date_delivery_startyear) { + $param .= '&search_date_delivery_startyear='.urlencode($search_date_delivery_startyear); +} +if ($search_date_delivery_endday) { + $param .= '&search_date_delivery_endday='.urlencode($search_date_delivery_endday); +} +if ($search_date_delivery_endmonth) { + $param .= '&search_date_delivery_endmonth='.urlencode($search_date_delivery_endmonth); +} +if ($search_date_delivery_endyear) { + $param .= '&search_date_delivery_endyear='.urlencode($search_date_delivery_endyear); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_refcustomer) { + $param .= '&search_refcustomer='.urlencode($search_refcustomer); +} +if ($search_refproject) { + $param .= '&search_refproject='.urlencode($search_refproject); +} +if ($search_societe) { + $param .= '&search_societe='.urlencode($search_societe); +} +if ($search_societe_alias) { + $param .= '&search_societe_alias='.urlencode($search_societe_alias); +} +if ($search_user > 0) { + $param .= '&search_user='.urlencode($search_user); +} +if ($search_sale > 0) { + $param .= '&search_sale='.urlencode($search_sale); +} +if ($search_montant_ht) { + $param .= '&search_montant_ht='.urlencode($search_montant_ht); +} +if ($search_multicurrency_code != '') { + $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code); +} +if ($search_multicurrency_tx != '') { + $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx); +} +if ($search_multicurrency_montant_ht != '') { + $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht); +} +if ($search_multicurrency_montant_vat != '') { + $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); +} +if ($search_multicurrency_montant_ttc != '') { + $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); +} +if ($search_login) { + $param .= '&search_login='.urlencode($search_login); +} +if ($search_town) { + $param .= '&search_town='.urlencode($search_town); +} +if ($search_zip) { + $param .= '&search_zip='.urlencode($search_zip); +} +if ($socid > 0) { + $param .= '&socid='.urlencode($socid); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($search_categ_cus > 0) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); +} +if ($search_product_category != '') { + $param .= '&search_product_category='.urlencode($search_product_category); +} +if ($search_fk_cond_reglement > 0) { + $param .= '&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement); +} +if ($search_fk_shipping_method > 0) { + $param .= '&search_fk_shipping_method='.urlencode($search_fk_shipping_method); +} +if ($search_fk_input_reason > 0) { + $param .= '&search_fk_input_reason='.urlencode($search_fk_input_reason); +} +if ($search_fk_mode_reglement > 0) { + $param .= '&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement); +} +if ($search_type_thirdparty > 0) { + $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); +} +if ($search_town) { + $param .= '&search_town='.urlencode($search_town); +} +if ($search_zip) { + $param .= '&search_zip='.urlencode($search_zip); +} +if ($search_state) { + $param .= '&search_state='.urlencode($search_state); +} +if ($search_town) { + $param .= '&search_town='.urlencode($search_town); +} +if ($search_country) { + $param .= '&search_country='.urlencode($search_country); +} +if ($search_date_signature_startday) { + $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday); +} +if ($search_date_signature_startmonth) { + $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth); +} +if ($search_date_signature_startyear) { + $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear); +} +if ($search_date_signature_endday) { + $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday); +} +if ($search_date_signature_endmonth) { + $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth); +} +if ($search_date_signature_endyear) { + $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear); +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -1481,120 +1486,159 @@ if ($resql) { print '
'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; - print '
'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; + print '
'; print '
'; @@ -830,15 +832,17 @@ if ($action == 'create') { print ''; } - // TODO ICS is not used with bank transfer ! if (isModEnabled('paymentbybanktransfer')) { - print ''.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').''; - print ''.$object->ics_transfer.''; - print ''; - - print ''.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; - print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")); - print "\n"; + if (getDolGlobalString("SEPA_USE_IDS")) { // ICS is not used with bank transfer ! + print ''.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').''; + print ''.$object->ics_transfer.''; + print ''; + } + if ($mysoc->isInEEC()) { + print ''.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; + print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")); + print "\n"; + } } print ''.$langs->trans("BankAccountOwner").''; @@ -1123,14 +1127,14 @@ if ($action == 'create') { // IBAN print ''; $tooltip = $langs->trans("Example").':
CH93 0076 2011 6238 5295 7
LT12 1000 0111 0100 1000
FR14 2004 1010 0505 0001 3M02 606
LU28 0019 4006 4475 0000
DE89 3704 0044 0532 0130 00'; - print $form->textwithpicto($langs->trans($ibankey), $tooltip); + print $form->textwithpicto($langs->trans($ibankey), $tooltip, 1, 'help', '', 0, 3, 'iban'); print ''; print ''; // BIC print ''; $tooltip = $langs->trans("Example").': LIABLT2XXXX'; - print $form->textwithpicto($langs->trans($bickey), $tooltip); + print $form->textwithpicto($langs->trans($bickey), $tooltip, 1, 'help', '', 0, 3, 'bic'); print ''; print ''; @@ -1166,12 +1170,15 @@ if ($action == 'create') { } if (isModEnabled('paymentbybanktransfer')) { - print ''.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').''; - print ''; - - print ''.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; - print 'pti_in_ctti ? ' checked ' : '') . '>'; - print ''; + if (getDolGlobalString("SEPA_USE_IDS")) { // ICS is not used with bank transfer ! + print ''.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').''; + print ''; + } + if ($mysoc->isInEEC()) { + print ''.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; + print 'pti_in_ctti ? ' checked ' : '') . '>'; + print ''; + } } print ''.$langs->trans("BankAccountOwner").''; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index f2b7df4ffe3..f385266d493 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -525,7 +525,7 @@ if ($id > 0 || $ref) { $userSalary->fetch($obj->fk_user); } print ''; - print (!$salaryBonPl ? $thirdparty->getNomUrl(1) : $userSalary->getNomUrl(1)); + print (!$salaryBonPl ? $thirdparty->getNomUrl(1) : $userSalary->getNomUrl(-1)); print "\n"; print ''.price($obj->amount)."\n"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index c63e1e81d02..3267c0f7fd5 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1025,10 +1025,13 @@ class BonPrelevement extends CommonObject } if (!$error) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; - $soc = new Societe($this->db); + $tmpsoc = new Societe($this->db); + $tmpuser = new User($this->db); // Check BAN $i = 0; @@ -1074,12 +1077,22 @@ class BonPrelevement extends CommonObject } else { if ($type != 'bank-transfer') { $invoice_url = "".$fac[9].""; - } else { - $invoice_url = "".$fac[9].""; + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); } - dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() " . $fac->fk_soc . " " . $soc->name, LOG_WARNING); - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); - $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + if ($type == 'bank-transfer' && $sourcetype != 'salary') { + $invoice_url = "".$fac[9].""; + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + } + if ($type == 'bank-transfer' && $sourcetype == 'salary') { + $tmpuser->id = $fac[2]; + $tmpuser->firstname = $fac[8]; + $salary_url = "".$fac[0].""; + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); + $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); + } + dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . join(', ', $fac) . " - " . $soc->name, LOG_WARNING); } } else { dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 2f81e38ea41..1b4b7fed945 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -131,11 +131,12 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); } elseif ($result == 0) { + $mesg = ''; if ($type != 'bank-transfer') { $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); } if ($type == 'bank-transfer' && $sourcetype != 'salary') { - $mesg = $langs->trans("NoInvoiceCouldBeWithdrawedSuppliers", $format); + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawedSupplier", $format); } if ($type == 'bank-transfer' && $sourcetype == 'salary') { $mesg = $langs->trans("NoSalariesCouldBeWithdrawed", $format); @@ -479,8 +480,12 @@ if ($resql) { } else { print ''.$langs->trans("Employee").''; } + // BAN print ''.$langs->trans("RIB").''; - print ($sourcetype != 'salary'? ''.$langs->trans("RUM").'' : ''); + // RUM + if (empty($type) || $type == 'direc-debit') { + print ''.$langs->trans("RUM").''; + } print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("DateRequest").''; // Action column @@ -553,10 +558,10 @@ if ($resql) { } else { print ''; $user->fetch($obj->fk_user); - print $user->getNomUrl(1); + print $user->getNomUrl(-1); print ''; } - // RIB + // BAN print ''; if ($bac->id > 0) { if (!empty($bac->iban) || !empty($bac->bic)) { @@ -573,7 +578,7 @@ if ($resql) { print ''; // RUM - if ($sourcetype != 'salary') { + if (empty($type) || $type == 'direc-debit') { print ''; $rumtoshow = $thirdpartystatic->display_rib('rum'); if ($rumtoshow) { diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 43d5f749a38..1c545136bdf 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -302,7 +302,7 @@ while ($i < min($num, $limit)) { $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); } else { - print $userstatic->getNomUrl(1, 'accountancy'); + print $userstatic->getNomUrl(-1, 'accountancy'); } print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 3654bb2fcb4..192a359a2c6 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -41,6 +41,7 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'withdrawal $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); +$userid = GETPOST('userid', 'int'); $type = GETPOST('type', 'aZ09'); // Load variable for pagination @@ -201,28 +202,33 @@ if ($id > 0 || $ref) { } -// List of invoices +// List of invoices or salaries if ($salaryBonPl) { - $sql = "SELECT pb.rowid, pb.type, s.rowid as salaryid, pl.amount as amount_requested"; - $sql .= ", pl.fk_user, u.firstname,u.lastname,pl.statut, s.amount"; - $sql .= " FROM llx_prelevement_bons AS pb INNER JOIN llx_prelevement_lignes"; - $sql .= " AS pl ON pl.fk_prelevement_bons = pb.rowid INNER JOIN llx_salary"; - $sql .= " AS s ON pl.fk_user = s.fk_user INNER JOIN llx_user"; - $sql .= " AS u ON pl.fk_user = u.rowid"; + $sql = "SELECT pf.rowid, p.type,"; + $sql .= " f.rowid as salaryid, f.ref as ref, f.amount,"; + $sql .= " u.rowid as userid, u.firstname, u.lastname, pl.statut as status, pl.amount as amount_requested"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON pl.fk_prelevement_bons = p.rowid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement as pf ON pf.fk_prelevement_lignes = pl.rowid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as f ON f.rowid = pf.fk_salary AND f.entity IN (".getEntity('salary').")"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON f.fk_user = u.rowid"; + $sql .= " WHERE 1 = 1"; if ($object->id > 0) { - $sql .= " AND pb.rowid = ".((int) $object->id); + $sql .= " AND p.rowid = ".((int) $object->id); + } + if ($userid > 0) { + $sql .= " AND u.rowid = ".((int) $userid); } - //print_r($sql);exit; } else { $sql = "SELECT pf.rowid, p.type,"; $sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,"; if ($object->type == 'bank-transfer') { $sql .= " f.ref_supplier,"; } - $sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; - $sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= ", ".MAIN_DB_PREFIX."prelevement as pf"; + $sql .= " s.rowid as socid, s.nom as name, pl.statut as status, pl.amount as amount_requested"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; if ($object->type != 'bank-transfer') { $sql .= ", ".MAIN_DB_PREFIX."facture as f"; } else { @@ -294,7 +300,7 @@ if ($resql) { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre(($salaryBonPl ? "SalaryBill" : "Bill"), $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre(($salaryBonPl ? "Salary" : "Bill"), $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); if ($object->type == 'bank-transfer' && !$salaryBonPl) { print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "f.ref_supplier", '', $param, '', $sortfield, $sortorder); } @@ -320,7 +326,7 @@ if ($resql) { $obj = $db->fetch_object($resql); if ($salaryBonPl) { $salarytmp->fetch($obj->salaryid); - $usertmp->fetch($obj->fk_user); + $usertmp->fetch($obj->userid); } else { if ($obj->type == 'bank-transfer') { $invoicetmp = $invoicetmpsupplier; @@ -331,8 +337,10 @@ if ($resql) { $thirdpartytmp->fetch($obj->socid); } + print ''; + print '\n"; @@ -344,7 +352,7 @@ if ($resql) { } print '\n"; // Amount of invoice @@ -355,19 +363,17 @@ if ($resql) { // Status of requests print '"; print ""; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index b91de649cfa..c6970765e9c 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -190,7 +190,7 @@ IfYouDontReconcileDisableProperty=If you don't make the bank reconciliations on NoBankAccountDefined=No bank account defined NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled. AlreadyOneBankAccount=Already one bank account defined -SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level -SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=When generatin a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA file variant +SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=Yes = Store 'Payment Type' in 'Credit Transfer' section of SEPA file

When generating a SEPA XML file for Credit transfers, the section "PaymentTypeInformation" can now be placed inside the "CreditTransferTransactionInformation" section (instead of "Payment" section). We strongly recommend to keep this unchecked to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level. ToCreateRelatedRecordIntoBank=To create missing related bank record XNewLinesConciliated=%s new line(s) conciliated diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index c602b54098e..8d44904d58b 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -641,6 +641,5 @@ MentionCategoryOfOperations=Category of operations MentionCategoryOfOperations0=Delivery of goods MentionCategoryOfOperations1=Provision of services MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services -SalaryBill=Invoice salary Salaries=Salaries InvoiceSubtype=Invoice Subtype \ No newline at end of file diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 234dbd4b86e..56306d602e4 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -641,5 +641,4 @@ MentionCategoryOfOperations=Catégorie d'opérations MentionCategoryOfOperations0=Livraison de marchandises MentionCategoryOfOperations1=Prestation de services MentionCategoryOfOperations2=Mixte - Livraison de biens & prestation de services -SalaryBill=Facture salaire Salaries=Salaires \ No newline at end of file diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index ed6307f5f93..664faba42ca 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -175,7 +175,7 @@ if ($action == "new") { $action = ''; } -if ($action == "delete" && $usercancreate) { +if ($action == "delete" && $permissiontodelete) { if ($object->id > 0) { $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { @@ -264,7 +264,6 @@ print '
'; print '
'; -print '
'; print '
'; print ($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); print "'; - print ($salaryBonPl ? $usertmp->getNomUrl(1) : $thirdpartytmp->getNomUrl(1)); + print ($salaryBonPl ? $usertmp->getNomUrl(-1) : $thirdpartytmp->getNomUrl(1)); print "'; - - if ($obj->statut == 0) { - print '-'; - } elseif ($obj->statut == 2) { + if ($obj->status == 0) { + print $langs->trans("StatusWaiting"); + } elseif ($obj->status == 2) { if ($obj->type == 'bank-transfer') { print $langs->trans("StatusDebited"); } else { print $langs->trans("StatusCredited"); } - } elseif ($obj->statut == 3) { + } elseif ($obj->status == 3) { print ''.$langs->trans("StatusRefused").''; } - print "
'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fc9610762f8..9b0f1bb4d25 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2822,6 +2822,7 @@ class User extends CommonObject $datas['administrator'] = '
'.$langs->trans("Administrator").': '.yn($this->admin); } if (!empty($this->accountancy_code) || $option == 'accountancy') { + $langs->load("companies"); $datas['accountancycode'] = '
'.$langs->trans("AccountancyCode").': '.$this->accountancy_code; } $company = ''; From 3bd677ffb989ace49b5288de7abdb35494990e13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 19:59:19 +0100 Subject: [PATCH 199/323] Debug v19 --- .../class/bonprelevement.class.php | 46 +++++++++---------- htdocs/compta/prelevement/stats.php | 14 +++--- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3267c0f7fd5..15ea5167287 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -688,17 +688,17 @@ class BonPrelevement extends CommonObject */ $sql = "SELECT "; if ($this->type == 'bank-transfer') { - $sql .= " pf.fk_facture_fourn"; + $sql .= " p.fk_facture_fourn"; } else { - $sql .= " pf.fk_facture"; + $sql .= " p.fk_facture"; } if ($amounts) { $sql .= ", SUM(pl.amount)"; } $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf"; - $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; + $sql .= " , ".MAIN_DB_PREFIX."prelevement as p"; + $sql .= " WHERE p.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND p.rowid = ".((int) $this->id); $sql .= " AND p.entity = ".((int) $conf->entity); @@ -1672,18 +1672,18 @@ class BonPrelevement extends CommonObject $sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; - $sql .= " f.ref as reffac, pf.fk_facture as idfac,"; + $sql .= " f.ref as reffac, p.fk_facture as idfac,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement as pf,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture = f.rowid"; + $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; + $sql .= " AND p.fk_facture = f.rowid"; $sql .= " AND f.fk_soc = soc.rowid"; $sql .= " AND soc.fk_pays = c.rowid"; $sql .= " AND rib.fk_soc = f.fk_soc"; @@ -1787,11 +1787,11 @@ class BonPrelevement extends CommonObject /* * Section Creditor (sepa Crediteurs bloc lines) */ - // add condition for traiting sourcetype TODO if (!empty($user_dest)) { $sql = "SELECT u.rowid as userId, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,"; $sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; - $sql .= " s.rowid as idSalary,rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; + $sql .= " s.ref as reffac, p.fk_salary as idfac,"; + $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum"; $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."salary as s,"; @@ -1808,18 +1808,18 @@ class BonPrelevement extends CommonObject } else { $sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; - $sql .= " f.ref as reffac, pf.fk_facture_fourn as idfac, f.ref_supplier as fac_ref_supplier,"; + $sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,"; $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement as pf,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture_fourn = f.rowid"; + $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; + $sql .= " AND p.fk_facture_fourn = f.rowid"; $sql .= " AND f.fk_soc = soc.rowid"; $sql .= " AND soc.fk_pays = c.rowid"; $sql .= " AND rib.fk_soc = f.fk_soc"; @@ -1906,10 +1906,10 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture = f.rowid"; + $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; + $sql .= " AND p.fk_facture = f.rowid"; // Lines $i = 0; @@ -1932,10 +1932,10 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture_fourn = f.rowid"; + $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; + $sql .= " AND p.fk_facture_fourn = f.rowid"; // Lines $i = 0; $resql = $this->db->query($sql); @@ -2074,8 +2074,8 @@ class BonPrelevement extends CommonObject * @param string $row_cg pl.code_guichet AS cg, Not used for SEPA * @param string $row_cc pl.number AS cc, Not used for SEPA * @param string $row_somme pl.amount AS somme, - * @param string $row_ref Invoice ref (f.ref) - * @param string $row_idfac pf.fk_facture AS idfac, + * @param string $row_ref Invoice ref (f.ref) or Salary ref + * @param string $row_idfac p.fk_facture AS idfac or p.fk_facture_fourn or p.fk_salary, * @param string $row_iban rib.iban_prefix AS iban, * @param string $row_bic rib.bic AS bic, * @param string $row_datec rib.datec, @@ -2150,7 +2150,7 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .= ' '.$CrLf; return $XML_DEBITOR; } else { - // SEPA Paiement Information of seller for Credit Transfer + // SEPA Payment Information of seller for Credit Transfer $XML_CREDITOR = ''; $XML_CREDITOR .= ' '.$CrLf; $XML_CREDITOR .= ' '.$CrLf; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index a3439266ce8..5f96df166d4 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -125,12 +125,12 @@ if ($resql) { //print $st[$row[2]]; print ''; - print ''; print ''; print ''; - print ''; - print ''; From ca78eff61f375db0ef444124a3e91d57bf55fdc8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 20:00:16 +0100 Subject: [PATCH 200/323] Fix round --- htdocs/compta/prelevement/stats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 5f96df166d4..1ebee939615 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -138,7 +138,7 @@ if ($resql) { print ''; print ''; print ''; From 9ef047e75eee3dd7ff93807ee988057f6ba32dc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 20:02:47 +0100 Subject: [PATCH 201/323] Doc --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index eff66bdcdac..4bc6c124f35 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -583,7 +583,7 @@ Module54Desc=Management of contracts (services or recurring subscriptions) Module55Name=Barcodes Module55Desc=Barcode or QR code management Module56Name=Payment by credit transfer -Module56Desc=Management of payment of suppliers by Credit Transfer orders. It includes generation of SEPA file for European countries. +Module56Desc=Management of payment of suppliers or salaries by Credit Transfer orders. It includes generation of SEPA file for European countries. Module57Name=Payments by Direct Debit Module57Desc=Management of Direct Debit orders. It includes generation of SEPA file for European countries. Module58Name=ClickToDial From 75ac561595139ece3cc89537bad75f9afebab095 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 20:08:27 +0100 Subject: [PATCH 202/323] Fix warnings --- htdocs/core/lib/functions.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 80c0d202c5c..fe0560d0da4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4314,6 +4314,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $url = DOL_URL_ROOT; $theme = isset($conf->theme) ? $conf->theme : null; $path = 'theme/'.$theme; + if (empty($picto)) { + $picto = 'generic'; + } + // Define fullpathpicto to use into src if ($pictoisfullpath) { // Clean parameters @@ -4327,7 +4331,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $moreatt = str_replace('class="'.$reg[1].'"', '', $moreatt); } } else { - $pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); + $pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', (is_null($picto) ? '' : $picto)); $pictowithouttext = str_replace('object_', '', $pictowithouttext); $pictowithouttext = str_replace('_nocolor', '', $pictowithouttext); From 8ec367406d7b0d7f8c86d9403a09f655c34d4431 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 20:23:33 +0100 Subject: [PATCH 203/323] Clean code --- htdocs/compta/prelevement/class/bonprelevement.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 15ea5167287..53fc85a188b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2398,8 +2398,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' ')).''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' ')).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' '), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV @@ -2464,8 +2464,8 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$country[1].''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' ')).''.$CrLf; - $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' ')).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ADDRESS), ' '), 70, 'right', 'UTF-8', 1)).''.$CrLf; + $XML_SEPA_INFO .= ' '.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).''.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf;*/ $XML_SEPA_INFO .= ' SLEV'.$CrLf; // Field "Responsible of fees". Must be SLEV From 659cdfa97512663e6d34833f8b4d42fda23ee040 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 20:35:41 +0100 Subject: [PATCH 204/323] Add a test with a german char --- test/phpunit/FunctionsLibTest.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 61febdfcdc8..b6f281e2143 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -684,14 +684,20 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase */ public function testDolStringNoSpecial() { - $text="A string with space and special char like ' or ° and more...\n"; - $after=dol_string_nospecial($text, '_', '', '', 0); + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + + $text = "A string with space and special char like ' or ° and more...\n"; + $after = dol_string_nospecial($text, '_', '', '', 0); $this->assertEquals("A_string_with_space_and_special_char_like___or___and_more...\n", $after, "testDolStringNoSpecial 1"); - $text="A string with space and special char like ' or ° and more...\n"; - $after=dol_string_nospecial($text, '_', '', '', 1); + $text = "A string with space and special char like ' or ° and more...\n"; + $after = dol_string_nospecial($text, '_', '', '', 1); $this->assertEquals("A string with space and special char like _ or _ and more...\n", $after, "testDolStringNoSpecial 2"); + $text = 'Bahnhofstraße'; + $after = dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($text), ' '), 70, 'right', 'UTF-8', 1)); + $this->assertEquals("Bahnhofstraße", $after, "testDolStringNoSpecial with german char"); + return true; } From 78600b0f6140227e48f917927e12dae452685d4e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Nov 2023 21:01:15 +0100 Subject: [PATCH 205/323] Trans --- htdocs/langs/en_US/withdrawals.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 571ab14203e..8734b134e68 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -168,6 +168,6 @@ Societe_ribSigned=SEPA mandat Signed NbOfInvoiceToPayByBankTransferForSalaries=No. of qualified salaries waiting for a payment by credit transfer SalaryWaitingWithdraw=Salaries waiting for payment by credit transfer RefSalary=Salary -NoSalaryInvoiceToWithdraw=No salary invoice with open '%s' is waiting. Go on tab '%s' on salary card to make a request. -SalaryInvoiceWaitingWithdraw=Salary invoice waiting for payment by credit transfer +NoSalaryInvoiceToWithdraw=No salary waiting for a '%s'. Go on tab '%s' on salary card to make a request. +SalaryInvoiceWaitingWithdraw=Salaries waiting for payment by credit transfer From d9674b18283858e4aa8aa7edda3e9422b86a8cbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 01:05:54 +0100 Subject: [PATCH 206/323] Clean code --- htdocs/theme/eldy/btn.inc.php | 7 +++++-- htdocs/theme/eldy/global.inc.php | 4 ---- htdocs/theme/md/btn.inc.php | 6 ++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 28ae22e9696..92b8ecb23aa 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -251,12 +251,15 @@ a.btnTitle.btnTitleSelected { border-radius: 3px; position: relative; text-align: center; - /* color: #ffffff; - background-color: rgb(); */ font-size: 12px; text-decoration: none; box-shadow: none; } +/* The buttonplus isgrowing on hover (dont know why). This is to avoid to have the cellegrowing too */ +.btnTitlePlus:hover { + max-width: 24px; + max-height: 40px; +} .btnTitle.refused, a.btnTitle.refused, .btnTitle.refused:hover, a.btnTitle.refused:hover { color: #8a8a8a; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d1248aebe35..905ae6e22b0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4111,10 +4111,6 @@ div.pagination li.litext a:hover { background-color: transparent; background-image: none; } -div.pagination li.litext a:hover { - background-color: transparent; - background-image: none; -} div.pagination li.noborder a:hover { border: none; background-color: transparent; diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 3e8195e0372..f39f27b6784 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -379,6 +379,12 @@ div.pagination .btnTitle:hover .btnTitle-label{ border-color: #ddd; } +/* The buttonplus isgrowing on hover (dont know why). This is to avoid to have the cellegrowing too */ +.btnTitlePlus:hover { + max-width: 24px; + max-height: 40px; +} + /* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ @media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ From de3fec95f55aa6ab58cc4fa1506924791ea3edf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 02:27:47 +0100 Subject: [PATCH 207/323] Debug v19 --- htdocs/core/class/commonobject.class.php | 31 ++++++++++++++++--- .../class/conferenceorbooth.class.php | 14 +++++++-- .../conferenceorbooth_list.php | 8 ++--- htdocs/public/project/index.php | 24 +++++++------- 4 files changed, 56 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 912c06d5033..327afd9e26a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7033,6 +7033,7 @@ abstract class CommonObject $param['options'] = array(); $type = $this->fields[$key]['type']; } + //var_dump($type); var_dump($param['options']); // Special case that force options and type ($type can be integer, varchar, ...) if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { @@ -7194,7 +7195,27 @@ abstract class CommonObject $out .= '"; print '"; print '
'; + print ''; print $row[1]; print ''; - print round($row[1] / $nbtotal * 100, 2)." %"; + print price2num($row[1] / $nbtotal * 100, 2)." %"; print ''; @@ -229,17 +229,19 @@ if ($resql) { print '
'; print $Rejet->motifs[$row[2]]; + print ''.$row[1]; + print ''.$row[1]; + print ''; - print round($row[1] / $nbtotal * 100, 2)." %"; + print ''; + print price2num($row[1] / $nbtotal * 100, 2)." %"; print ''; print price($row[0]); print ''; - print round($row[0] / $total * 100, 2)." %"; + print price2num($row[0] / $total * 100, 2)." %"; print '
'; - print round($row[0] / $total * 100, 2)." %"; + print price2num($row[0] / $total * 100, 2)." %"; print '
'; $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); print "
'; $typeofdata = 'checkbox:'.($project->accept_booth_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); print "
'; diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index c8f17bd9057..e7e6c9df719 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -126,17 +126,19 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; // Output html code for logo + print '
'; + print '
'; if ($urllogo) { - print '
'; - print '
'; - print ''; - print '
'; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; - } - print '
'; + print ''; } + if (empty($urllogo)) { + print $mysoc->name; + } + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT)) { print '
'; @@ -201,9 +203,9 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); +//llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -//llxHeaderVierge($langs->trans("SuggestForm")); +llxHeaderVierge($langs->trans("SuggestForm")); From 9322554a6f4ed41c658065152a6637f9176ba6ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 02:36:18 +0100 Subject: [PATCH 208/323] Fix responsive --- htdocs/public/project/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index e7e6c9df719..6383ddd38e6 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -275,7 +275,7 @@ print '
'; print '
'; -print ''."\n"; +print '
'."\n"; print $text; @@ -298,17 +298,17 @@ print '
'; $foundaction = 0; if ($project->accept_booth_suggestions) { $foundaction++; - print ''; + print ''; print '

'; } if ($project->accept_conference_suggestions == 1 || $project->accept_conference_suggestions == 2) { // Can suggest conferences $foundaction++; - print ''; + print ''; print '

'; } if ($project->accept_conference_suggestions == 2 || $project->accept_conference_suggestions == 3) { // Can vote for conferences $foundaction++; - print ''; + print ''; } if (! $foundaction) { From 613aa3b292227b4ec3a27ab45e66a07be60e5da4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 02:40:30 +0100 Subject: [PATCH 209/323] Better link --- htdocs/projet/list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 36cc92ec90c..cc3bba8129e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -936,6 +936,9 @@ if (!empty($socid)) { } if ($search_usage_event_organization == 1) { $url .= '&usage_organize_event=1'; + if (((int) $search_usage_opportunity) < 1) { + $url .= '&usage_opportunity=0'; + } } $newcardbutton = ''; From be58db508d9e59fbf3df510b98dd0837fdbc6e20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 10:51:00 +0100 Subject: [PATCH 210/323] Debug v19 --- htdocs/compta/paymentbybanktransfer/index.php | 13 ++++++------- htdocs/salaries/virement_request.php | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index a67398034ce..37de3bfbbbd 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -168,16 +168,13 @@ if (isModEnabled('supplier_invoice')) { $invoicestatic->date = $db->jdate($obj->datef); $invoicestatic->date_echeance = $db->jdate($obj->date_lim_reglement); $invoicestatic->total_ttc = $obj->total_ttc; - $alreadypayed = $invoicestatic->getSommePaiement(); + $alreadypayed = $invoicestatic->getSommePaiement(); $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; $thirdpartystatic->email = $obj->email; $thirdpartystatic->tva_intra = $obj->tva_intra; - $thirdpartystatic->siren = $obj->idprof1; - $thirdpartystatic->siret = $obj->idprof2; - $thirdpartystatic->ape = $obj->idprof3; $thirdpartystatic->idprof1 = $obj->idprof1; $thirdpartystatic->idprof2 = $obj->idprof2; $thirdpartystatic->idprof3 = $obj->idprof3; @@ -186,7 +183,6 @@ if (isModEnabled('supplier_invoice')) { $thirdpartystatic->idprof6 = $obj->idprof6; - print ''; @@ -233,8 +229,11 @@ if (isModEnabled('salaries')) { if ($numRow) { while ($j < $numRow && $j<10) { $objSalary = $db->fetch_object($resql2); + $user->fetch($objSalary->fk_user); + $salary->fetch($objSalary->fk_salary); + $alreadypayedS = $salary->getSommePaiement(); print ''; print ''; print ''; - print ''; diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index 664faba42ca..83f8868c05e 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -56,7 +56,7 @@ if (isModEnabled('project')) { } // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "users", "salaries", "hrm")); +$langs->loadLangs(array("compta", "bills", "users", "salaries", "hrm", "withdrawals")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); From dc07b9f5676c08e40550a68971d4497c03b8ccd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 10:55:23 +0100 Subject: [PATCH 211/323] Debug v19 --- htdocs/compta/prelevement/create.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 1b4b7fed945..6d365a36dc4 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -486,7 +486,13 @@ if ($resql) { if (empty($type) || $type == 'direc-debit') { print ''; } - print ''; + print ''; print ''; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { From cb819780808359998947d8a11ed8a475233c298b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 11:07:31 +0100 Subject: [PATCH 212/323] NEW Add field TechnicalID in list of users --- .../class/bonprelevement.class.php | 2 +- htdocs/user/list.php | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 53fc85a188b..15fcb9e3a54 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1088,7 +1088,7 @@ class BonPrelevement extends CommonObject if ($type == 'bank-transfer' && $sourcetype == 'salary') { $tmpuser->id = $fac[2]; $tmpuser->firstname = $fac[8]; - $salary_url = "".$fac[0].""; + $salary_url = "".$fac[0].""; $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index a6ca07916f1..b3840c7489b 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -41,10 +41,10 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST("mode", 'aZ'); +$mode = GETPOST("mode", 'aZ'); // Security check (for external users) $socid = 0; @@ -84,7 +84,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml'); +$search_all = trim(GETPOST('search_all', 'alphanohtml')); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') { @@ -121,6 +121,7 @@ $permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'wri // Definition of fields for list $arrayfields = array( + 'u.rowid'=>array('label'=>"TechnicalID", 'checked'=>-1, 'position'=>5), 'u.login'=>array('label'=>"Login", 'checked'=>1, 'position'=>10), 'u.lastname'=>array('label'=>"Lastname", 'checked'=>1, 'position'=>15), 'u.firstname'=>array('label'=>"Firstname", 'checked'=>1, 'position'=>20), @@ -153,6 +154,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); // Init search fields $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_user = GETPOST('search_user', 'alpha'); +$search_rowid = GETPOST('search_rowid', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_firstname = GETPOST('search_firstname', 'alpha'); @@ -246,6 +248,7 @@ if (empty($reshook)) { // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_user = ""; + $search_rowid = ""; $search_login = ""; $search_lastname = ""; $search_firstname = ""; @@ -413,6 +416,9 @@ if ($search_thirdparty != '') { if ($search_warehouse > 0) { $sql .= natural_search(array('u.fk_warehouse'), $search_warehouse); } +if ($search_rowid != '') { + $sql .= natural_search("u.rowid", $search_rowid, 1); +} if ($search_login != '') { $sql .= natural_search("u.login", $search_login); } @@ -560,6 +566,9 @@ if ($search_all != '') { if ($search_user != '') { $param .= "&search_user=".urlencode($search_user); } +if ($search_rowid != '') { + $param .= "&search_rowid=".urlencode($search_rowid); +} if ($search_login != '') { $param .= "&search_login=".urlencode($search_login); } @@ -739,6 +748,9 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print $searchpicto; print ''; } +if (!empty($arrayfields['u.rowid']['checked'])) { + print ''; +} if (!empty($arrayfields['u.login']['checked'])) { print ''; } @@ -845,6 +857,10 @@ if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } +if (!empty($arrayfields['u.rowid']['checked'])) { + print_liste_field_titre($arrayfields['u.rowid']['label'], $_SERVER['PHP_SELF'], "u.rowid", $param, "", "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} if (!empty($arrayfields['u.login']['checked'])) { print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -1048,6 +1064,13 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } } + // TechnicalID + if (!empty($arrayfields['u.rowid']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Login if (!empty($arrayfields['u.login']['checked'])) { print ''; @@ -563,7 +573,7 @@ if ($resql) { print ''; } else { print ''; } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 1c545136bdf..984bda5b6f6 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -132,14 +132,14 @@ if ($type == 'bank-transfer') { if ($sourcetype != 'salary') { $sql = "SELECT f.ref, f.rowid, f.total_ttc,"; $sql .= " s.nom as name, s.rowid as socid,"; - $sql .= " pfd.date_demande as date_demande, pfd.amount, pfd.fk_user_demande"; + $sql .= " pd.date_demande as date_demande, pd.amount, pd.fk_user_demande"; if ($type != 'bank-transfer') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; } else { $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } $sql .= " ".MAIN_DB_PREFIX."societe as s,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } @@ -152,20 +152,20 @@ if ($sourcetype != 'salary') { $sql .= " AND f.fk_soc = ".((int) $socid); } if (!$status) { - $sql .= " AND pfd.traite = 0"; + $sql .= " AND pd.traite = 0"; } - $sql .= " AND pfd.ext_payment_id IS NULL"; + $sql .= " AND pd.ext_payment_id IS NULL"; if ($status) { - $sql .= " AND pfd.traite = ".((int) $status); + $sql .= " AND pd.traite = ".((int) $status); } $sql .= " AND f.total_ttc > 0"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } if ($type != 'bank-transfer') { - $sql .= " AND pfd.fk_facture = f.rowid"; + $sql .= " AND pd.fk_facture = f.rowid"; } else { - $sql .= " AND pfd.fk_facture_fourn = f.rowid"; + $sql .= " AND pd.fk_facture_fourn = f.rowid"; } if ($search_facture) { $sql .= natural_search("f.ref", $search_facture); @@ -177,17 +177,30 @@ if ($sourcetype != 'salary') { } else { $sql = "SELECT s.rowid,s.amount as total_ttc, pd.amount,"; $sql .= " s.fk_user, pd.date_demande, pd.fk_salary, CONCAT(u.firstname,' ',u.lastname) as nom"; - $sql .= " FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."user as u, "; - $sql .= MAIN_DB_PREFIX."prelevement_demande as pd"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."user as u,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; $sql .= " WHERE s.rowid = pd.fk_salary"; $sql .= " AND u.rowid = s.fk_user"; - $sql .=" AND s.paye = 0 AND pd.traite = 0"; + $sql .= " AND s.entity IN (".getEntity("salary").")"; + /*if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { + $sql .= " AND s.statut = ".Salary::STATUS_UNPAID; + }*/ + if (!$status) { + $sql .= " AND pd.traite = 0"; + } + $sql .= " AND pd.ext_payment_id IS NULL"; + if ($status) { + $sql .= " AND pd.traite = ".((int) $status); + } + $sql .= " AND s.amount > 0"; + $sql .= " AND s.paye = ".Salary::STATUS_UNPAID; if ($search_facture) { $sql .= natural_search("s.rowid", $search_facture); } if ($search_societe) { $sql .= natural_search("CONCAT(u.firstname,' ',u.lastname)", $search_societe); } + //print $sql; } // Count total nb of records $nbtotalofrecords = ''; @@ -248,26 +261,41 @@ $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circl print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'; print $invoicestatic->getNomUrl(1, 'withdraw'); print '
'; @@ -242,14 +241,14 @@ if (isModEnabled('salaries')) { print ''; - print $user->getNomUrl(1); + print $user->getNomUrl(-1); print ''; print ''.price($objSalary->amount).''; print ''; + print ''; print dol_print_date($db->jdate($objSalary->date_demande), 'day'); print ''.$langs->trans("RUM").''.$langs->trans("AmountTTC").''; + if ($sourcetype == 'salary') { + print $langs->trans("Amount"); + } else { + print $langs->trans("AmountTTC"); + } + print ''.$langs->trans("DateRequest").''.dol_escape_htmltag($obj->rowid).''; From dc8616a110c31b8a2fcae9401a5e6776d96cffda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 11:12:44 +0100 Subject: [PATCH 213/323] Fix multicompany --- htdocs/salaries/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 2adf871244c..74c5705ea08 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -256,10 +256,11 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account ba ON (ba.rowid = s.fk_accoun //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON ps.fk_salary = s.rowid, "; $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = s.fk_user"; -$sql .= " AND s.entity IN (".getEntity('payment_salaries').")"; +$sql .= " AND s.entity IN (".getEntity('salaries').")"; if (!$user->hasRight('salaries', 'readall')) { $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")"; } +//print $sql; // Search criteria if ($search_ref) { From e5d9fb10e5e74e4f88076d00db5a7cccda9c550a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 13:12:07 +0100 Subject: [PATCH 214/323] Debug v19 --- htdocs/compta/paymentbybanktransfer/index.php | 5 ++++- .../prelevement/class/bonprelevement.class.php | 17 +++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 37de3bfbbbd..825a26fc3a7 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -144,7 +144,10 @@ if (isModEnabled('supplier_invoice')) { $sql .= " AND f.fk_soc = ".((int) $socid); } - $sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; + $sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd"; + $sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; + $sqlForSalary .= " AND s.entity IN (".getEntity('salary').")"; + $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 15fcb9e3a54..ecb706bf3fa 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -28,13 +28,14 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; @@ -761,9 +762,9 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."salary as s,"; } $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; - $sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('invoice').")"); + $sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")"); if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { - $sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = 0"); + $sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID); } if ($type !== 'salary') { if ($mode != 'bank-transfer') { From 1e2d06bf80ad62c69bc70ac6bfcb95543b3bc30f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 14:18:33 +0100 Subject: [PATCH 215/323] Debug v19 --- .../class/bonprelevement.class.php | 19 ++-- htdocs/compta/prelevement/create.php | 66 ++++++++------ htdocs/compta/prelevement/demandes.php | 86 +++++++++++++------ htdocs/user/card.php | 4 +- 4 files changed, 116 insertions(+), 59 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index ecb706bf3fa..ceb20ccacc4 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -961,7 +961,7 @@ class BonPrelevement extends CommonObject $sql .= ", f.ref, sr.bic, sr.iban_prefix, sr.frstrecur"; } else { $sql .= ", CONCAT(s.firstname,' ',s.lastname) as name"; - $sql .= ", f.ref, sr.bic, sr.iban_prefix"; + $sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur"; } if ($sourcetype != 'salary') { if ($type != 'bank-transfer') { @@ -977,21 +977,30 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."salary as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here + } + if ($sourcetype != 'salary') { + if ($type != 'bank-transfer') { + $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; + } else { + $sql .= " WHERE f.entity IN (".getEntity('supplier_invoice').')'; + } + } else { + $sql .= " WHERE f.entity IN (".getEntity('salary').')'; } - $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; if ($sourcetype != 'salary') { $sql .= " AND f.fk_statut = 1"; // Invoice validated $sql .= " AND f.paye = 0"; $sql .= " AND f.total_ttc > 0"; } else { + //$sql .= " AND f.fk_statut = 1"; // Invoice validated $sql .= " AND f.paye = 0"; $sql .= " AND f.amount > 0"; } $sql .= " AND pd.traite = 0"; $sql .= " AND pd.ext_payment_id IS NULL"; if ($sourcetype != 'salary') { - $sql .= " AND sr.type = 'ban' "; + $sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too } if ($did > 0) { $sql .= " AND pd.rowid = ".((int) $did); @@ -1003,7 +1012,7 @@ class BonPrelevement extends CommonObject $i = 0; while ($i < $num) { - $row = $this->db->fetch_row($resql); + $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() $factures[$i] = $row; // All fields if ($row[7] == 0) { diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 6d365a36dc4..aca57a79b1f 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2020 Laurent Destailleur + * Copyright (C) 2010-2023 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI @@ -31,6 +31,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -41,18 +42,18 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies', 'bills')); -$type = GETPOST('type', 'aZ09'); - // Get supervariables $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list - $mode = GETPOST('mode', 'alpha') ?GETPOST('mode', 'alpha') : 'real'; + +$type = GETPOST('type', 'aZ09'); +$sourcetype = GETPOST('sourcetype', 'aZ09'); $format = GETPOST('format', 'aZ09'); $id_bankaccount = GETPOST('id_bankaccount', 'int'); $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); -$sourcetype = GETPOST('sourcetype', 'alpha'); + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { @@ -101,7 +102,6 @@ if (empty($reshook)) { } if ($action == 'create') { $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT'); - $sourcetype = GETPOST('sourcetype', 'alpha'); //var_dump($default_account);var_dump($conf->global->$default_account);var_dump($id_bankaccount);exit; if ($id_bankaccount != getDolGlobalInt($default_account)) { @@ -221,7 +221,7 @@ if ($type) { } -if (!GETPOSTISSET('sourcetype')) { +if ($sourcetype != 'salary') { $nb = $bprev->nbOfInvoiceToPay($type); $pricetowithdraw = $bprev->SommeAPrelever($type); } else { @@ -260,16 +260,13 @@ if ($mesg) { } print '
'."\n"; -if (!GETPOSTISSET('sourcetype')) { - print '
'; -} else { - print ''; -} + +print ''; +print ''; print ''; print ''; -if (GETPOSTISSET('sourcetype')) { - print ''; -} +print ''; + if ($nb) { if ($pricetowithdraw) { $title = $langs->trans('BankToReceiveWithdraw').': '; @@ -363,40 +360,52 @@ print '
'; /* * Invoices waiting for withdraw */ -if (!GETPOSTISSET('sourcetype')) { +if ($sourcetype != 'salary') { $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,"; if ($type == 'bank-transfer') { $sql .= " f.ref_supplier,"; } - $sql .= " pfd.rowid as request_row_id, pfd.date_demande, pfd.amount"; + $sql .= " pd.rowid as request_row_id, pd.date_demande, pd.amount"; if ($type == 'bank-transfer') { $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } else { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; } $sql .= " ".MAIN_DB_PREFIX."societe as s,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } - //$sql .= " AND pfd.amount > 0"; + //$sql .= " AND pd.amount > 0"; $sql .= " AND f.total_ttc > 0"; // Avoid credit notes - $sql .= " AND pfd.traite = 0"; - $sql .= " AND pfd.ext_payment_id IS NULL"; + $sql .= " AND pd.traite = 0"; + $sql .= " AND pd.ext_payment_id IS NULL"; if ($type == 'bank-transfer') { - $sql .= " AND pfd.fk_facture_fourn = f.rowid"; + $sql .= " AND pd.fk_facture_fourn = f.rowid"; } else { - $sql .= " AND pfd.fk_facture = f.rowid"; + $sql .= " AND pd.fk_facture = f.rowid"; } if ($socid > 0) { $sql .= " AND f.fk_soc = ".((int) $socid); } } else { - $sql = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, "; - $sql .= MAIN_DB_PREFIX."prelevement_demande as pd"; - $sql .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0"; + $sql = "SELECT s.ref, s.rowid, s.amount, CONCAT(u.lastname, ' ', u.firstname) as name, u.rowid as uid,"; + $sql .= " pd.rowid as request_row_id, pd.date_demande, pd.amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s,"; + $sql .= " ".MAIN_DB_PREFIX."user as u,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; + $sql .= " WHERE s.fk_user = u.rowid"; + $sql .= " AND s.entity IN (".getEntity('salary').")"; + /*if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { + $sql .= " AND s.fk_statut = ".Facture::STATUS_VALIDATED; + }*/ + $sql .= " AND s.amount > 0"; + $sql .= " AND pd.traite = 0"; + $sql .= " AND pd.ext_payment_id IS NULL"; + $sql .= " AND s.rowid = pd.fk_salary AND s.paye = ".Salary::STATUS_UNPAID; + $sql .= " AND pd.traite = 0"; } $nbtotalofrecords = ''; @@ -522,8 +531,9 @@ if ($resql) { } else { $bac = new UserBankAccount($db); $bac->fetch(0, '', $obj->fk_user); + $salary = new Salary($db); - $salary->fetch($obj->fk_salary); + $salary->fetch($obj->rowid); } print '
'; - $user->fetch($obj->fk_user); + $user->fetch($obj->uid); print $user->getNomUrl(-1); print '
'; print ''; -print_liste_field_titre(($sourcetype ? "RefSalary" : "Bill"), $_SERVER["PHP_SELF"]); -print_liste_field_titre(($sourcetype ? "Employee" :"Company"), $_SERVER["PHP_SELF"]); -print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right '); -print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); -print_liste_field_titre(''); -print ''; - -print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''; print ''; print ''; print ''; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +print ''; + +print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre(''); +} +print_liste_field_titre(($sourcetype ? "RefSalary" : "Bill"), $_SERVER["PHP_SELF"]); +print_liste_field_titre(($sourcetype ? "Employee" :"Company"), $_SERVER["PHP_SELF"]); +print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'right '); +print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre(''); +} print ''; $userstatic = new User($db); @@ -287,6 +315,11 @@ while ($i < min($num, $limit)) { } print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Ref facture print ''; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; $i++; } -print "
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; if ($sourcetype != 'salary') { @@ -314,13 +347,18 @@ while ($i < min($num, $limit)) { print ''.dol_print_date($db->jdate($obj->date_demande), 'day').'

"; +print "
"; +print "
"; +print "
"; print ''; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 658e4cfef89..5df052b6a32 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -13,8 +13,8 @@ * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2023 Frédéric France - * Copyright (C) 2018 David Beniamine + * Copyright (C) 2018-2023 Frédéric France + * Copyright (C) 2018 David Beniamine * * 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 From 74ff2acc6cb22660a1d7baab98c8e82ff4500ca3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 15:03:45 +0100 Subject: [PATCH 216/323] Debug v19 --- .../class/bonprelevement.class.php | 31 ++++---- htdocs/compta/prelevement/create.php | 73 ++++++++++++++----- 2 files changed, 69 insertions(+), 35 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index ceb20ccacc4..03560536038 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1035,6 +1035,7 @@ class BonPrelevement extends CommonObject } if (!$error) { + // Make some checks require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; @@ -1086,14 +1087,20 @@ class BonPrelevement extends CommonObject //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); } else { if ($type != 'bank-transfer') { + $tmpsoc->id = $fac[2]; + $tmpsoc->name = $fac[8]; $invoice_url = "".$fac[9].""; - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); - $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); + $error++; } if ($type == 'bank-transfer' && $sourcetype != 'salary') { + $tmpsoc->id = $fac[2]; + $tmpsoc->name = $fac[8]; $invoice_url = "".$fac[9].""; - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); - $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $soc->getNomUrl(0); + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); + $error++; } if ($type == 'bank-transfer' && $sourcetype == 'salary') { $tmpuser->id = $fac[2]; @@ -1101,8 +1108,9 @@ class BonPrelevement extends CommonObject $salary_url = "".$fac[0].""; $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); + $error++; } - dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . join(', ', $fac) . " - " . $soc->name, LOG_WARNING); + dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . join(', ', $fac), LOG_WARNING); } } else { dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING); @@ -1220,18 +1228,11 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR); } } - if (!$error) { - /* - if ($type != 'bank-transfer') { - $fact = new Facture($this->db); - } else { - $fact = new FactureFournisseur($this->db); - } - */ + if (!$error) { // Add lines for the bon if (count($factures_prev) > 0) { - foreach ($factures_prev as $fac) { // Add a link in database for each invoice + foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary // Fetch invoice /* $result = $fact->fetch($fac[0]); @@ -1357,7 +1358,7 @@ class BonPrelevement extends CommonObject if (!$error) { $this->db->commit(); - return count($factures_prev); + return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error } else { $this->db->rollback(); return -1; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index aca57a79b1f..36b48ef5bde 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -70,10 +70,17 @@ if ($user->socid) { } if ($type == 'bank-transfer') { $result = restrictedArea($user, 'paymentbybanktransfer', '', '', ''); + + $permissiontoread = $user->hasRight('paymentbybanktransfer', 'read'); + $permissiontocreate = $user->hasRight('paymentbybanktransfer', 'create'); } else { $result = restrictedArea($user, 'prelevement', '', '', 'bons'); + + $permissiontoread = $user->hasRight('prelevement', 'bons', 'lire'); + $permissiontocreate = $user->hasRight('prelevement', 'bons', 'creer'); } + $error = 0; $option = ""; $mesg = ''; @@ -95,12 +102,14 @@ if ($reshook < 0) { if (empty($reshook)) { // Change customer bank information to withdraw + /* if ($action == 'modify') { for ($i = 1; $i < 9; $i++) { dolibarr_set_const($db, GETPOST("nom".$i), GETPOST("value".$i), 'chaine', 0, '', $conf->entity); } } - if ($action == 'create') { + */ + if ($action == 'create' && $permissiontocreate) { $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT'); //var_dump($default_account);var_dump($conf->global->$default_account);var_dump($id_bankaccount);exit; @@ -129,22 +138,41 @@ if (empty($reshook)) { // getDolGlobalString('PRELEVEMENT_CODE_BANQUE') and getDolGlobalString('PRELEVEMENT_CODE_GUICHET') should be empty (we don't use them anymore) $result = $bprev->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('PRELEVEMENT_CODE_GUICHET'), $mode, $format, $executiondate, 0, $type, 0, 0, $sourcetype); if ($result < 0) { - setEventMessages($bprev->error, $bprev->errors, 'errors'); - } elseif ($result == 0) { $mesg = ''; - if ($type != 'bank-transfer') { - $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); + + if ($bprev->error || !empty($bprev->errors)) { + setEventMessages($bprev->error, $bprev->errors, 'errors'); + } else { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorsOnXLines", count($bprev->invoice_in_error)), null, 'warnings'); } - if ($type == 'bank-transfer' && $sourcetype != 'salary') { - $mesg = $langs->trans("NoInvoiceCouldBeWithdrawedSupplier", $format); + + if (!empty($bprev->invoice_in_error)) { + foreach ($bprev->invoice_in_error as $key => $val) { + $mesg .= ''.$val."
\n"; + } } - if ($type == 'bank-transfer' && $sourcetype == 'salary') { - $mesg = $langs->trans("NoSalariesCouldBeWithdrawed", $format); + } elseif ($result == 0 || !empty($bprev->invoice_in_error)) { + $mesg = ''; + + if ($result == 0) { + if ($type != 'bank-transfer') { + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); + } + if ($type == 'bank-transfer' && $sourcetype != 'salary') { + $mesg = $langs->trans("NoInvoiceCouldBeWithdrawedSupplier", $format); + } + if ($type == 'bank-transfer' && $sourcetype == 'salary') { + $mesg = $langs->trans("NoSalariesCouldBeWithdrawed", $format); + } + setEventMessages($mesg, null, 'errors'); } - setEventMessages($mesg, null, 'errors'); - $mesg .= '
'."\n"; - foreach ($bprev->invoice_in_error as $key => $val) { - $mesg .= ''.$val."
\n"; + + if (!empty($bprev->invoice_in_error)) { + $mesg .= '
'."\n"; + foreach ($bprev->invoice_in_error as $key => $val) { + $mesg .= ''.$val."
\n"; + } } } else { if ($type != 'bank-transfer') { @@ -162,6 +190,7 @@ if (empty($reshook)) { } } } + $objectclass = "BonPrelevement"; if ($type == 'bank-transfer') { $uploaddir = $conf->paymentbybanktransfer->dir_output; @@ -255,10 +284,6 @@ print ''; print ''; print ''; -if ($mesg) { - print $mesg; -} - print '
'."\n"; print '
'; @@ -353,7 +378,13 @@ if ($nb) { print "
\n"; print "
\n"; -print ''; + +// Show errors or warnings +if ($mesg) { + print $mesg; + print '
'; +} + print '
'; @@ -530,7 +561,7 @@ if ($resql) { $invoicestatic->ref_supplier = $obj->ref_supplier; } else { $bac = new UserBankAccount($db); - $bac->fetch(0, '', $obj->fk_user); + $bac->fetch(0, '', $obj->uid); $salary = new Salary($db); $salary->fetch($obj->rowid); @@ -577,6 +608,7 @@ if ($resql) { print $user->getNomUrl(-1); print ''; } + // BAN print ''; if ($bac->id > 0) { @@ -594,7 +626,7 @@ if ($resql) { print ''; // RUM - if (empty($type) || $type == 'direc-debit') { + if (empty($type) || $type == 'direct-debit') { print ''; $rumtoshow = $thirdpartystatic->display_rib('rum'); if ($rumtoshow) { @@ -610,6 +642,7 @@ if ($resql) { } print ''; } + // Amount print ''; print price($obj->amount, 0, $langs, 0, 0, -1, $conf->currency); From fd846e3ad0da423093b20caaa6e656115276341a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 15:43:37 +0100 Subject: [PATCH 217/323] CSS v19 --- htdocs/holiday/class/holiday.class.php | 4 ++-- htdocs/theme/eldy/badges.inc.php | 11 ++++++++--- htdocs/theme/md/badges.inc.php | 10 ++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index d05e675d5de..2694b46cab6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1485,10 +1485,10 @@ class Holiday extends CommonObject $statusType = 'status1'; } if ($status == self::STATUS_CANCELED) { - $statusType = 'status5'; + $statusType = 'status9'; } if ($status == self::STATUS_REFUSED) { - $statusType = 'status5'; + $statusType = 'status9'; } return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode, '', $params); diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index aae4e50fb29..43a78873655 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -229,7 +229,6 @@ _createStatusBadgeCss('4b', '', "STATUS4b"); */ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentLabel = '', $cssPrefix = '') { - global ${$statusVarNamePrefix.'badgeStatus'.$statusName}, ${$statusVarNamePrefix.'badgeStatus_textColor'.$statusName}; if (!empty(${$statusVarNamePrefix.'badgeStatus'.$statusName})) { @@ -256,16 +255,21 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL $thisBadgeTextColor = '#777777'; } + // badge-statusX print $cssPrefix.".badge-status".$statusName." {\n"; print " color: ".$thisBadgeTextColor." !important;\n"; if (in_array((string) $statusName, $TBadgeBorderOnly)) { print " border-color: ".$thisBadgeBorderColor." !important;\n"; } - print " background-color: ".$thisBadgeBackgroundColor." !important;\n"; + if ($thisBadgeBackgroundColor != '') { + print " background-color: ".$thisBadgeBackgroundColor." !important;\n"; + } print "}\n"; print $cssPrefix.".font-status".$statusName." {\n"; - print " color: ".$thisBadgeBackgroundColor." !important;\n"; + if ($thisBadgeBackgroundColor != '') { + print " color: ".$thisBadgeBackgroundColor." !important;\n"; + } print "}\n"; print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n"; @@ -273,6 +277,7 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5)." !important;\n"; print "}\n"; + // badge-statusX:focus print $cssPrefix.".badge-status".$statusName.":focus, ".$cssPrefix.".badge-status".$statusName.":hover {\n"; print " color: ".$thisBadgeTextColor." !important;\n"; //print " background-color: " . colorDarker($thisBadgeBackgroundColor, 10) . ";\n"; diff --git a/htdocs/theme/md/badges.inc.php b/htdocs/theme/md/badges.inc.php index cfa1afbc9f2..fc8fabcc38a 100644 --- a/htdocs/theme/md/badges.inc.php +++ b/htdocs/theme/md/badges.inc.php @@ -259,18 +259,24 @@ function _createStatusBadgeCss($statusName, $statusVarNamePrefix = '', $commentL $thisBadgeTextColor = '#777777'; } + // badge-statusX print $cssPrefix.".badge-status".$statusName." {\n"; print " color: ".$thisBadgeTextColor." !important;\n"; if (in_array((string) $statusName, $TBadgeBorderOnly)) { print " border-color: ".$thisBadgeBorderColor." !important;\n"; } - print " background-color: ".$thisBadgeBackgroundColor." !important;\n"; + if ($thisBadgeBackgroundColor != '') { + print " background-color: ".$thisBadgeBackgroundColor." !important;\n"; + } print "}\n"; print $cssPrefix.".font-status".$statusName." {\n"; - print " color: ".$thisBadgeBackgroundColor." !important;\n"; + if ($thisBadgeBackgroundColor != '') { + print " color: ".$thisBadgeBackgroundColor." !important;\n"; + } print "}\n"; + // badge-statusX:focus print $cssPrefix.".badge-status".$statusName.".focus, ".$cssPrefix.".badge-status".$statusName.":focus {\n"; print " outline: 0;\n"; print " box-shadow: 0 0 0 0.2rem ".colorHexToRgb($thisBadgeBackgroundColor, 0.5)." !important;\n"; From d71e3962062999658895271d4a1e97cec959c82c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Nov 2023 15:51:31 +0100 Subject: [PATCH 218/323] css --- htdocs/admin/mails_templates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 851bb6bcbfd..114f2f3b7cd 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -934,7 +934,7 @@ foreach ($fieldlist as $field => $value) { if ($value == 'module') { print ''; } elseif ($value == 'label') { - print ''; + print ''; } elseif ($value == 'lang') { print ''; print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100'); @@ -1227,7 +1227,7 @@ if ($num) { $valuetoshow = dol_escape_htmltag($valuetoshow); } if ($value == 'label') { - $class .= ' tdoverflowmax100'; + $class .= ' tdoverflowmax200'; } if ($value == 'topic') { $class .= ' tdoverflowmax200 small'; From f5cf5b639951fa50bb4d36f4ab6b6aad9ec95095 Mon Sep 17 00:00:00 2001 From: jyhere Date: Tue, 7 Nov 2023 11:50:28 -0500 Subject: [PATCH 219/323] CHANGE: Allow local media in wysiwyg if dolibarr on private network (#26494) --- htdocs/core/lib/functions2.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 394a341aa7f..f3fd9188972 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2880,10 +2880,12 @@ function acceptLocalLinktoMedia() } //var_dump($iptocheck.' '.$acceptlocallinktomedia); - if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + $allowParamName = 'MAIN_ALLOW_WYSIWYG_LOCAL_MEDIAS_ON_PRIVATE_NETWORK'; + $allowPrivateNetworkIP = getDolGlobalInt($allowParamName); + if (!$allowPrivateNetworkIP && !filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { // If ip of public url is a private network IP, we do not allow this. $acceptlocallinktomedia = 0; - // TODO Show a warning + setEventMessage("WYSIWYG Editor : local media not allowed (checked IP: {$iptocheck}). Use {$allowParamName} = 1 to allow local network ip", 'warnings'); } if (preg_match('/http:/i', $urlwithouturlroot)) { From b5e5b1d4c63de0861f7d0c98abb91c95501672ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= <121813548+altairis-benjamin@users.noreply.github.com> Date: Tue, 7 Nov 2023 17:50:48 +0100 Subject: [PATCH 220/323] FIX commande context (#26497) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Falière --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a8325503060..bf39beba029 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -469,7 +469,7 @@ if (empty($reshook)) { $array_options = $lines[$i]->array_options; } - $objecttmp->context['createfromclone']; + $objecttmp->context['createfromclone'] = 'createfromclone'; $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang; //there may already be rows from previous orders From 1e053e4d7f4f2ca327da3a75757915ba950e7701 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Tue, 7 Nov 2023 17:58:35 +0100 Subject: [PATCH 221/323] fix-warnings-1 (#26490) --- .../sociales/class/cchargesociales.class.php | 12 ++++---- .../sociales/class/chargesociales.class.php | 6 ++-- .../class/paymentsocialcontribution.class.php | 20 +++++++++++++ htdocs/compta/tva/class/paymentvat.class.php | 20 +++++++++++++ htdocs/compta/tva/class/tva.class.php | 20 +++++++++++++ htdocs/core/class/commoninvoice.class.php | 28 +++++++++++++++++++ 6 files changed, 97 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 371c3ffeb68..0825f223f19 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -366,7 +366,7 @@ class Cchargesociales * @param int $fromid Id of object to clone * @return int New id of clone */ - public function createFromClone(User $user, $fromid) + /*public function createFromClone(User $user, $fromid) { dol_syslog(__METHOD__, LOG_DEBUG); @@ -406,7 +406,7 @@ class Cchargesociales return -1; } - } + }*/ /** * Return a link to the user card (with optionaly the picto) @@ -419,7 +419,7 @@ class Cchargesociales * @param string $morecss Add more css on link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') + /*public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') { global $langs, $conf, $db; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -446,7 +446,7 @@ class Cchargesociales } $result .= $link.$this->ref.$linkend; return $result; - } + }*/ /** * Return the label of the status @@ -454,10 +454,10 @@ class Cchargesociales * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - public function getLibStatut($mode = 0) + /*public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); - } + }*/ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index fb43c8a526a..ac32bbebecc 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -741,9 +741,9 @@ class ChargeSociales extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen = 1; $this->paye = 0; - $this->date = dol_now(); - $this->date_ech = $this->date + 3600 * 24 * 30; - $this->periode = $this->date + 3600 * 24 * 30; + $this->date_creation = dol_now(); + $this->date_ech = $this->date_creation + 3600 * 24 * 30; + $this->periode = $this->date_creation + 3600 * 24 * 30; $this->amount = 100; $this->label = 'Social contribution label'; $this->type = 1; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index a798eee92bb..1020b4cec00 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -61,6 +61,26 @@ class PaymentSocialContribution extends CommonObject public $tms = ''; public $datep = ''; + /** + * @var string + */ + public $type_code; + + /** + * @var string + */ + public $type_label; + + /** + * @var int + */ + public $bank_account; + + /** + * @var int + */ + public $bank_line; + /** * @deprecated * @see $amount diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index c7e59c640b5..a03d031e8c7 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -113,6 +113,26 @@ class PaymentVAT extends CommonObject */ public $datepaye; + /** + * @var string + */ + public $type_code; + + /** + * @var string + */ + public $type_label; + + /** + * @var int + */ + public $bank_account; + + /** + * @var int + */ + public $bank_line; + /** * @var integer|string paiementtype */ diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c888f438f54..3ff2b6178e7 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -62,6 +62,26 @@ class Tva extends CommonObject public $type_payment; public $num_payment; + /** + * @var DateTime + */ + public $datec; + + /** + * @var int ID + */ + public $fk_type; + + /** + * @var int + */ + public $paye; + + /** + * @var int + */ + public $rappro; + /** * @var integer|string totalpaid */ diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 7540dbe8ef3..c1e9c9afeae 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -100,6 +100,34 @@ abstract class CommonInvoice extends CommonObject public $multicurrency_total_tva; public $multicurrency_total_ttc; + /** + * @var int + */ + public $stripechargedone; + + /** + * @var int + */ + public $stripechargeerror; + + /** + * Payment description + * @var string + */ + public $description; + + /** + * @var string + * @deprecated + * @see $ref_customer + */ + public $ref_client; + + /** + * @var int Situation cycle reference number + */ + public $situation_cycle_ref; + /** * ! Closing after partial payment: discount_vat, badsupplier, abandon * ! Closing when no payment: replaced, abandoned From 57d6aee0d93c10d6b1d2faf82336f3c288e4c2d2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 7 Nov 2023 17:58:52 +0100 Subject: [PATCH 222/323] add hook tabContentCreateThirdparty (#26489) Co-authored-by: Christophe Battarel --- htdocs/societe/card.php | 1042 ++++++++++++++++++++------------------- 1 file changed, 524 insertions(+), 518 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 335965e385a..88ede0abc77 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1208,572 +1208,578 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print dol_get_fiche_head(null, 'card', '', 0, ''); - print ''; + // Call Hook tabContentCreateThirdparty + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentCreateThirdparty', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - // Name, firstname - print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; + // Name, firstname + print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; - print ''; - print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); // For some countries that need the company name in 2 languages - // This implementation of the feature to search already existing company has been disabled. It must be implemented by keeping the "input text" and we must call the search ajax societe/ajax/ajaxcompanies.php - // on a keydown of the input. We should show data about a duplicate found if we found less than 5 answers into a div under the input. - /* - print ''; - print "\n".' - '; - */ - print ''; - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; - } - print ''; - - // If javascript on, we show option individual - if ($conf->use_javascript_ajax) { - if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { - // Firstname - print ''; - print ''; - print ''; - - // Title - print ''; - print ''; - } - } - - // Alias names (commercial, trademark or alias names) - print ''; - print ''; - - // Prospect/Customer - print ''; - print ''; - - if ($conf->browser->layout == 'phone') { - print ''; - } - - print ''; - - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field + print ''; + } + print ''; + // If javascript on, we show option individual + if ($conf->use_javascript_ajax) { + if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { + // Firstname + print ''; + print ''; + print ''; + + // Title + print ''; + print ''; + } + } + + // Alias names (commercial, trademark or alias names) + print ''; + print ''; + + // Prospect/Customer + print ''; + print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''; } + + // Status + print ''; - } - // Status - print ''; + // Barcode + if (isModEnabled('barcode')) { + print ''; + print ''; + } - // Barcode - if (isModEnabled('barcode')) { - print ''; + // Address + print ''; print ''; - } - // Address - print ''; - print ''; + // Zip / Town + print ''; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; - // Zip / Town - print ''; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; + // Country + print ''; - // Country - print ''; + // State + if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + print ''; } + // Phone / Fax + print ''; + print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' '; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; + print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' '; + + // Email / Web + print ''; + print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' '; + if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; + print ''; + } + print ''; + print ''; + print ''; + + // Unsubscribe + if (isModEnabled('mailing')) { + if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { + print "\n".''."\n"; + } + if (!GETPOSTISSET("no_email") && !empty($object->email)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + print ''; + print ''; + print ''; + print ''; + } + + // Social networks + if (isModEnabled('socialnetworks')) { + $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4)); + } + + // Prof ids + $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); + while ($i <= 6) { + $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof != '-') { + $key = 'idprof'.$i; + + if (($j % $NBCOLS) == 0) { + print ''; + } + + $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; + print ''; + if (($j % $NBCOLS) == ($NBCOLS - 1)) { + print ''; + } + $j++; + } + $i++; + } + if ($NBCOLS > 1 && ($j % 2 == 1)) { + print ''; + } + + // Vat is used + print ''; + print ''; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; + print ''; + print ''; + + // VAT reverse charge by default + if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + print ''; + } + + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { + print ''; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; + } elseif ($mysoc->localtax1_assuj == "1") { + print ''; + } elseif ($mysoc->localtax2_assuj == "1") { + print ''; + } + + // Type - Workforce/Staff + print ''; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''; + + // Legal Form + print ''; + print ''; - } - // Phone / Fax - print ''; - print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' '; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' '; - - // Email / Web - print ''; - print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' '; - if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - print ''; - } - print ''; - print ''; - print ''; - - // Unsubscribe - if (isModEnabled('mailing')) { - if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { - print "\n".''."\n"; - } - if (!GETPOSTISSET("no_email") && !empty($object->email)) { - $result = $object->getNoEmail(); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - print ''; - print ''; - print ''; - print ''; - } - - // Social networks - if (isModEnabled('socialnetworks')) { - $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4)); - } - - // Prof ids - $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); - while ($i <= 6) { - $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { - $key = 'idprof'.$i; - - if (($j % $NBCOLS) == 0) { - print ''; - } - - $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; - if (($j % $NBCOLS) == ($NBCOLS - 1)) { - print ''; - } - $j++; - } - $i++; - } - if ($NBCOLS > 1 && ($j % 2 == 1)) { - print ''; - } - - // Vat is used - print ''; - print ''; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - print ''; + print ''; } else { - $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + print ''.$langs->trans("Currency".$conf->currency).''; } - } - print $s; - print ''; - print ''; - - // VAT reverse charge by default - if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { - print ''; - } - - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { - print ''; - if ($conf->browser->layout == 'phone') { - print ''; + if (getDolGlobalInt('MAIN_MULTILANGS')) { + print ''; + print ''; } - print ''; - } elseif ($mysoc->localtax1_assuj == "1") { - print ''; - } elseif ($mysoc->localtax2_assuj == "1") { - print ''; - } - // Type - Workforce/Staff - print ''; - if ($conf->browser->layout == 'phone') { - print ''; + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''; + print ''; } - print '"; + + if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { + print '"; + } + + // Supplier + if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { + print '"; + } } - } else { - print ''; - } - print ''; - // Legal Form - print ''; - print ''; + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''; + print ''; + } - // Capital - print ''; - print ''; - } else { - print ''.$langs->trans("Currency".$conf->currency).''; - } - if (getDolGlobalInt('MAIN_MULTILANGS')) { - print ''; + print ''; + print ''; + } + + // Assign a sale representative + print ''; + print ''; + print ''; + + // Add logo + print ''; + print ''; + print ''; print ''; - } - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''; - print ''; - } + print '
'; - if ($object->particulier || $private) { - print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; - } else { - print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; - } - print '
'; + if ($object->particulier || $private) { + print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; + } else { + print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; + } + print ''.$langs->trans('Prefix').'
'.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).'
'.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; - print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - $selected = (GETPOSTISSET('client') ?GETPOST('client', 'int') : $object->client); - print $formcompany->selectProspectCustomerType($selected); - print '
'.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; - 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('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).''; - $default = -1; - if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) { - $default = 1; - } - print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ? GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0), 1); + + '; + */ print ''.$langs->trans('Prefix').'
'.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).'
'.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; + print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; + $selected = (GETPOSTISSET('client') ?GETPOST('client', 'int') : $object->client); + print $formcompany->selectProspectCustomerType($selected); + print '
'; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + print ''; + + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 '
'; + $tmpcode = $object->code_client; + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($object, 0); } + print ''; print ''; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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); + $s = $modCodeClient->getToolTip($langs, $object, 0); + print $form->textwithpicto('', $s, 1); + print '
'; + print '
'.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).''; + $default = -1; + if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) { + $default = 1; + } + print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ? GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0), 1); + print '
'; + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 ''; print ''; - $s = $modCodeFournisseur->getToolTip($langs, $object, 1); - print $form->textwithpicto('', $s, 1); - print '
'; + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); - print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; + print img_picto('', 'barcode', 'class="pictofixedwidth"'); + print ''; + print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).'
'; + print $form->editfieldkey('Address', 'address', '', $object, 0); + print ''; - print img_picto('', 'barcode', 'class="pictofixedwidth"'); - print ''; + print ''; + print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); print '
'; - print $form->editfieldkey('Address', 'address', '', $object, 0); - print ''; - print ''; - print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); - print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100'); + print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth150 quatrevingtpercent'); + print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; - print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100'); - print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; - print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth150 quatrevingtpercent'); - print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); - print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; + print img_picto('', 'country', 'class="pictofixedwidth"'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; - print img_picto('', 'country', 'class="pictofixedwidth"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; + } else { + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; + } - // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { - print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } else { - print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; + if ($object->country_id) { + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state($object->state_id, $object->country_code); + } else { + print $countrynotdefined; + } + print '
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).''.img_picto('', 'globe', 'class="pictofixedwidth"').'
'; + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2)); + print '
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).''; + + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); + print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; + print ''; // Assujeti par defaut en creation + print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; + $s = ''; + + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { + $s .= ' '; + + if (!empty($conf->use_javascript_ajax)) { + $widthpopup = 600; + if (!empty($conf->dol_use_jmobile)) { + $widthpopup = 350; + } + $heightpopup = 400; + print "\n"; + print ''; + print "\n"; + $s .= ''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); + } else { + $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } + } + print $s; + print '
' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ''; + print 'vat_reverse_charge == '1' ? ' checked' : '').'>'; + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print 'global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">'; + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print 'global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">'; + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print 'global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">'; + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print 'global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">'; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n"; + $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); + if ($user->admin) { + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { + print '
'.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) { + print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + } else { + print ''; + } + print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; if ($object->country_id) { - print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state($object->state_id, $object->country_code); + print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); } else { print $countrynotdefined; } print '
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).''.img_picto('', 'globe', 'class="pictofixedwidth"').'
'; - print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2)); - print '
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).''; - - print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); - print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; - print ''; // Assujeti par defaut en creation - print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; - $s = ''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { - $s .= ' '; - - if (!empty($conf->use_javascript_ajax)) { - $widthpopup = 600; - if (!empty($conf->dol_use_jmobile)) { - $widthpopup = 350; - } - $heightpopup = 400; - print "\n"; - print ''; - print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); + // Capital + print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; + if (isModEnabled("multicurrency")) { + print ''.$langs->trans("Currency".$object->multicurrency_code).'
' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ''; - print 'vat_reverse_charge == '1' ? ' checked' : '').'>'; - print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print 'global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">'; - print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print 'global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">'; - print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print 'global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">'; - print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print 'global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">'; - print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n"; - $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1); - if ($user->admin) { - print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { - print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); + print '
'.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); - if ($user->admin) { - print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + + // Categories + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { + $langs->load('categories'); + + // Customer + print '
'.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print "
'.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print "
'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print "
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; - if ($object->country_id) { - print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); - } else { - print $countrynotdefined; - } - print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx'); + print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; - if (isModEnabled("multicurrency")) { - print ''.$langs->trans("Currency".$object->multicurrency_code).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + // Other attributes + $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print '
'.$langs->trans('ParentCompany').''; + print img_picto('', 'company', 'class="paddingrightonly"'); + print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; + $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', '0', 0, 0, 'AND u.statut = 1', 0, '', '', 0, 2); + // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); + print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print '
'.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; + print ''; print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); - print '
'."\n"; - // Categories - if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { - $langs->load('categories'); + // Accountancy codes + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + print ''; - // Customer - print '"; + if (isModEnabled('accounting')) { + // Accountancy_code_sell + print ''; + print ''; - if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { - print '"; + // Accountancy_code_buy + print ''; + print ''; + } else { // For external software + // Accountancy_code_sell + print ''; + print ''; + + // Accountancy_code_buy + print ''; + print ''; + } + + print '
'.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print "
'.$langs->trans("ProductAccountancySellCode").''; + $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); + print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, ''); + print '
'.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print "
'.$langs->trans("ProductAccountancyBuyCode").''; + $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); + print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); + print '
'.$langs->trans("ProductAccountancySellCode").''; + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print '
'; } - - // Supplier - if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print ""; - } - } - - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print ''; - print img_picto('', 'currency', 'class="pictofixedwidth"'); - print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx'); - print ''; - } - - // Other attributes - $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - - // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { - print ''; - print ''.$langs->trans('ParentCompany').''; - print ''; - print img_picto('', 'company', 'class="paddingrightonly"'); - print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); - print ''; - } - - // Assign a sale representative - print ''; - print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; - print ''; - $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', '0', 0, 0, 'AND u.statut = 1', 0, '', '', 0, 2); - // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); - print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print ''; - - // Add logo - print ''; - print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; - print ''; - print ''; - print ''; - print ''; - - print ''."\n"; - - // Accountancy codes - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - print ''; - - if (isModEnabled('accounting')) { - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - } else { // For external software - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - } - - print '
'.$langs->trans("ProductAccountancySellCode").''; - $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); - print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, ''); - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); - print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); - print '
'.$langs->trans("ProductAccountancySellCode").''; - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print '
'; } print dol_get_fiche_end(); From 221f497e0f46467e75d7a413647049f8583f0445 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 7 Nov 2023 17:59:05 +0100 Subject: [PATCH 223/323] add hook tabContentViewThirdparty (#26488) Co-authored-by: Christophe Battarel --- htdocs/societe/card.php | 847 ++++++++++++++++++++-------------------- 1 file changed, 426 insertions(+), 421 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 88ede0abc77..b4e8b692e4d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2621,467 +2621,472 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + // Call Hook tabContentViewThirdparty + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentViewThirdparty', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; + print '
'; - print '
'; - print '
'; + print '
'; + print ''; - print '
'; - print '
'; + // Type Prospect/Customer/Supplier + print ''; - // Type Prospect/Customer/Supplier - print ''; - - // Prefix - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; - print ''; - } - - // Customer code - if ($object->client) { - print ''; - print ''; - print ''; - } - - // Supplier code - if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) { - print ''; - print ''; - } - - // Barcode - if (isModEnabled('barcode')) { - print ''; - print ''; - } - - // Prof ids - $i = 1; $j = 0; - while ($i <= 6) { - $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { - //if (($j % 2) == 0) print ''; - print ''; - print ''; - //if (($j % 2) == 1) print ''; + // Prefix + if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field + print ''; print ''; - $j++; } - $i++; - } - //if ($j % 2 == 1) print ''; - - // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier. - // We don't need them into customer profile. - // Except for spain and localtax where localtax depends on buyer and not seller - - if ($object->fournisseur) { - // VAT is used - print ''; - print ''; - - if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { - // VAT reverse charge by default + // Customer code + if ($object->client) { print ''; + print ''; print ''; } - } - // Local Taxes - if ($object->fournisseur || $mysoc->country_code == 'ES') { - if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { - print ''; - - if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { - print ''; - print ''; - print ''; - print ''; - if ($action == 'editRE') { - print ''; - } else { - print ''; - } - print ''; - } - if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { - print ''; - print ''; - print ''; - print ''; - if ($action == 'editIRPF') { - print ''; - } else { - print ''; - } - print ''; - } - } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { - print ''; - if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { - print ''; - print ''; - print ''; - print ''; - if ($action == 'editRE') { - print ''; - } else { - print ''; - } - print ''; - } - } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { - print ''; - if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { - print ''; - print ''; - print ''; - print ''; - if ($action == 'editIRPF') { - print ''; - } else { - print ''; - } - print ''; - } - } - } - - // Sale tax code (VAT code) - print ''; - print ''; - - // Warehouse - if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { - $langs->load('stocks'); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('NatureOfThirdParty').''; + print $object->getTypeUrl(1); + print '
'.$langs->trans('NatureOfThirdParty').''; - print $object->getTypeUrl(1); - print '
'.$langs->trans('Prefix').''.dol_escape_htmltag($object->prefix_comm).'
'; - print $langs->trans('CustomerCode'); - print ''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); - $tmpcheck = $object->check_codeclient(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; - } - print '
'; - print $langs->trans('SupplierCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); - $tmpcheck = $object->check_codefournisseur(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; - } - print '
'; - print $langs->trans('Gencod').''.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode)); - print '
'.$idprof.''; - $key = 'idprof'.$i; - print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1); - if ($object->$key) { - if ($object->id_prof_check($i, $object) > 0) { - if (!empty($object->id_prof_url($i, $object))) { - print '   '.$object->id_prof_url($i, $object); - } - } else { - print ' ('.$langs->trans("ErrorWrongValue").')'; - } - } - print '
'.$langs->trans('Prefix').''.dol_escape_htmltag($object->prefix_comm).'
'; - print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling')); - print ''; - print yn($object->tva_assuj); - print '
'; - print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc')); - print ''; - print 'vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>'; + print $langs->trans('CustomerCode'); + print ''; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("Localtax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("Localtax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->trans('VATIntra').''; - if ($object->tva_intra) { - $s = ''; - $s .= dol_print_profids($object->tva_intra, 'VAT', $object->country_code, 1); - $s .= ''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { - $s .= '   '; - - if ($conf->use_javascript_ajax) { - $widthpopup = 600; - if (!empty($conf->dol_use_jmobile)) { - $widthpopup = 350; - } - $heightpopup = 400; - print "\n"; - print ''; - print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } else { - $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; - } else { - print ' '; - } - print '
'; - print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer')); - print ''; - if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1); - } else { - if ($object->fk_warehouse > 0) { - print img_picto('', 'stock', 'class="paddingrightonly"'); - } - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none'); - } - print '
'; - print '
'; - - print '
'; - - print '
'; - print ''; - - // Tags / categories - if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { - // Customer - if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) { - print ''; - print '"; - } - - // Supplier + // Supplier code if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) { - print ''; - print '"; - } - } - - - // Third-Party Type - print ''; - - // Workforce/Staff - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { - print ''; - } - - // Legal - print ''; - - // Capital - print ''; - - // Unsubscribe opt-out - if (isModEnabled('mailing')) { - $result = $object->getNoEmail(); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - print ''; + print ''; } - $langs->load("mails"); - print '   '.$object->getNbOfEMailings().''; - - print ''; - } - - // Default language - if (getDolGlobalInt('MAIN_MULTILANGS')) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print ''; - } - - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - } - // Multicurrency - if (isModEnabled("multicurrency")) { + // Prof ids + $i = 1; $j = 0; + while ($i <= 6) { + $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof != '-') { + //if (($j % 2) == 0) print ''; + print ''; + print ''; + //if (($j % 2) == 1) print ''; + print ''; + $j++; + } + $i++; + } + //if ($j % 2 == 1) print ''; + + + // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier. + // We don't need them into customer profile. + // Except for spain and localtax where localtax depends on buyer and not seller + + if ($object->fournisseur) { + // VAT is used + print ''; + print ''; + + if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + // VAT reverse charge by default + print ''; + print ''; + } + } + + // Local Taxes + if ($object->fournisseur || $mysoc->country_code == 'ES') { + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { + print ''; + + if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { + print ''; + print ''; + print ''; + print ''; + if ($action == 'editRE') { + print ''; + } else { + print ''; + } + print ''; + } + if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { + print ''; + print ''; + print ''; + print ''; + if ($action == 'editIRPF') { + print ''; + } else { + print ''; + } + print ''; + } + } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { + print ''; + if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { + print ''; + print ''; + print ''; + print ''; + if ($action == 'editRE') { + print ''; + } else { + print ''; + } + print ''; + } + } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { + print ''; + if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { + print ''; + print ''; + print ''; + print ''; + if ($action == 'editIRPF') { + print ''; + } else { + print ''; + } + print ''; + } + } + } + + // Sale tax code (VAT code) print ''; - print ''; - print ''; - } + print ''; - // Accountancy buy code - print ''; + print ''; + print ''; } - print ''; - } - // Other attributes - $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + print '
'.$langs->trans("CustomersCategoriesShort").''; - print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); - print "
'.$langs->trans("SuppliersCategoriesShort").''; - print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); - print "
'; - print ''; - if ($action != 'editthirdpartytype' && $user->hasRight('societe', 'creer')) { - print ''; - } - print '
'.$langs->trans('ThirdPartyType').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - $html_name = ($action == 'editthirdpartytype') ? 'typent_id' : 'none'; - $formcompany->formThirdpartyType($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->typent_id, $html_name, ''); - print '
'.$langs->trans("Workforce").''.$object->effectif.'
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; - if ($object->capital) { - if (isModEnabled("multicurrency") && !empty($object->multicurrency_code)) { - print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code); - } else { - print price($object->capital, '', $langs, 0, -1, -1, $conf->currency); - } - } else { - print ' '; - } - print '
'.$langs->trans("No_Email").''; - if ($object->email) { - print yn($object->no_email); - } else { - print ''.$langs->trans("EMailNotDefined").''; + print '
'; + print $langs->trans('SupplierCode').''; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print '
'.$langs->trans("DefaultLang").''; - //$s=picto_from_langcode($object->default_lang); - //print ($s?$s.' ':''); - $langs->load("languages"); - $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); - print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"'); - print $labellang; - print '
'; - print ''; - if ($action != 'editincoterm' && $user->hasRight('societe', 'creer')) { - print ''; + // Barcode + if (isModEnabled('barcode')) { + print ''; + print ''; } - print '
'.$langs->trans('IncotermLabel').''.img_edit('', 1).'
'; + print $langs->trans('Gencod').''.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode)); + print '
'; - print '
'; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id); - } - print '
'.$idprof.''; + $key = 'idprof'.$i; + print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1); + if ($object->$key) { + if ($object->id_prof_check($i, $object) > 0) { + if (!empty($object->id_prof_url($i, $object))) { + print '   '.$object->id_prof_url($i, $object); + } + } else { + print ' ('.$langs->trans("ErrorWrongValue").')'; + } + } + print '
'; + print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling')); + print ''; + print yn($object->tva_assuj); + print '
'; + print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc')); + print ''; + print 'vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>'; + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("Localtax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("Localtax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : ''; - print '
'.$langs->trans('VATIntra').''; + if ($object->tva_intra) { + $s = ''; + $s .= dol_print_profids($object->tva_intra, 'VAT', $object->country_code, 1); + $s .= ''; - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - // Accountancy sell code - print '
'; - print $langs->trans("ProductAccountancySellCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_sell)) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $object->accountancy_code_sell, 1); + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { + $s .= '   '; - print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (!empty($conf->dol_use_jmobile)) { + $widthpopup = 350; + } + $heightpopup = 400; + print "\n"; + print ''; + print "\n"; + $s .= ''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); + } else { + $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } } + print $s; } else { - print $object->accountancy_code_sell; + print ' '; } print '
'; - print $langs->trans("ProductAccountancyBuyCode"); - print ''; - if (isModEnabled('accounting')) { - if (!empty($object->accountancy_code_buy)) { - $accountingaccount2 = new AccountingAccount($db); - $accountingaccount2->fetch('', $object->accountancy_code_buy, 1); - - print $accountingaccount2->getNomUrl(0, 1, 1, '', 1); + // Warehouse + if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { + $langs->load('stocks'); + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + print '
'; + print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer')); + print ''; + if ($action == 'editwarehouse') { + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1); + } else { + if ($object->fk_warehouse > 0) { + print img_picto('', 'stock', 'class="paddingrightonly"'); + } + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none'); } - } else { - print $object->accountancy_code_buy; + print '
'; + print '
'; - // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print '
'; + + print '
'; + print ''; + + // Tags / categories + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { + // Customer + if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) { + print ''; + print '"; + } + + // Supplier + if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) { + print ''; + print '"; + } + } + + + // Third-Party Type print ''; - } - // Sales representative - include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; + // Workforce/Staff + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { + print ''; + } - // Module Adherent - if (isModEnabled('adherent')) { - $langs->load("members"); - print ''; - print ''; + + // Capital + print '\n"; - } + print ''; - // Link user (you must create a contact to get a user) - /* - print ''; } + + // Default language + if (getDolGlobalInt('MAIN_MULTILANGS')) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + } + + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''; + print ''; + } + + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + // Accountancy sell code + print ''; + + // Accountancy buy code + print ''; + } + + // Other attributes + $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print ''; + } + + // Sales representative + include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; + + // Module Adherent + if (isModEnabled('adherent')) { + $langs->load("members"); + print ''; + print '\n"; + } + + // Link user (you must create a contact to get a user) + /* + print ''; + */ + + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''; + print ''; + } + + print '
'.$langs->trans("CustomersCategoriesShort").''; + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); + print "
'.$langs->trans("SuppliersCategoriesShort").''; + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); + print "
'; - print ''; - if ($action != 'editparentcompany' && $user->hasRight('societe', 'creer')) { - print ''; + print '
'.$langs->trans('ParentCompany').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + if ($action != 'editthirdpartytype' && $user->hasRight('societe', 'creer')) { + print ''; } print '
'.$langs->trans('ThirdPartyType').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; print '
'; - $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none'; - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, $html_name, '', 1, 0, 0, null, 0, array($object->id)); + $html_name = ($action == 'editthirdpartytype') ? 'typent_id' : 'none'; + $formcompany->formThirdpartyType($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->typent_id, $html_name, ''); print '
'.$langs->trans("Workforce").''.$object->effectif.'
'.$langs->trans("LinkedToDolibarrMember").''; - $adh = new Adherent($db); - $result = $adh->fetch('', '', $object->id); - if ($result > 0) { - $adh->ref = $adh->getFullName($langs); - print $adh->getNomUrl(-1); + // Legal + print '
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; + if ($object->capital) { + if (isModEnabled("multicurrency") && !empty($object->multicurrency_code)) { + print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code); + } else { + print price($object->capital, '', $langs, 0, -1, -1, $conf->currency); + } } else { - print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; + print ' '; } - print "
'.$langs->trans("DolibarrLogin").''; - if ($object->user_id) { - $dolibarr_user = new User($db); - $result = $dolibarr_user->fetch($object->user_id); - print $dolibarr_user->getLoginUrl(-1); - } else { - //print ''.$langs->trans("NoDolibarrAccess").''; - if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) { - print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").''; + // Unsubscribe opt-out + if (isModEnabled('mailing')) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + print '
'.$langs->trans("No_Email").''; + if ($object->email) { + print yn($object->no_email); + } else { + print ''.$langs->trans("EMailNotDefined").''; + } + + $langs->load("mails"); + print '   '.$object->getNbOfEMailings().''; + + print '
'.$langs->trans("DefaultLang").''; + //$s=picto_from_langcode($object->default_lang); + //print ($s?$s.' ':''); + $langs->load("languages"); + $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); + print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"'); + print $labellang; + print '
'; + print ''; + if ($action != 'editincoterm' && $user->hasRight('societe', 'creer')) { + print ''; + } + print '
'.$langs->trans('IncotermLabel').''.img_edit('', 1).'
'; + print '
'; + if ($action != 'editincoterm') { + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); + } else { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id); + } + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : ''; + print '
'; + print $langs->trans("ProductAccountancySellCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_sell)) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch('', $object->accountancy_code_sell, 1); + + print $accountingaccount->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_sell; + } + print '
'; + print $langs->trans("ProductAccountancyBuyCode"); + print ''; + if (isModEnabled('accounting')) { + if (!empty($object->accountancy_code_buy)) { + $accountingaccount2 = new AccountingAccount($db); + $accountingaccount2->fetch('', $object->accountancy_code_buy, 1); + + print $accountingaccount2->getNomUrl(0, 1, 1, '', 1); + } + } else { + print $object->accountancy_code_buy; + } + print '
'; + print ''; + if ($action != 'editparentcompany' && $user->hasRight('societe', 'creer')) { + print ''; + } + print '
'.$langs->trans('ParentCompany').'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + print '
'; + $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none'; + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, $html_name, '', 1, 0, 0, null, 0, array($object->id)); + print '
'.$langs->trans("LinkedToDolibarrMember").''; + $adh = new Adherent($db); + $result = $adh->fetch('', '', $object->id); + if ($result > 0) { + $adh->ref = $adh->getFullName($langs); + print $adh->getNomUrl(-1); + } else { + print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; + } + print "
'.$langs->trans("DolibarrLogin").''; + if ($object->user_id) { + $dolibarr_user = new User($db); + $result = $dolibarr_user->fetch($object->user_id); + print $dolibarr_user->getLoginUrl(-1); + } else { + //print ''.$langs->trans("NoDolibarrAccess").''; + if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) { + print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").''; + } + } + print '
'.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).''.$langs->trans('WebServiceKey').''.$object->webservices_key.'
'; + print '
'; + + print '
'; + print '
'; } - print ''; - */ - - // Webservices url/key - if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).''; - print ''.$langs->trans('WebServiceKey').''.$object->webservices_key.''; - } - - print ''; - print '
'; - - print '
'; - print '
'; print dol_get_fiche_end(); From 455c06117295a840a19cc885aca363922718263f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 7 Nov 2023 17:59:44 +0100 Subject: [PATCH 224/323] add hook tabContentEditThirdparty (#26487) Co-authored-by: Christophe Battarel --- htdocs/societe/card.php | 924 ++++++++++++++++++++-------------------- 1 file changed, 465 insertions(+), 459 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b4e8b692e4d..3e379db1f93 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2032,532 +2032,538 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); print '
'; - print ''; + // Call Hook tabContentEditThirdparty + $parameters = array(); + // Note that $action and $object may be modified by hook + $reshook = $hookmanager->executeHooks('tabContentEditThirdparty', $parameters, $object, $action); + if (empty($reshook)) { + print '
'; - // Ref/ID - if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; + } + + // Name + print ''; + print ''; - } - // Name - print ''; - print ''; + // Alias names (commercial, trademark or alias names) + print ''; + print ''; - // Alias names (commercial, trademark or alias names) - print ''; - print ''; - - // Prefix - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; } - print ''; - } - // Prospect/Customer - print ''; - print ''; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - - // Supplier - if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 ''; - print ''; + // Prospect/Customer + print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''; - print ''; - } - // Barcode - if (isModEnabled('barcode')) { - print ''; - print ''; - } - - // Status - print ''; - - // Address - print ''; - print ''; - - // Zip / Town - print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'; - print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100'); - print ''; - if ($conf->browser->layout == 'phone') { - print ''; - } - print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'; - print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); - print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); - print ''; - - // Country - print ''; - - // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { - print ''; - } - - // Phone / Fax - print ''; - print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' '; - if ($conf->browser->layout == 'phone') { - print ''; - } - print ''; - print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' '; - print ''; - - // Web - print ''; - print ''; - - // EMail - print ''; - print ''; - - // Unsubscribe - if (isModEnabled('mailing')) { - if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { - print "\n".''."\n"; - } - if (!GETPOSTISSET("no_email") && !empty($object->email)) { - $result = $object->getNoEmail(); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - print ''; - print ''; - print ''; - print ''; - } - - // Social network - if (isModEnabled('socialnetworks')) { - $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4)); - } - - // Prof ids - $i = 1; - $j = 0; - $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); - while ($i <= 6) { - $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof != '-') { - $key = 'idprof'.$i; - - if (($j % $NBCOLS) == 0) { - print ''; - } - - $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; + print ''; + print ''; - if (($j % $NBCOLS) == ($NBCOLS - 1)) { - print ''; + if ($conf->browser->layout == 'phone') { + print ''; } - $j++; - } - $i++; - } - if ($NBCOLS > 0 && $j % 2 == 1) { - print ''; - } - - // VAT is used - print ''; - - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { - print ''; - print ''; - print ''; - if (!isOnlyOneLocalTax(2)) { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''; - } - print ''; - } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { - print ''; - } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { - print ''; - } - - // VAT reverse charge by default - if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { - print ''; - } - - // VAT Code - print ''; - print '
'.$langs->trans("ID").''; - print $object->ref; + // Ref/ID + if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + print '
'.$langs->trans("ID").''; + print $object->ref; + print '
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).''; + print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); print '
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).''; - print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); - print '
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; - // It does not change the prefix mode using the auto numbering prefix - if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { - print ''; - print $object->prefix_comm; - } else { - print ''; + // Prefix + if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field + print '
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; + // It does not change the prefix mode using the auto numbering prefix + if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) { + print ''; + print $object->prefix_comm; + } else { + print ''; + } + print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - print $formcompany->selectProspectCustomerType($object->client); - 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 ''; - } - print ''; - $s = $modCodeClient->getToolTip($langs, $object, 0); - print $form->textwithpicto('', $s, 1); - print '
'; - - print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - print $form->selectyesno("fournisseur", $object->fournisseur, 1, false, 0, 1); + print $formcompany->selectProspectCustomerType($object->client); print '
'; - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 ''; + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + 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 ((!$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($modCodeFournisseur->code_auto)) { - $tmpcode = $modCodeFournisseur->getNextValue($object, 1); + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($object, 0); } - print ''; - } elseif ($object->codefournisseur_modifiable()) { - print ''; + print ''; + } elseif ($object->codeclient_modifiable()) { + print ''; } else { - print $object->code_fournisseur; - print ''; + print $object->code_client; + print ''; } print ''; - $s = $modCodeFournisseur->getToolTip($langs, $object, 1); + $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); print '
'; + print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; - print img_picto('', 'barcode'); - print ''; - print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); - print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; - print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); - print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'
'.$form->editfieldkey('Town', 'town', '', $object, 0).'
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; - print img_picto('', 'globe-americas', 'class="paddingrightonly"'); - print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } else { - print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; - } - - print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state($object->state_id, $object->country_code); - print '
'.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).'
'.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'
'.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''.img_picto('', 'globe', 'class="pictofixedwidth"').'
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; - print img_picto('', 'object_email', 'class="pictofixedwidth"'); - print ''; - print '
'; - $useempty = (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2); - print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty); - print '
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).''; - print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); + // Supplier + if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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 '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; - print 'tva_assuj ? 'checked="checked"': '') . ' value="1">'; - print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; - print 'localtax1_assuj ? 'checked="checked"' : '') . ' value="1">'; - if (!isOnlyOneLocalTax(1)) { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''; - } - print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; - print 'localtax2_assuj ? 'checked="checked"' : '') . ' value="1">
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; - print 'localtax1_assuj ? 'checked="checked"' : '') . ' value="1">'; - if (!isOnlyOneLocalTax(1)) { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''; - } - print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; - print 'localtax2_assuj ? 'checked="checked"' : '') . ' value="1">'; - if (!isOnlyOneLocalTax(2)) { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''; - } - print '
' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ''; - print 'vat_reverse_charge == '1' ? ' checked' : '').'>'; - print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; - $s = ''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { - $s .= '   '; - - if ($conf->use_javascript_ajax) { - $widthpopup = 600; - if (!empty($conf->dol_use_jmobile)) { - $widthpopup = 350; + print ''; + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->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); } - $heightpopup = 400; - print "\n"; - print ''; - print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } else { - $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + print ''; + $s = $modCodeFournisseur->getToolTip($langs, $object, 1); + print $form->textwithpicto('', $s, 1); + print '
'; + print ''; } - } - print $s; - print ''; - print ''; - // Type - Workforce/Staff - print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'; - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); - if ($user->admin) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { + // Barcode + if (isModEnabled('barcode')) { + print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; + print ''; + print img_picto('', 'barcode'); + print ''; + print ''; + } + + // Status + print ''.$form->editfieldkey('Status', 'status', '', $object, 0).''; + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1); + print ''; + + // Address + print ''.$form->editfieldkey('Address', 'address', '', $object, 0).''; + print ''; + print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent'); + print ''; + + // Zip / Town + print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'; + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100'); print ''; if ($conf->browser->layout == 'phone') { print ''; } - print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'; + print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent'); + print ''; + + // Country + print ''.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; + print img_picto('', 'globe-americas', 'class="paddingrightonly"'); + print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx'); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - } else { - print ''; - } - print ''; + print ''; - // Juridical type - print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; - print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); - print ''; + // State + if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; + } else { + print ''.$form->editfieldkey('State', 'state_id', '', $object, 0).''; + } - // Capital - print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).''; - print ' '.$langs->trans("Currency".$object->multicurrency_code).''; - } else { - print '"> '.$langs->trans("Currency".$conf->currency).''; - } + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state($object->state_id, $object->country_code); + print ''; + } - // Default language - if (getDolGlobalInt('MAIN_MULTILANGS')) { - print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, null, '1', 0, 0, 'maxwidth300 widthcentpercentminusx'); + // Phone / Fax + print ''.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).''; + print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' '; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).''; + print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' '; + print ''; + + // Web + print ''.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''; + print ''.img_picto('', 'globe', 'class="pictofixedwidth"').' '; + + // EMail + print ''.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; + print ''; + print img_picto('', 'object_email', 'class="pictofixedwidth"'); + print ''; + print ''; + + // Unsubscribe + if (isModEnabled('mailing')) { + if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) { + print "\n".''."\n"; + } + if (!GETPOSTISSET("no_email") && !empty($object->email)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + print ''; + print ''; + print ''; + $useempty = (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2); + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty); + print ''; + print ''; + } + + // Social network + if (isModEnabled('socialnetworks')) { + $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4)); + } + + // Prof ids + $i = 1; + $j = 0; + $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2); + while ($i <= 6) { + $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof != '-') { + $key = 'idprof'.$i; + + if (($j % $NBCOLS) == 0) { + print ''; + } + + $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).''; + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); + print ''; + if (($j % $NBCOLS) == ($NBCOLS - 1)) { + print ''; + } + $j++; + } + $i++; + } + if ($NBCOLS > 0 && $j % 2 == 1) { + print ''; + } + + // VAT is used + print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; + print 'tva_assuj ? 'checked="checked"': '') . ' value="1">'; + print ''; + + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { + print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; + print 'localtax1_assuj ? 'checked="checked"' : '') . ' value="1">'; + if (!isOnlyOneLocalTax(1)) { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''; + } + print ''; + print ''; + print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; + print 'localtax2_assuj ? 'checked="checked"' : '') . ' value="1">'; + if (!isOnlyOneLocalTax(2)) { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''; + } + print ''; + } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { + print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; + print 'localtax1_assuj ? 'checked="checked"' : '') . ' value="1">'; + if (!isOnlyOneLocalTax(1)) { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''; + } + print ''; + } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { + print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; + print 'localtax2_assuj ? 'checked="checked"' : '') . ' value="1">'; + if (!isOnlyOneLocalTax(2)) { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''; + } + print ''; + } + + // VAT reverse charge by default + if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) { + print '' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ''; + print 'vat_reverse_charge == '1' ? ' checked' : '').'>'; + print ''; + } + + // VAT Code + print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; + print ''; + $s = ''; + + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { + $s .= '   '; + + if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (!empty($conf->dol_use_jmobile)) { + $widthpopup = 350; + } + $heightpopup = 400; + print "\n"; + print ''; + print "\n"; + $s .= ''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); + } else { + $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } + } + print $s; print ''; print ''; - } - // Incoterms - if (isModEnabled('incoterm')) { - print ''; - print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; - print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); - print ''; - } - - // Categories - if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { - // Customer - print ''.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).''; - print ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); - $arrayselected = array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; + // Type - Workforce/Staff + print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'; + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); - print ""; + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) { + print ''; + if ($conf->browser->layout == 'phone') { + print ''; + } + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + } else { + print ''; + } + print ''; - // Supplier - if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { - print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + // Juridical type + print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; + print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); + print ''; + + // Capital + print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).''; + print ' '.$langs->trans("Currency".$object->multicurrency_code).''; + } else { + print '"> '.$langs->trans("Currency".$conf->currency).''; + } + + // Default language + if (getDolGlobalInt('MAIN_MULTILANGS')) { + print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, null, '1', 0, 0, 'maxwidth300 widthcentpercentminusx'); + print ''; + print ''; + } + + // Incoterms + if (isModEnabled('incoterm')) { + print ''; + print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; + print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); + print ''; + } + + // Categories + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { + // Customer + print ''.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).''; print ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); $arrayselected = array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; + + // Supplier + if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) { + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; + print ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected = array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } } - } - // Multicurrency - if (isModEnabled("multicurrency")) { - print ''; - print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print ''; - print img_picto('', 'currency', 'class="pictofixedwidth"'); - print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx'); - print ''; - } + // Multicurrency + if (isModEnabled("multicurrency")) { + print ''; + print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print ''; + print img_picto('', 'currency', 'class="pictofixedwidth"'); + print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx'); + print ''; + } - // Other attributes - $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + // Other attributes + $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { - print ''; - print ''.$langs->trans('ParentCompany').''; - print ''; - print img_picto('', 'company', 'class="pictofixedwidth"'); - print $form->select_company(GETPOST('parent_company_id') ? GETPOST('parent_company_id') : $object->parent, 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); - print ''; - } + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) { + print ''; + print ''.$langs->trans('ParentCompany').''; + print ''; + print img_picto('', 'company', 'class="pictofixedwidth"'); + print $form->select_company(GETPOST('parent_company_id') ? GETPOST('parent_company_id') : $object->parent, 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); + print ''; + } - // Webservices url/key - if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''; - print ''; - print ''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).''; - print ''; - } + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''; + print ''; + print ''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).''; + print ''; + } - // Logo - print ''; - print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; - print ''; - if ($object->logo) { - print $form->showphoto('societe', $object); - } - $caneditfield = 1; - if ($caneditfield) { + // Logo + print ''; + print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; + print ''; if ($object->logo) { - print "
\n"; + print $form->showphoto('societe', $object); } - print ''; - if ($object->logo) { - print ''; + $caneditfield = 1; + if ($caneditfield) { + if ($object->logo) { + print "
\n"; + } + print '
'; + if ($object->logo) { + print ''; + } + //print ''; + print ''; + print '
'.$langs->trans("PhotoFile").'
'; + $maxfilesizearray = getMaxFileSizeArray(); + $maxmin = $maxfilesizearray['maxmin']; + if ($maxmin > 0) { + print ''; // MAX_FILE_SIZE must precede the field type=file + } + print ''; + print '
'; } - //print ''.$langs->trans("PhotoFile").''; - print ''; - $maxfilesizearray = getMaxFileSizeArray(); - $maxmin = $maxfilesizearray['maxmin']; - if ($maxmin > 0) { - print ''; // MAX_FILE_SIZE must precede the field type=file + print ''; + print ''; + + // Assign sale representative + print ''; + print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; + print ''; + $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); + $arrayselected = GETPOST('commercial', 'array'); + if (empty($arrayselected)) { + $arrayselected = $object->getSalesRepresentatives($user, 1); } - print ''; + print img_picto('', 'user', 'class="pictofixedwidth"').$form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1); print ''; + print ''; - } - print ''; - print ''; - // Assign sale representative - print ''; - print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; - print ''; - $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1); - $arrayselected = GETPOST('commercial', 'array'); - if (empty($arrayselected)) { - $arrayselected = $object->getSalesRepresentatives($user, 1); - } - print img_picto('', 'user', 'class="pictofixedwidth"').$form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1); - print ''; + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + print '
'; + print ''; - print '
'; + if (isModEnabled('accounting')) { + // Accountancy_code_sell + print ''.$langs->trans("ProductAccountancySellCode").''; + print ''; + print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1); + print ''; - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - print '
'; - print ''; + // Accountancy_code_buy + print ''; + print ''; + } else { // For external software + // Accountancy_code_sell + print ''; + print ''; - if (isModEnabled('accounting')) { - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; - } else { // For external software - // Accountancy_code_sell - print ''; - print ''; - - // Accountancy_code_buy - print ''; - print ''; + // Accountancy_code_buy + print ''; + print ''; + } + print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); + print '
'.$langs->trans("ProductAccountancySellCode").''; + print '
'.$langs->trans("ProductAccountancySellCode").''; - print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1); - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); - print '
'.$langs->trans("ProductAccountancySellCode").''; - print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print '
'; } - print ''; } print '
'; From 4fc415a287f014306e5a0bfef217ae9f463fa5fb Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 7 Nov 2023 18:05:36 +0100 Subject: [PATCH 225/323] New option to define the start period of a first subscription (#26484) * New option to define the start period of a first subscription add default date of starting (year, month or subscription payment) add delay for subscription period * Update member.php * Fix period for statistique if delay is set --- htdocs/adherents/admin/member.php | 23 ++++++++++++++++++++++- htdocs/adherents/stats/index.php | 5 ++++- htdocs/adherents/subscription.php | 17 +++++++++++------ htdocs/langs/en_US/members.lang | 2 ++ htdocs/langs/fr_FR/members.lang | 2 ++ htdocs/public/payment/paymentok.php | 12 ++++++++++-- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 3f402440c9a..2993006bd91 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -9,6 +9,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2020-2021 Frédéric France + * Copyright (C) 2023 Waël Almoman * * 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 @@ -103,13 +104,15 @@ if ($action == 'set_default') { } } elseif ($action == 'updatemainoptions') { $db->begin(); - $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = 0; + $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = $res7 = $res8 = $res9 = 0; $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity); + $res8 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', GETPOST('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', 'alpha'), 'chaine', 0, '', $conf->entity); + $res9 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_AFTER', GETPOST('MEMBER_SUBSCRIPTION_START_AFTER', 'alpha'), 'chaine', 0, '', $conf->entity); // Use vat for invoice creation if (isModEnabled('facture')) { $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -335,6 +338,24 @@ print ''.$langs->trans("Description").''; print ''.$langs->trans("Value").''; print "\n"; +// Start date of new membership +$startpoint[0] = $langs->trans("SubscriptionPayment"); +$startpoint["m"] = $langs->trans("Month"); +$startpoint["Y"] = $langs->trans("Year"); +print ''; +print $langs->trans("MemberSubscriptionStartFirstDayOf"); +print ''; +$startfirstdayof = !getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') ? 0 : getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF'); +print $form->selectarray("MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF", $startpoint, $startfirstdayof, 0); +print "\n"; + +// Delay to start the new membership ([+/-][0-99][Y/m/d], for instance, with "+4m", the subscription will start in 4 month.) +print ''; +print $langs->trans("MemberSubscriptionStartAfter"); +print ''; +print ''; +print "\n"; + // Mail required for members print ''.$langs->trans("AdherentMailRequired").''; print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 2a0993efeb9..d835d1d8eba 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -48,8 +48,11 @@ if ($user->socid > 0) { $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); -$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); $endyear = $year; +if (!empty(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) ) { + $endyear = dol_print_date(dol_time_plus_duree(dol_now('gmt'), (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)), "%Y", 'gmt'); +} // Load translation files required by the page $langs->loadLangs(array("companies", "members")); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b3e2770ecc5..1a679c87830 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -6,6 +6,7 @@ * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2023 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,7 +54,7 @@ $typeid = GETPOST('typeid', 'int'); $cancel = GETPOST('cancel'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -960,8 +961,6 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h print ''."\n"; print ''; - $now = dol_now(); - // Date payment if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) { $paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear')); @@ -977,10 +976,16 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h } if (!$datefrom) { $datefrom = $object->datevalid; - if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) { + if (!empty(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) ) { + $datefrom = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); + } elseif ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > $now) { $datefrom = dol_time_plus_duree($object->datefin, 1, 'd'); - } else { - $datefrom = dol_get_first_day($currentyear); + } + + if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { + $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m")); + } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") { + $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y")); } } print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1); diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 277081d7ef3..3829a265546 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -241,3 +241,5 @@ MemberFirstname=Member firstname MemberLastname=Member lastname MemberCodeDesc=Member Code, unique for all members NoRecordedMembers=No recorded members +MemberSubscriptionStartFirstDayOf=The start date of a membership corresponds to the first day of a +MemberSubscriptionStartAfter=Minimum period before the entry into force of the start date of a subscription except renewals (example +3m = +3 months, -5d = -3 days, +1Y = +1 year) (example: +3m = +3 months, -5d = -3 days, +1Y = +1 year) \ No newline at end of file diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index cb6f3168277..905e2efe8f6 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -241,3 +241,5 @@ MemberFirstname=Prénom du membre MemberLastname=Nom de famille du membre MemberCodeDesc=Code membre, unique pour tous les membres NoRecordedMembers=Aucun membre enregistré +MemberSubscriptionStartFirstDayOf=La date de début d'une adhésion correspond au premier jour d'un(e) +MemberSubscriptionStartAfter=Délai minimum avant l'entrée en vigueur de la date de début d'une souscription hors renouvellement (exemple +3m = +3 mois, -5d = -3 jours, +1Y = +1 année) \ No newline at end of file diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6135c1e6801..57f00ea09f1 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2021-2023 Waël Almoman * Copyright (C) 2021 Maxime Demarest * Copyright (C) 2021 Dorian Vabre * @@ -522,9 +522,17 @@ if ($ispaymentok) { } // Subscription informations - $datesubscription = $object->datevalid; + $datesubscription = $object->datevalid; // By default, the subscription start date is the payment date if ($object->datefin > 0) { $datesubscription = dol_time_plus_duree($object->datefin, 1, 'd'); + } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { + $datesubscription = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); + } + + if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { + $datesubscription = dol_get_first_day(dol_print_date($datesubscription, "%Y"), dol_print_date($datesubscription, "%m")); + } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") { + $datesubscription = dol_get_first_day(dol_print_date($datesubscription, "%Y")); } $datesubend = null; From 8acc47220df2d36be6a792ec6e80d7edf8a0c70b Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:07:46 +0100 Subject: [PATCH 226/323] Update stockatdate.php (#26481) As commented in #23782 this update is to clean and clarify the code for future evolution of stocktodate. In fact the calculated value in the SQL request is the current stock value and not the estimated stock value at date value. Therefore I changed in SQL request the estimatedvalue to currentvalue and reused as a variable for a better understanding and for future use (other PR) as it will be interesting to get a comparison between stockatdate value to currentstock value. Also some others changes are required to improve the page speed. --- htdocs/product/stock/stockatdate.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 868b3bb3adf..ddee7143569 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; if (!empty($search_fk_warehouse)) { - $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; + $sql .= " SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue"; $sql .= ', SUM(ps.reel) as stock_reel'; } else { - $sql .= " SUM(p.pmp * p.stock) as estimatedvalue, SUM(p.price * p.stock) as sellvalue"; + $sql .= " SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue"; } // Add fields from hooks $parameters = array(); @@ -611,12 +611,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // PMP value print ''; // Selling value From 7a7869aeb346b3dab6ca0160c1aec02b1b9eb567 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:10:37 +0100 Subject: [PATCH 227/323] FIX # Bug Estimated Stock at date value in V14 (#26479) In stockatdate page, the estimatedvalue is wrong. Backport of V17 solution as explained in #23782 --- htdocs/product/stock/stockatdate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 4892004db72..f8c9437b928 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -242,7 +242,7 @@ $num = 0; $title = $langs->trans('StockAtDate'); -$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; if ($fk_warehouse > 0) { @@ -562,8 +562,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // PMP value print ''."\n"; -$totalarray = array(); $totalarray['nbfield'] = 0; // Fields title label @@ -686,7 +685,6 @@ $warehouse = new Entrepot($db); // -------------------------------------------------------------------- $i = 0; $savnbfield = $totalarray['nbfield']; -$totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { From edac1bb6ccdb9895223e5a31355ff332af2c563d Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:18:06 +0200 Subject: [PATCH 229/323] Add missing info for proper use and creation of template invoice (clients and vendors) (#26475) * Add missing info for proper use and creation of template invoice * Add missing info for proper use and creation of template invoice * fix trans of generated invoice --- htdocs/compta/facture/card-rec.php | 4 +++- htdocs/fourn/facture/card-rec.php | 4 +++- htdocs/langs/en_US/bills.lang | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 15ca3646425..b2a7d1b0a8d 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1096,6 +1096,8 @@ if ($action == 'create') { $title = $langs->trans("Recurrence"); print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', ''); + print ''.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'

'; + print dol_get_fiche_head(null, '', '', 0); print '
'; - if (price2num($stock * $objp->pmp, 'MT')) { - print ''.price(price2num($stock * $objp->pmp, 'MT'), 1).''; + $estimatedvalue = $stock * $objp->pmp; + if (price2num($estimatedvalue, 'MT')) { + print ''.price(price2num($estimatedvalue, 'MT'), 1).''; } else { print ''; } - $totalbuyingprice += $stock * $objp->pmp; + $totalbuyingprice += $estimatedvalue; print ''; - if (price2num($objp->estimatedvalue, 'MT')) { - print price(price2num($objp->estimatedvalue, 'MT'), 1); + if (price2num($stock * $objp->pmp, 'MT')) { + print ''.price(price2num($stock * $objp->pmp, 'MT'), 1).''; } else { print ''; } From 0ec3c5754d7e058c7959b468c23ae93348a45341 Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:13:14 +0100 Subject: [PATCH 228/323] FIX Warehouse Global Amounts not displayed (#26478) This fix is to repaired the Global Amounts that are not displayed anymore strating from v18.x --- htdocs/product/stock/list.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8d2a5c115d4..41ee4189a3d 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -613,7 +613,6 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print '
'; @@ -1118,7 +1120,7 @@ if ($action == 'create') { print ""; // Auto validate the invoice - print ""; diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 558574b3a0a..b58434d6291 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1025,6 +1025,8 @@ if ($action == 'create') { $title = $langs->trans("Recurrence"); print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', ''); + print ''.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'

'; + print dol_get_fiche_head(null, '', '', 0); print '
".$langs->trans("StatusOfGeneratedInvoices").""; + print "
".$langs->trans("StatusOfAutoGeneratedInvoices").""; $select = array('0'=>$langs->trans('BillStatusDraft'), '1'=>$langs->trans('BillStatusValidated')); print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); print "
'; @@ -1053,7 +1055,7 @@ if ($action == 'create') { // Auto generate document if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) { - print ""; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 8d44904d58b..e933fb21b93 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -124,7 +124,7 @@ EnterPaymentDueToCustomer=Make payment due to customer DisabledBecauseRemainderToPayIsZero=Disabled because remaining unpaid is zero PriceBase=Base price BillStatus=Invoice status -StatusOfGeneratedInvoices=Status of generated invoices +StatusOfAutoGeneratedInvoices=Status of automatically generated invoices BillStatusDraft=Draft (needs to be validated) BillStatusPaid=Paid BillStatusPaidBackOrConverted=Credit note refund or marked as credit available @@ -642,4 +642,4 @@ MentionCategoryOfOperations0=Delivery of goods MentionCategoryOfOperations1=Provision of services MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services Salaries=Salaries -InvoiceSubtype=Invoice Subtype \ No newline at end of file +InvoiceSubtype=Invoice Subtype From 22a37bf36a00b89b63bb6eeecfa41db7c585f8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Nov 2023 18:52:08 +0100 Subject: [PATCH 230/323] QUAL group all flag images into 1 sprite file. (#26459) * add flag sprite * add missing * wip * wip * add script used to generate flags sprite * add script used to generate flags sprite --------- Co-authored-by: Laurent Destailleur --- dev/tools/make_sprite.sh | 57 + htdocs/core/lib/functions.lib.php | 3 +- htdocs/theme/common/flags/flag-sprite.png | Bin 0 -> 79578 bytes htdocs/theme/eldy/flags-sprite.inc.php | 1279 +++++++++++++++++++++ htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/flags-sprite.inc.php | 1279 +++++++++++++++++++++ htdocs/theme/md/style.css.php | 2 +- 7 files changed, 2619 insertions(+), 2 deletions(-) create mode 100644 dev/tools/make_sprite.sh create mode 100644 htdocs/theme/common/flags/flag-sprite.png create mode 100644 htdocs/theme/eldy/flags-sprite.inc.php create mode 100644 htdocs/theme/md/flags-sprite.inc.php diff --git a/dev/tools/make_sprite.sh b/dev/tools/make_sprite.sh new file mode 100644 index 00000000000..41a280fb860 --- /dev/null +++ b/dev/tools/make_sprite.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# Based of: https://gist.github.com/jaymzcd/342399 and https://github.com/buren/flag-sprite-maker + +# uses imagemagick to stich together all images in a folder and +# then writes a css file with the correct offsets along with a +# test html page for verification that its all good + +# Usage: +# $ ./make_sprite.sh path class_name image_extension + +set -euo pipefail +IFS=$'\n\t' + +name='output'; # output will be placed in a folder named this +path="${1:-}" # Path to flag images +classname=${2:-flag}"-sprite" +ext="."${3:-png}; # the extension to iterate over for input files + +css="$name/$classname.css"; +html="$name/test.html"; + +rm -fr $name; +mkdir $name; +touch $css $html; + +echo "Generating sprite file..."; +convert $path*$ext -append $name/$classname$ext; +echo "Sprite complete! - Creating css & test output..."; + +echo -e "\n\n\t\n\n\n\t

Sprite test page

\n" >> $html + +echo -e ".$classname {\n\tbackground:url('$classname$ext') no-repeat top left; display:inline-block;\n}" >> $css; +counter=0; +offset=0; +for file in $path*$ext +do + width=`identify -format "%[fx:w]" "$file"`; + height=`identify -format "%[fx:h]" "$file"`; + idname=`basename "$file" $ext`; + clean=${idname// /-} + echo -e ".$classname.$clean {" >> $css; + echo -e "\tbackground-position:0 -${offset}px;" >> $css; + echo -e "\twidth: ${width}px;" >> $css; + echo -e "\theight: ${height}px;\n}" >> $css; + + echo -e "
$clean
\n" >> $html; + + let offset+=$height; + let counter+=1; + echo -e "\t#$counter done"; +done + +echo -e "

Full sprite:

\n" >> $html; +echo -e "\n" >> $html; + +echo -e "\nComplete! - $counter sprites created, css written & test page output."; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fe0560d0da4..62b72c81579 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9627,7 +9627,8 @@ function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0) $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; } - return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt); + // return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt); + return ''; } /** diff --git a/htdocs/theme/common/flags/flag-sprite.png b/htdocs/theme/common/flags/flag-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..af4822a05e8897ec84d32f6c890703032a46d69d GIT binary patch literal 79578 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

V_lm4~4Kt?Ey`+ne^k`=4_pz~H`n~sL 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�fl?warwH}W+zCst}u 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

AGqL5WZU~9F6A&eefZrJ{^pVSv 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 +/*

" . $langs->trans("StatusOfGeneratedDocuments") . ""; + print "
" . $langs->trans("StatusOfAutoGeneratedDocuments") . ""; $select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc')); print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); print "