From 0950df7b63422e13af1ed24b6c06a37cb07c0db7 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 2 Feb 2023 17:28:47 +0100 Subject: [PATCH 01/47] Add options in function pdf_pagefoot & pdf_pagehead of pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 75 ++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4d9569a1cc4..1a9e2a0b44a 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -724,11 +724,13 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $filepath = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF; if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); } // Option for change opacity of background $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); - $pdf->SetPageMark(); // This option avoid to have the images missing on some pages + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha(1); } $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } + $pdf->SetPageMark(); // This option avoid to have the images missing on some pages } @@ -1246,49 +1248,54 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetY(-$posy); - // Hide footer line if footer background color is set - if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { - $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); - } + // Option for hide all footer (page number will no hidden) + if (getDolGlobalInt('PDF_FOOTER_HIDDEN') !== 1) { - // Option for set top margin height of footer after freetext - if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) { - $posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN')); - } else { - $posy--; - } + // Hide footer line if footer background color is set + if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { + $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); + } - if (!empty($line1)) { - $pdf->SetFont('', 'B', 7); - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line1, 0, 'C', 0); - $posy -= 3; - $pdf->SetFont('', '', 7); - } + // Option for set top margin height of footer after freetext + if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) { + $posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN')); + } else { + $posy--; + } - if (!empty($line2)) { - $pdf->SetFont('', 'B', 7); - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line2, 0, 'C', 0); - $posy -= 3; - $pdf->SetFont('', '', 7); - } + if (!empty($line1)) { + $pdf->SetFont('', 'B', 7); + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line1, 0, 'C', 0); + $posy -= 3; + $pdf->SetFont('', '', 7); + } - if (!empty($line3)) { - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line3, 0, 'C', 0); - } + if (!empty($line2)) { + $pdf->SetFont('', 'B', 7); + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line2, 0, 'C', 0); + $posy -= 3; + $pdf->SetFont('', '', 7); + } - if (!empty($line4)) { - $posy -= 3; - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line4, 0, 'C', 0); + if (!empty($line3)) { + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line3, 0, 'C', 0); + } + + if (!empty($line4)) { + $posy -= 3; + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line4, 0, 'C', 0); + } } } } // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy); + // Option for change XY position of the page number + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X')) : 0 ) , -$posy - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y')) : 0 )); //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); } From bce25eaff1db9d96443951ae6231b5e0f31c066b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Feb 2023 16:44:09 +0000 Subject: [PATCH 02/47] Fixing style errors. --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1a9e2a0b44a..cf22b70f772 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1295,7 +1295,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { // Option for change XY position of the page number - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X')) : 0 ) , -$posy - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y')) : 0 )); + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X')) : 0 ), -$posy - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y')) : 0 )); //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); } From 3a8fbd3aa8dfbb8847abbe5e162a29ddbcb633ab Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 6 Feb 2023 10:32:54 +0100 Subject: [PATCH 03/47] update --- htdocs/comm/action/card.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 545088e47e9..1412890b3d8 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -142,9 +142,6 @@ if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); $result = restrictedArea($user, 'agenda', $object->id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -if ($user->socid && $socid) { - $result = restrictedArea($user, 'societe', $socid); -} /* From 329d8d01a67bf6e24da0c252221202c33d38388f Mon Sep 17 00:00:00 2001 From: habot-it <58470575+habot-it@users.noreply.github.com> Date: Sat, 11 Feb 2023 14:30:58 +0100 Subject: [PATCH 04/47] Add options in function pdf_pagefoot & pdf_pagehead of pdf.lib.php - Revision 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello @eldy, In pdf_pagehead function : Add MAIN_USE_BACKGROUND_ON_PDF_ALPHA option for change opacity of the background ̶S̶e̶t̶P̶a̶g̶e̶M̶a̶r̶k̶ ̶m̶o̶v̶e̶d̶ ̶t̶o̶ ̶f̶i̶x̶e̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶ ̶p̶r̶o̶b̶l̶e̶m̶ ̶o̶f̶ ̶M̶A̶I̶N̶_̶U̶S̶E̶_̶B̶A̶C̶K̶G̶R̶O̶U̶N̶D̶_̶O̶N̶_̶P̶D̶F̶ ̶b̶u̶t̶ ̶f̶o̶r̶ ̶M̶A̶I̶N̶_̶A̶D̶D̶_̶P̶D̶F̶_̶B̶A̶C̶K̶G̶R̶O̶U̶N̶D̶ ̶t̶o̶o̶ In pdf_pagefoot function : Add PDF_FOOTER_HIDDEN to hide all footer (page number will no hidden) Add PDF_FOOTER_PAGE_NUMBER_X & PDF_FOOTER_PAGE_NUMBER_Y to change XY position of the page number Best regards, Alban --- htdocs/core/lib/pdf.lib.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index cf22b70f772..3da0dd889d6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -727,10 +727,10 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); } // Option for change opacity of background $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha(1); } + $pdf->SetPageMark(); // This option avoid to have the images missing on some pages $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } - $pdf->SetPageMark(); // This option avoid to have the images missing on some pages } @@ -1250,7 +1250,6 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Option for hide all footer (page number will no hidden) if (getDolGlobalInt('PDF_FOOTER_HIDDEN') !== 1) { - // Hide footer line if footer background color is set if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); From 728c2ef2381b82e1fe97848fb1eef465adaa8981 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Feb 2023 18:02:28 +0100 Subject: [PATCH 05/47] Add options in function pdf_pagefoot & pdf_pagehead of pdf.lib.php - Revision 2 --- htdocs/core/lib/pdf.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3da0dd889d6..ab9664f10c7 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -731,6 +731,9 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND) && ($conf->global->MAIN_ADD_PDF_BACKGROUND != '-1')) { + $pdf->SetPageMark(); // This option avoid to have the images missing on some pages + } } From 6163f84d258df4cf87e01cebdf7b11a549bbe9b1 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 15 Feb 2023 22:10:03 +0100 Subject: [PATCH 06/47] move log after variable updates to get good informations in logs --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 94fb05d5346..47f8fd900cb 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -184,9 +184,6 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); - if (empty($subject)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); $this->error = 'ErrorSubjectIsRequired'; @@ -314,6 +311,9 @@ class CMailFile } } + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') { From 3a58e025badea87a7758d149d7d435b017032fc8 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:44:38 +0100 Subject: [PATCH 07/47] better logs --- htdocs/core/class/CMailFile.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47f8fd900cb..0269b25fd6c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,6 +142,9 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + // Clean values of $mimefilename_list if (is_array($mimefilename_list)) { foreach ($mimefilename_list as $key => $val) { @@ -311,8 +314,7 @@ class CMailFile } } - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." addr_bcc=$addr_bcc, replyto=$replyto", LOG_DEBUG); // We set all data according to choosed sending method. // We also set a value for ->msgid From 86e2f46fe7a4cebc24de3039c23e4e07891ac82b Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 16 Feb 2023 21:46:27 +0100 Subject: [PATCH 08/47] addr_bcc could be set --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0269b25fd6c..90c16dc589f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -142,7 +142,7 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; - dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); // Clean values of $mimefilename_list From 36e73280bf50d85e5503131d5fc3ba81bb0f91aa Mon Sep 17 00:00:00 2001 From: Guenter Lukas Date: Mon, 20 Feb 2023 12:51:15 +0100 Subject: [PATCH 09/47] FIX:#23966 Error "Param dbt_keyfield is required but not defined" --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 798ba265643..264ed290f58 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -682,7 +682,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl // Array to define rules of checks to do $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object - $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). + $checkother = array('contact', 'agenda', 'contrat'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet', 'project'); // Test for project object $checktask = array('projet_task'); // Test for task object $checkhierarchy = array('expensereport', 'holiday'); From e480c3f440f544293b7191a0c8a6c70d9b3c77ab Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 Mar 2023 09:31:39 +0100 Subject: [PATCH 10/47] FIX missing drop foreign key before modify field --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 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 4ec2e7228b2..a1e24fa6d2c 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 @@ -33,8 +33,9 @@ -- Missing in v16 or lower - +ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version; ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL; +ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version); ALTER TABLE llx_c_action_trigger MODIFY elementtype VARCHAR(64); From 78842f56a3be7f4e63e426665edd85dd135f1b97 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 7 Mar 2023 15:27:37 +0100 Subject: [PATCH 11/47] fix invalid argument for foreach --- htdocs/core/class/commonobject.class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5f0741b26d4..cb3af5db5e3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6090,13 +6090,15 @@ abstract class CommonObject // If field is a computed field, value must become result of compute (regardless of whether a row exists // in the element's extrafields table) - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { - //var_dump($conf->disable_compute); - if (empty($conf->disable_compute)) { - global $objectoffield; // We set a global variable to $objectoffield so - $objectoffield = $this; // we can use it inside computed formula - $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); + if (is_array($extrafields->attributes[$this->table_element]['label'])){ + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { + //var_dump($conf->disable_compute); + if (empty($conf->disable_compute)) { + global $objectoffield; // We set a global variable to $objectoffield so + $objectoffield = $this; // we can use it inside computed formula + $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); + } } } } From 4291560577cc393a11243362c5a0c75d7b370b15 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 7 Mar 2023 17:36:40 +0100 Subject: [PATCH 12/47] fix search_project_user --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 15fc35f9e84..f5c25f6a516 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -839,7 +839,7 @@ if ($search_project_user > 0) { $param .= '&search_project_user='.urlencode($search_project_user); } if ($search_project_contact != '') { - $param .= '&search_project_user='.urlencode($search_project_contact); + $param .= '&search_project_contact='.urlencode($search_project_contact); } if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); From 3fbb744d55fc1c10935f6e513f2ee957d39ab503 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:21:19 +0100 Subject: [PATCH 13/47] FIX: holiday counter massaction: ErrorBadValueForParamNotAString and PHP 8 warning when no approval user right --- htdocs/holiday/define_holiday.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 2d47467319d..c19defa8ba3 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -363,6 +363,7 @@ if (count($typeleaves) == 0) { print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : 'Note'), $_SERVER["PHP_SELF"]); print_liste_field_titre(''); + $selectedfields = ''; if ($massactionbutton) { $selectedfields = $form->showCheckAddButtons('checkforselect', 1); } From 49d79a4c7c737e0d05163a4ee6b5f6bddfb74d80 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:48:38 +0100 Subject: [PATCH 14/47] FIX: installation superadmin creation: PHP 8 warning --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index d1d0d7ed7d0..5a610090be2 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -257,7 +257,7 @@ function dol_verifyHash($chain, $hash, $type = '0') global $conf; if ($type == '0' && !empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_verify')) { - if ($hash[0] == '$') { + if (! empty($hash[0]) && $hash[0] == '$') { return password_verify($chain, $hash); } elseif (strlen($hash) == 32) { return dol_verifyHash($chain, $hash, '3'); // md5 From a1d339aa68d4cdd36f12a329c8564a9808835174 Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:39:50 +0100 Subject: [PATCH 15/47] Update contact.php --- htdocs/comm/propal/contact.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 45f2d175f9a..cdbf513e6a8 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -65,7 +65,6 @@ if (!$error) { // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From 12e9e3c3eb5d0a082a31fc99d1801bf8adfb7fcd Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:46:34 +0100 Subject: [PATCH 16/47] Update document.php --- htdocs/comm/propal/document.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f1b6b2221e6..82a7a253ae9 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -45,13 +45,6 @@ $confirm = GETPOST('confirm', 'alpha'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -// Security check -$socid = ''; -if (!empty($user->socid)) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'propal', $id); - // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -86,7 +79,6 @@ $permissiontoadd = $user->rights->propal->creer; // Security check if (!empty($user->socid)) { $socid = $user->socid; - $object->id = $user->socid; } restrictedArea($user, 'propal', $object->id); From efcaa0780af31af52c12f43c4c1c764026d4bdda Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:47:21 +0100 Subject: [PATCH 17/47] Update note.php --- htdocs/comm/propal/note.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 4a772dae1d2..7eaf3e02716 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -51,7 +51,6 @@ if ($id > 0 || !empty($ref)) { // Security check if ($user->socid > 0) { $socid = $user->socid; - $object->id = $user->socid; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context From 60000b7d37edc2dca4fb4d5d810240955ba1013d Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:56:04 +0100 Subject: [PATCH 18/47] Update note.php --- htdocs/comm/propal/note.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 7eaf3e02716..ace4556fb62 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -49,6 +49,7 @@ if ($id > 0 || !empty($ref)) { } // Security check +$socid = ''; if ($user->socid > 0) { $socid = $user->socid; } From d92f6bb4fbca7e56dc777faffbaa847410f01ff6 Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:57:00 +0100 Subject: [PATCH 19/47] Update contact.php --- htdocs/comm/propal/contact.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index cdbf513e6a8..efad4303a0d 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -63,6 +63,7 @@ if (!$error) { } // Security check +$socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } From a655faf08d99ee7c23d69cff8893b4d852e44df4 Mon Sep 17 00:00:00 2001 From: bomuux Date: Wed, 8 Mar 2023 10:58:05 +0100 Subject: [PATCH 20/47] Update document.php --- htdocs/comm/propal/document.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 82a7a253ae9..0a7584248c0 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -77,6 +77,7 @@ $object->fetch($id, $ref); $permissiontoadd = $user->rights->propal->creer; // Security check +$socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } From 353d451e5ac5d10a63912758b63c5bebea20c8d5 Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Fri, 10 Mar 2023 15:48:26 +0100 Subject: [PATCH 21/47] Correct dolForgeCriteriaCallback --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c275e4fd310..06990a3dbd4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10757,7 +10757,7 @@ function dolForgeCriteriaCallback($matches) $operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0])); - $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + $operator = strtoupper(preg_replace('/[^a-z<>!=]/i', '', trim($tmp[1]))); if ($operator == 'NOTLIKE') { $operator = 'NOT LIKE'; } From 6969cde52d4640dd79960453cdbd36f339eaace8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Mar 2023 19:20:02 +0100 Subject: [PATCH 22/47] Fix transaction balance --- htdocs/expedition/class/expeditionlinebatch.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index 5d99d1c7a74..a277e5f96f4 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -143,7 +143,6 @@ class ExpeditionLineBatch extends CommonObject dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } - $this->db->rollback(); return -1 * $error; } } From 81d2618b5984fba80e00de40ae5da3f29646ca03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Mar 2023 19:38:39 +0100 Subject: [PATCH 23/47] Add option to avoid use of input price inc tax (works only for 1st tax) --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- htdocs/core/tpl/objectline_title.tpl.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index cbbb127cf1e..ec61384f5bf 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -410,7 +410,7 @@ if ($nolinesbefore) { diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index fba73125aa5..b2914c455a0 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -223,7 +223,7 @@ $coldisplay++; print ''; } - if ($inputalsopricewithtax) { + if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { $coldisplay++; print 'fk_prev_id != null) { diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 4640d710705..ed16a8a8286 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -92,7 +92,7 @@ if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currenc print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; } -if ($inputalsopricewithtax) { +if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { print ''.$langs->trans('PriceUTTC').''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 0f7dc25152b..b2213862d62 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -325,7 +325,7 @@ print $tooltiponpriceend; multicurrency_subprice); ?> +if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?> pu_ttc) ? price($sign * $line->pu_ttc) : price($sign * $line->subprice)); ?> From 5ec52548ab49b2db00cb14819b95dab173345914 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Mar 2023 20:25:27 +0100 Subject: [PATCH 24/47] For countries using the 2nd or 3rd tax, we force MAIN_NO_INPUT_PRICE_WITH_TAX to disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account). Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set. --- htdocs/comm/propal/card.php | 2 ++ htdocs/comm/propal/class/propal.class.php | 2 ++ htdocs/core/tpl/objectline_edit.tpl.php | 6 +++++- htdocs/core/tpl/objectline_view.tpl.php | 8 +++++++- htdocs/master.inc.php | 6 ++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e14a2c05246..6589587a8f6 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -923,6 +923,8 @@ if (empty($reshook)) { $price_ttc = ''; $price_ttc_devise = ''; + // TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) + if (GETPOST('price_ht') !== '') { $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 8606b9df87d..4bfe37810ed 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -865,6 +865,8 @@ class Propal extends CommonObject $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } + // TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) ? + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index b2914c455a0..605634dab67 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -225,7 +225,11 @@ $coldisplay++; if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { $coldisplay++; - print 'pu_ttc) ? $line->pu_ttc : null; + if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { + $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); + } + print 'fk_prev_id != null) { print ' readonly'; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index b2213862d62..153773a6519 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -326,7 +326,13 @@ print $tooltiponpriceend; - pu_ttc) ? price($sign * $line->pu_ttc) : price($sign * $line->subprice)); ?> + pu_ttc) ? $line->pu_ttc : null; + if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { + $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); + } + print (isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); + ?> diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 03515c9a2e2..69ce82e5657 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -218,6 +218,12 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { // For FR, default value of option to show profid SIRET is on by default $conf->global->MAIN_PROFID1_IN_ADDRESS = 1; } + + if ($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) { + // For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account). + // Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set. + $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1; + } } From 925b47d1b295b359f8e0a58cf9737530a656aa61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Mar 2023 21:32:51 +0100 Subject: [PATCH 25/47] Fix css --- htdocs/projet/tasks.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 628056f610f..5afd7b91379 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1071,11 +1071,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $j = 0; $level = 0; $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); } else { - $colspan = 10; + $colspan = 11; if ($object->usage_bill_time) { $colspan += 2; } - print ''.$langs->trans("NoTasks").''; + print ''.$langs->trans("NoTasks").''; } print ""; From 283d0ce785f425058e003aa46bace48eb2a16f63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 18:38:26 +0100 Subject: [PATCH 26/47] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index ab9664f10c7..d5b3d720188 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -731,7 +731,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } - if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND) && ($conf->global->MAIN_ADD_PDF_BACKGROUND != '-1')) { + if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND') != '-1') { $pdf->SetPageMark(); // This option avoid to have the images missing on some pages } } From 20d63208187f3af332fa306615084738c71d19a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 18:39:58 +0100 Subject: [PATCH 27/47] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d5b3d720188..673d6d59144 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1252,7 +1252,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetY(-$posy); // Option for hide all footer (page number will no hidden) - if (getDolGlobalInt('PDF_FOOTER_HIDDEN') !== 1) { + if (!getDolGlobalInt('PDF_FOOTER_HIDDEN')) { // Hide footer line if footer background color is set if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); From 836717ccedcfbd14d478d25cdc77fee35a6b2519 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 18:42:35 +0100 Subject: [PATCH 28/47] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 673d6d59144..5a8edc4f5a9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1297,7 +1297,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { // Option for change XY position of the page number - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_X')) : 0 ), -$posy - ( getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y') ? floatval(getDolGlobalString('PDF_FOOTER_PAGE_NUMBER_Y')) : 0 )); + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); } From 9f13f17e363d9ad10fe88dac69d488f6f9f34877 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 20:43:13 +0100 Subject: [PATCH 29/47] Close #18253 by manual merge --- htdocs/core/class/html.form.class.php | 2 ++ htdocs/core/lib/ajax.lib.php | 44 ++++++++++++++++++++------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8506ab1f352..02aca3cd57b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1346,6 +1346,8 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } + $out .= ajax_event($htmlname, $events); + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); } else { // Immediate load of all database diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index cacd22269ad..fde2a988cf7 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -526,24 +526,46 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = } $msg .= ';'."\n"; - if (is_array($events) && count($events)) { // If an array of js events to do were provided. - $msg .= ' + $msg .= '});'."\n"; + $msg .= "\n"; + + $msg .= ajax_event($htmlname, $events); + + return $msg; +} + + +/** + * Add event management script. + * + * @param string $htmlname Name of html select field ('myid' or '.myclass') + * @param array $events Add some Ajax events option on change of $htmlname component to call ajax to autofill a HTML element (select#htmlname and #inputautocompletehtmlname) + * Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @return string Return JS string to manage event + */ +function ajax_event($htmlname, $events) +{ + $out = ''; + + if (is_array($events) && count($events)) { // If an array of js events to do were provided. + $out = ' + '; } - $msg .= '});'."\n"; - $msg .= "\n"; - - return $msg; + return $out; } + /** * On/off button for constant * From 11fd351b3df1eae856b56b4f8d97f7348694fc2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 21:31:33 +0100 Subject: [PATCH 30/47] Some steps to merge manually #22960 --- htdocs/core/lib/payments.lib.php | 2 +- htdocs/core/lib/ticket.lib.php | 11 +++++++---- htdocs/public/ticket/create_ticket.php | 2 +- htdocs/public/ticket/index.php | 2 +- htdocs/public/ticket/list.php | 5 ++--- htdocs/public/ticket/view.php | 5 +++-- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 3dfccc88ea5..db1d0a13db6 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -487,7 +487,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print '
'; - print '
'."\n"; + print '
'."\n"; if ($addformmessage) { print ''; print '
'; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 2c218421543..4b61fe2eb2e 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -203,7 +203,7 @@ function generate_random_id($car = 16) } /** - * Show header for public pages + * Show http header, open body tag and show HTML header banner for public pages for tickets * * @param string $title Title * @param string $head Head array @@ -216,11 +216,14 @@ function generate_random_id($car = 16) function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') { global $user, $conf, $langs, $mysoc; + $urllogo = ""; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; - print '
'; + print '
'; + + print '
'; // Define urllogo if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { @@ -264,7 +267,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - print '
'; + print ''; - print '
'; + //print '
'; } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 80ea664292b..2bb574def50 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -512,7 +512,7 @@ $arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; if ($action != "infos_success") { $formticket->withfromsocid = isset($socid) ? $socid : $user->socid; diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 97af18c0bb6..a36a0023324 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -80,7 +80,7 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

').'

'; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index aafea0365e0..6f6bdacadb6 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -193,9 +193,8 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); - if ($action == "view_ticketlist") { - print '
'; + print '
'; print '
'; if ($display_ticket_list) { @@ -724,7 +723,7 @@ if ($action == "view_ticketlist") { print '
'; } else { - print '
'; + print '
'; print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; print '
'; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 67b582c0afd..142c704bb67 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -232,7 +232,7 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") { if ($display_ticket) { @@ -396,10 +396,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ''; } } else { - print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; + print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; print '
'; print '
'; + print ''; print ''; From 843411ef5d362996f99564b4664ab5fbe2c31243 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 22:02:40 +0100 Subject: [PATCH 31/47] Fix CSS public interface of tickets --- htdocs/core/class/html.formticket.class.php | 4 ++-- htdocs/core/lib/ticket.lib.php | 8 ++++---- htdocs/public/ticket/list.php | 2 ++ htdocs/ticket/css/styles.css.php | 6 ++++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1ba3ba27fb5..15634a761d4 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -427,7 +427,7 @@ class FormTicket $toolbarname = 'dolibarr_notes'; if ($this->ispublic) { $toolbarname = 'dolibarr_details'; - print '
'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'
'; + print '
'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'
'; } include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; @@ -455,7 +455,7 @@ class FormTicket if (count($cate_arbo)) { // Categories - print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Categories").''; print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 2c218421543..cd665728af2 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -239,21 +239,21 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } // Output html code for logo - if ($urllogo || getDolGlobalInt('TICKET_PUBLIC_INTERFACE_TOPIC')) { + if ($urllogo || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { print '
'; print '
'; if ($urllogo) { - print ''; + print ''; print ''; print ''; } - if (getDolGlobalInt('TICKET_PUBLIC_INTERFACE_TOPIC')) { + if (getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { print '
'.(getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') : $langs->trans("TicketSystem")).''; } print '
'; if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; + print ''; } print '
'; } diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index aafea0365e0..9ac4b25cb04 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -195,6 +195,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); if ($action == "view_ticketlist") { + print '
'; print '
'; print '
'; @@ -723,6 +724,7 @@ if ($action == "view_ticketlist") { } print '
'; + print '
'; } else { print '
'; diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 81d7d21748f..2ebc3420a14 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -124,4 +124,10 @@ div.ticketform .index_create, div.ticketform .index_display { @media only screen and (max-width: 767px) { #form_create_ticket input.text, #form_create_ticket textarea { width: unset;} + + #form_create_ticket, #form_view_ticket + { + margin-left: 0; + margin-right: 0; + } } From d6e0d745a8369816fa93fe1ecbd8bd9ecf59e877 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2023 22:11:58 +0100 Subject: [PATCH 32/47] FIX token error when closing ticket from public interface --- htdocs/public/ticket/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index edf2504fb0c..9f2eee2a6ea 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -376,7 +376,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; + print ''; } } From 800c2b477979999533603ab80110d0b2a07aabad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 09:33:31 +0100 Subject: [PATCH 33/47] Look and feel v18 --- htdocs/holiday/class/holiday.class.php | 6 +- htdocs/holiday/list.php | 1231 ++++++++++++------------ 2 files changed, 646 insertions(+), 591 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 341b0c700e1..93e443bad69 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1497,9 +1497,11 @@ class Holiday extends CommonObject } $out .= ''."\n"; - $out .= ajax_combobox($htmlname); - print $out; + $showempty= 0; + $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); + + return $out; } /** diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 3f8f9d69131..ed5c222f7c8 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -143,7 +143,13 @@ if ($user->socid > 0) { // Protection if external user accessforbidden(); } -if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled'); +$permissiontoread = $user->hasRight('holiday', 'read'); +$permissiontodelete = $user->hasRight('holiday', 'delete'); +$permissiontoapprove = $user->hasRight('holiday', 'approve'); + +if (!ismodEnabled('holiday')) { + accessforbidden('Module holiday not enabled'); +} $result = restrictedArea($user, 'holiday', '', ''); // If we are on the view of a specific user @@ -152,10 +158,10 @@ if ($id > 0) { if ($id == $user->id) { $canread = 1; } - if (!empty($user->rights->holiday->readall)) { + if ($user->hasRight('holiday', 'readall')) { $canread = 1; } - if (!empty($user->rights->holiday->read) && in_array($id, $childids)) { + if ($user->hasRight('holiday', 'read') && in_array($id, $childids)) { $canread = 1; } if (!$canread) { @@ -165,13 +171,13 @@ if ($id > 0) { - /* * Actions */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -211,9 +217,6 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Holiday'; $objectlabel = 'Holiday'; - $permissiontoread = $user->hasRight('holiday', 'read'); - $permissiontodelete = $user->hasRight('holiday', 'delete'); - $permissiontoapprove = $user->hasRight('holiday', 'approve'); $uploaddir = $conf->holiday->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -236,6 +239,8 @@ $holidaystatic = new Holiday($db); $result = $object->updateBalance(); $title = $langs->trans('CPTitreMenu'); +$help_url = ''; + llxHeader('', $title); $max_year = 5; @@ -304,7 +309,8 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -357,7 +363,7 @@ if ($id > 0) { 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 +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Count total nb of records @@ -374,7 +380,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -389,656 +395,703 @@ if ($limit) { //print $sql; $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - $arrayofselected = is_array($toselect) ? $toselect : array(); +$num = $db->num_rows($resql); - $param = ''; - 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='.urlencode($limit); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_day_create) { - $param .= '&search_day_create='.urlencode($search_day_create); - } - if ($search_month_create) { - $param .= '&search_month_create='.urlencode($search_month_create); - } - if ($search_year_create) { - $param .= '&search_year_create='.urlencode($search_year_create); - } - if ($search_day_start) { - $param .= '&search_day_start='.urlencode($search_day_start); - } - if ($search_month_start) { - $param .= '&search_month_start='.urlencode($search_month_start); - } - if ($search_year_start) { - $param .= '&search_year_start='.urlencode($search_year_start); - } - if ($search_day_end) { - $param .= '&search_day_end='.urlencode($search_day_end); - } - if ($search_month_end) { - $param .= '&search_month_end='.urlencode($search_month_end); - } - if ($search_year_end) { - $param .= '&search_year_end='.urlencode($search_year_end); - } - if ($search_employee > 0) { - $param .= '&search_employee='.urlencode($search_employee); - } - if ($search_valideur > 0) { - $param .= '&search_valideur='.urlencode($search_valideur); - } - if ($search_type > 0) { - $param .= '&search_type='.urlencode($search_type); - } - if ($search_status > 0) { - $param .= '&search_status='.urlencode($search_status); - } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +$arrayofselected = is_array($toselect) ? $toselect : array(); - // List of mass actions available - $arrayofmassactions = array( - //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - ); - if (!empty($user->rights->holiday->delete)) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); - } - if (!empty($user->rights->holiday->approve)) { - $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); - } - if (in_array($massaction, array('presend', 'predelete'))) { - $arrayofmassactions = array(); - } - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$param = ''; +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 ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_day_create) { + $param .= '&search_day_create='.urlencode($search_day_create); +} +if ($search_month_create) { + $param .= '&search_month_create='.urlencode($search_month_create); +} +if ($search_year_create) { + $param .= '&search_year_create='.urlencode($search_year_create); +} +if ($search_day_start) { + $param .= '&search_day_start='.urlencode($search_day_start); +} +if ($search_month_start) { + $param .= '&search_month_start='.urlencode($search_month_start); +} +if ($search_year_start) { + $param .= '&search_year_start='.urlencode($search_year_start); +} +if ($search_day_end) { + $param .= '&search_day_end='.urlencode($search_day_end); +} +if ($search_month_end) { + $param .= '&search_month_end='.urlencode($search_month_end); +} +if ($search_year_end) { + $param .= '&search_year_end='.urlencode($search_year_end); +} +if ($search_employee > 0) { + $param .= '&search_employee='.urlencode($search_employee); +} +if ($search_valideur > 0) { + $param .= '&search_valideur='.urlencode($search_valideur); +} +if ($search_type > 0) { + $param .= '&search_type='.urlencode($search_type); +} +if ($search_status > 0) { + $param .= '&search_status='.urlencode($search_status); +} +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - // Lines of title fields - print ''."\n"; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +// List of mass actions available +$arrayofmassactions = array( + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +if (!empty($permissiontoapprove)) { + $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); +} +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); - if ($id > 0) { - print ''; +print ''."\n"; +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +if ($id > 0) { + print ''; +} + +if ($id > 0) { // For user tab + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; + $head = user_prepare_head($fuser); + + print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + + dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + print '
'; + + print '
'; + + showMyBalance($object, $user_id); } - if ($id > 0) { // For user tab - $title = $langs->trans("User"); - $linkback = ''.$langs->trans("BackToList").''; - $head = user_prepare_head($fuser); + print dol_get_fiche_end(); - print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + // Buttons for actions - dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + print '
'; - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { - print '
'; - - print '
'; - - showMyBalance($object, $user_id); - } - - print dol_get_fiche_end(); - - // Buttons for actions - - print '
'; - - $cancreate = 0; - if (!empty($user->rights->holiday->writeall)) { - $cancreate = 1; - } - if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { - $cancreate = 1; - } - - if ($cancreate) { - print ''.$langs->trans("AddCP").''; - } - - print '
'; - } else { - $title = $langs->trans("ListeCP"); - - - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); + $cancreate = 0; + if (!empty($user->rights->holiday->writeall)) { + $cancreate = 1; + } + if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { + $cancreate = 1; } - $topicmail = "Information"; - $modelmail = "leaverequest"; - $objecttmp = new Holiday($db); - $trackid = 'leav'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - if ($sall) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); - } - print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + if ($cancreate) { + print ''.$langs->trans("AddCP").''; } - $moreforfilter = ''; + print '
'; +} else { + $title = $langs->trans("ListeCP"); - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $moreforfilter .= $hookmanager->resPrint; - } else { - $moreforfilter = $hookmanager->resPrint; + + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitleSeparator(); + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); +} + +$topicmail = "Information"; +$modelmail = "leaverequest"; +$objecttmp = new Holiday($db); +$trackid = 'leav'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) { + $setupstring = ''; + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; + } + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; + +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + $parameters = array('type'=>$type); + $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 .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +$include = ''; +if (empty($user->rights->holiday->readall)) { + $include = 'hierarchyme'; // Can see only its hierarchyl +} + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + +// Fields title search +// -------------------------------------------------------------------- +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; +} + +if (!empty($arrayfields['cp.fk_user']['checked'])) { + $morefilter = ''; + if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { + $morefilter = 'AND employee = 1'; } - if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; + // User + $disabled = 0; + // If into the tab holiday of a user ($id is set in such a case) + if ($id && !GETPOSTISSET('search_employee')) { + $search_employee = $id; + $disabled = 1; } - $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 .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - - - $include = ''; - if (empty($user->rights->holiday->readall)) { - $include = 'hierarchyme'; // Can see only its hierarchyl - } - - print '
'; - print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print '
'."\n"; - - - // Filters - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - } - - if (!empty($arrayfields['cp.fk_user']['checked'])) { - $morefilter = ''; - if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { - $morefilter = 'AND employee = 1'; - } - - // User - $disabled = 0; - // If into the tab holiday of a user ($id is set in such a case) - if ($id && !GETPOSTISSET('search_employee')) { - $search_employee = $id; - $disabled = 1; - } + print ''; +} +// Approver +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + if ($user->hasRight('holiday', 'readall')) { print ''; - } - - // Approver - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->hasRight('holiday', 'readall')) { - print ''; - } else { - print ''; - } - } - - // Type - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print ''; - } - - // Duration - if (!empty($arrayfields['duration']['checked'])) { + } else { print ''; } +} - // Start date - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; +// Type +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''; +} - // End date - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - } +// Duration +if (!empty($arrayfields['duration']['checked'])) { + print ''; +} - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print ''; - } +// Start date +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; +} - // Date appoval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - } +// End date +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; +} - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; +// Date validation +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; - } +// Date appoval +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - } +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Status - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - } +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } +// Create date +if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''; +} - print "\n"; +// Create date +if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; +} - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['duration']['checked'])) { - print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (!empty($arrayfields['cp.date_create']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); - } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - print "\n"; +// Status +if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; +} - $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +print ''."\n"; + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- +print ''; +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['cp.ref']['checked'])) { + print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_user']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['duration']['checked'])) { + print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (!empty($arrayfields['cp.date_create']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.tms']['checked'])) { + print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.statut']['checked'])) { + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +print ''."\n"; + +$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); - // If we ask a dedicated card and not allow to see it, we force on user. - if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { - $langs->load("errors"); - print ''; - $result = 0; - } elseif ($num > 0 && !empty($mysoc->country_id)) { - // Lines - $userstatic = new User($db); - $approbatorstatic = new User($db); +// Loop on record +// -------------------------------------------------------------------- - $typeleaves = $object->getTypes(1, -1); +// If we ask a dedicated card and not allow to see it, we force on user. +if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { + $langs->load("errors"); + print ''; + $result = 0; +} elseif ($num > 0 && !empty($mysoc->country_id)) { + // Lines + $userstatic = new User($db); + $approbatorstatic = new User($db); - $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalduration = 0; - $imaxinloop = ($limit ? min($num, $limit) : $num); - while ($i < $imaxinloop) { - $obj = $db->fetch_object($resql); + $typeleaves = $object->getTypes(1, -1); - // Leave request - $holidaystatic->id = $obj->rowid; - $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); - $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $obj->date_debut; - $holidaystatic->date_fin = $obj->date_fin; + $i = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $totalduration = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } - // User - $userstatic->id = $obj->fk_user; - $userstatic->lastname = $obj->user_lastname; - $userstatic->firstname = $obj->user_firstname; - $userstatic->admin = $obj->user_admin; - $userstatic->email = $obj->user_email; - $userstatic->login = $obj->user_login; - $userstatic->statut = $obj->user_status; - $userstatic->photo = $obj->user_photo; + // Leave request + $holidaystatic->id = $obj->rowid; + $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); + $holidaystatic->statut = $obj->status; + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; - // Validator - $approbatorstatic->id = $obj->fk_validator; - $approbatorstatic->lastname = $obj->validator_lastname; - $approbatorstatic->firstname = $obj->validator_firstname; - $approbatorstatic->admin = $obj->validator_admin; - $approbatorstatic->email = $obj->validator_email; - $approbatorstatic->login = $obj->validator_login; - $approbatorstatic->statut = $obj->validator_status; - $approbatorstatic->photo = $obj->validator_photo; + // User + $userstatic->id = $obj->fk_user; + $userstatic->lastname = $obj->user_lastname; + $userstatic->firstname = $obj->user_firstname; + $userstatic->admin = $obj->user_admin; + $userstatic->email = $obj->user_email; + $userstatic->login = $obj->user_login; + $userstatic->statut = $obj->user_status; + $userstatic->photo = $obj->user_photo; - $date = $obj->date_create; - $date_modif = $obj->date_update; + // Validator + $approbatorstatic->id = $obj->fk_validator; + $approbatorstatic->lastname = $obj->validator_lastname; + $approbatorstatic->firstname = $obj->validator_firstname; + $approbatorstatic->admin = $obj->validator_admin; + $approbatorstatic->email = $obj->validator_email; + $approbatorstatic->login = $obj->validator_login; + $approbatorstatic->statut = $obj->validator_status; + $approbatorstatic->photo = $obj->validator_photo; - $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; - $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + $date = $obj->date_create; + $date_modif = $obj->date_update; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; + $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; + $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - if ($mode == 'kanban') { - if ($i == 0) { - print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - } - } else { - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - } - - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; } + print ''; if (!$i) { $totalarray['nbfield']++; } - - print ''."\n"; } - $i++; - } - - // Add a line for total if there is a total to show - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - if ($key == 'duration') { - print ''; - } else { - print ''; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - // status - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); + } + + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; } + $i++; } - // Si il n'y a pas d'enregistrement suite à une recherche - if ($num == 0) { - $colspan = 1; + // Add a line for total if there is a total to show + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - $colspan++; + if ($key == 'duration') { + print ''; + } else { + print ''; + } } } - print ''; + // status + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; } - - print '
'; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; - print ''; - print ''; + print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); + print ''; - print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ''; - $validator = new UserGroup($db); - $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; - $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); - $valideurarray = array(); - foreach ($valideurobjects as $val) { - $valideurarray[$val] = $val; - } - print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ' '; - if (empty($mysoc->country_id)) { - setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); - } else { - $typeleaves = $holidaystatic->getTypes(1, -1); - $arraytypeleaves = array(); - foreach ($typeleaves as $key => $val) { - $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); - //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); - $arraytypeleaves[$val['rowid']] = $labeltoshow; - } - print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); + $validator = new UserGroup($db); + $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; + $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); + $valideurarray = array(); + foreach ($valideurobjects as $val) { + $valideurarray[$val] = $val; } + print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ' '; - print ''; - print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); - print ''; + if (empty($mysoc->country_id)) { + setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); + } else { + $typeleaves = $holidaystatic->getTypes(1, -1); + $arraytypeleaves = array(); + foreach ($typeleaves as $key => $val) { + $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); + //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); + $arraytypeleaves[$val['rowid']] = $labeltoshow; + } + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); } + print ''; - print ''; - print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); - print ' '; - print ''; + print ''; + print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); + print ''; - print ''; + print ''; + print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); + print ''; + print ''; - print ''; - print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); - print ''; + print ''; - print ''; - print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); - print ''; - $object->selectStatutCP($search_status, 'search_status', 'minwidth125'); - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + print ''; + print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); + print '
'; + print ''; + print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); + print '
'; + print $object->selectStatutCP($search_status, 'search_status', 'search_status width100 onrightofpage'); + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'.$langs->trans("NotEnoughPermissions").'
'.$langs->trans("NotEnoughPermissions").'
'; - print '
'; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + + $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; + + // Output Kanban + if ($massactionbutton || $massaction) { + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); } - $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; - - // Output Kanban - if ($massactionbutton || $massaction) { + $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); + } + print $holidaystatic->getKanbanView('', $arraydata); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) { + if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - } - - $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); - print $holidaystatic->getKanbanView('', $arraydata); - } - if ($i == ($imaxinloop - 1)) { - print ''; - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - print $holidaystatic->getNomUrl(1, 1); - print ''.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).''; - print $labeltypeleavetoshow; - print ''; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; - print $nbopenedday; - //print ' '.$langs->trans('DurationDays'); - print ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'.$totalduration.' '.$langs->trans('DurationDays').''; + print $holidaystatic->getNomUrl(1, 1); + print ''.$userstatic->getNomUrl(-1, 'leave').'
'.$approbatorstatic->getNomUrl(-1).''; + print $labeltypeleavetoshow; + print ''; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); + print ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$totalduration.' '.$langs->trans('DurationDays').'
'.$langs->trans("NoRecordFound").'
'; - print '
'; - - print ''; -} else { - dol_print_error($db); } +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''.$langs->trans("NoRecordFound").''; +} + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''."\n"; +print '
'."\n"; + +print ''."\n"; + // End of page llxFooter(); $db->close(); From 8208884af4bffa25e7b79e332a1e4cf7085c0c11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 09:45:47 +0100 Subject: [PATCH 34/47] Work on kanban views --- htdocs/holiday/class/holiday.class.php | 2 +- htdocs/holiday/list.php | 8 ++++---- htdocs/modulebuilder/template/myobject_list.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 93e443bad69..f3c7130e7f8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -2490,7 +2490,7 @@ class Holiday extends CommonObject $return .= ''; if (property_exists($this, 'fk_type')) { $return .= '
'.$langs->trans("Type").' : '; - $return .= ''.arraydata['labeltype'].''; + $return .= ''.$arraydata['labeltype'].''; } if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { $return .= '
'.dol_print_date($this->date_debut, 'day').''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index ed5c222f7c8..42556f8704c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -582,7 +582,7 @@ if (!empty($moreforfilter)) { } $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) : ''); $include = ''; @@ -745,7 +745,7 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } if (!empty($arrayfields['cp.ref']['checked'])) { @@ -804,7 +804,7 @@ if (!empty($arrayfields['cp.statut']['checked'])) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; @@ -1048,7 +1048,7 @@ if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) } // Add a line for total if there is a total to show - if (!empty($arrayfields['duration']['checked'])) { + if ($mode != 'kanban' && !empty($arrayfields['duration']['checked'])) { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ec5d8c979ed..7a3aae33d9c 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -554,7 +554,7 @@ if (!empty($moreforfilter)) { } $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 '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -631,7 +631,7 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { @@ -663,7 +663,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"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; From f84a8361bc27004b78fb394462a1f62e37f5c74b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:05:00 +0100 Subject: [PATCH 35/47] Look and feel v18 --- htdocs/core/lib/payments.lib.php | 10 ++++++---- htdocs/holiday/list.php | 2 +- htdocs/public/users/view.php | 2 -- htdocs/ticket/card.php | 6 ++++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index db1d0a13db6..93c7a17de2f 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -146,7 +146,7 @@ function payment_supplier_prepare_head(Paiement $object) */ function getValidOnlinePaymentMethods($paymentmethod = '') { - global $conf, $langs, $hookmanager, $action; + global $langs, $hookmanager, $action; $validpaymentmethod = array(); @@ -434,6 +434,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, { global $conf; + $reg = array(); + // Juridical status $line1 = ""; if ($fromcompany->forme_juridique_code) { @@ -485,9 +487,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ''."\n"; + print '
'."\n"; print '
'; - - print '
'."\n"; if ($addformmessage) { print ''; print '
'; @@ -519,5 +520,6 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ' - '; } print $line2; - print '
'."\n"; + print ''; + print '
'."\n"; } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 42556f8704c..0be113d8205 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -881,7 +881,7 @@ if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) print '
'; } - $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; + $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type]['rowid']) ? 0 : $typeleaves[$obj->fk_type]['rowid']; // Output Kanban if ($massactionbutton || $massaction) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 0eaeb1b6c8f..30b76404472 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -451,8 +451,6 @@ print '
'."\n"; print '
'; -//htmlPrintOnlinePaymentFooter($mysoc, $langs); - print '
'; print '
'; print ''; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 42afd27304b..8e2114f9bae 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1248,10 +1248,12 @@ if ($action == 'create' || $action == 'presend') { } print ''; // Group - print ''.$langs->trans("TicketCategory").''; + $s = ''; if (!empty($object->category_code)) { - print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); } + print ''.$langs->trans("TicketCategory").''; + print dol_escape_htmltag($s); print ''; // Severity print ''.$langs->trans("TicketSeverity").''; From 2ef0f08c97df0263b3198b69f4a73df10900bfe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:20:03 +0100 Subject: [PATCH 36/47] PHPunit --- test/phpunit/FunctionsLibTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 11eff71d4c6..7508c539208 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -180,7 +180,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // An attempt for SQL injection $filter='if(now()=sysdate()%2Csleep(6)%2C0)'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, '1 = 3'); + $this->assertEquals($sql, 'Filter syntax error'); // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; From 04c6cb22a15e545f99c190da8a9211c8ac62999c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 10:22:40 +0100 Subject: [PATCH 37/47] Fix universal filter for != --- htdocs/core/lib/functions.lib.php | 2 +- test/phpunit/FunctionsLibTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 74947d9dd71..4eeb5994334 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11685,7 +11685,7 @@ function dolForgeCriteriaCallback($matches) return ''; } - $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + $operator = strtoupper(preg_replace('/[^a-z<>=!]/i', '', trim($tmp[1]))); if ($operator == 'NOTLIKE') { $operator = 'NOT LIKE'; } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 7508c539208..f398aef1050 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -185,7 +185,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc = 1.23))'); + $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc <> 1.23))'); $filter="(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.date_creation:<:'2016-01-01 12:30:00') or (t.nature:is:NULL)"; $sql = forgeSQLFromUniversalSearchCriteria($filter); From d369a640de4752fce27091bf0685b5fcfb6df2b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 12:48:25 +0100 Subject: [PATCH 38/47] Fix encryption of api_key --- htdocs/api/class/api_access.class.php | 10 ++++++---- htdocs/api/class/api_login.class.php | 3 ++- htdocs/core/lib/security.lib.php | 12 ++++++++++-- htdocs/user/class/user.class.php | 6 ++++-- htdocs/user/list.php | 9 ++++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 7839cf14efc..d54b5771514 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -113,15 +113,15 @@ class DolibarrApiAccess implements iAuthenticate $sql = "SELECT u.login, u.datec, u.api_key, "; $sql .= " u.tms as date_modification, u.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."'"; - // TODO Check if 2 users has same API key. + $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."' OR u.api_key = '".$this->db->escape(dolEncrypt($api_key, '', '', 'dolibarr'))."'"; $result = $this->db->query($sql); if ($result) { - if ($this->db->num_rows($result)) { + $nbrows = $this->db->num_rows($result); + if ($nbrows == 1) { $obj = $this->db->fetch_object($result); $login = $obj->login; - $stored_key = $obj->api_key; + $stored_key = dolDecrypt($obj->api_key); $userentity = $obj->entity; if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) { // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user @@ -130,6 +130,8 @@ class DolibarrApiAccess implements iAuthenticate dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING); $conf->setValues($this->db); } + } elseif ($nbrows > 1) { + throw new RestException(503, 'Error when fetching user api_key : More than 1 user with this apikey'); } } else { throw new RestException(503, 'Error when fetching user api_key :'.$this->db->error_msg); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index d5362f4ac56..bf4f7ffd318 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -18,6 +18,7 @@ use Luracast\Restler\RestException; +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; /** @@ -149,7 +150,7 @@ class Login // We store API token into database $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET api_key = '".$this->db->escape($token)."'"; + $sql .= " SET api_key = '".$this->db->escape(dolEncrypt($token, '', '', 'dolibarr'))."'"; $sql .= " WHERE login = '".$this->db->escape($login)."'"; dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 5a610090be2..7ee9f7ce9b5 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -113,10 +113,11 @@ function dolGetRandomBytes($length) * @param string $chain string to encode * @param string $key If '', we use $dolibarr_main_instance_unique_id * @param string $ciphering Default ciphering algorithm + * @param string $forceseed To force the seed * @return string encoded string * @see dolDecrypt(), dol_hash() */ -function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") +function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = '') { global $dolibarr_main_instance_unique_id; global $dolibarr_disable_dolcrypt_for_debug; @@ -134,6 +135,9 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if (empty($key)) { $key = $dolibarr_main_instance_unique_id; } + if (empty($ciphering)) { + $ciphering = 'AES-256-CTR'; + } $newchain = $chain; @@ -145,7 +149,11 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if ($ivlen === false || $ivlen < 1 || $ivlen > 32) { $ivlen = 16; } - $ivseed = dolGetRandomBytes($ivlen); + if (empty($forceseed)) { + $ivseed = dolGetRandomBytes($ivlen); + } else { + $ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1); + } $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed); return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 46b4b12a25e..5bea5b9f754 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -35,9 +35,11 @@ * \ingroup core */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; + /** * Class to manage Dolibarr users */ @@ -526,7 +528,7 @@ class User extends CommonObject $this->pass_indatabase_crypted = $obj->pass_crypted; $this->pass = $obj->pass; $this->pass_temp = $obj->pass_temp; - $this->api_key = $obj->api_key; + $this->api_key = dolDecrypt($obj->api_key); $this->address = $obj->address; $this->zip = $obj->zip; @@ -1977,7 +1979,7 @@ class User extends CommonObject $sql .= ", national_registration_number = '".$this->db->escape($this->national_registration_number)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; - $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); + $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape(dolEncrypt($this->api_key, '', '', 'dolibarr'))."'" : "null"); $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null'); if (!empty($user->admin)) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index a269a93fb7b..19022cceccf 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1127,10 +1127,13 @@ while ($i < $imaxinloop) { } } if (!empty($arrayfields['u.api_key']['checked'])) { - print ''; - if ($obj->api_key) { + $api_key = dolDecrypt($obj->api_key); + print ''; + if ($api_key) { if ($canreadsecretapi) { - print dol_escape_htmltag($obj->api_key); + print ''; + print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste + print ''; } else { print ''.$langs->trans("Hidden").''; } From f29d5c784401f0adef68c9de4a4cadd659edae38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:17:49 +0100 Subject: [PATCH 39/47] Bettr order for mass action --- htdocs/commande/list.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 177f68a1fbb..c665166b0af 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -223,6 +223,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$error = 0; /* @@ -1284,24 +1285,24 @@ if ($resql) { if ($permissiontovalidate) { $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } - if ($permissiontosendbymail) { - $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); - } if ($permissiontoclose) { $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); } - if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); - } - if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { - $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); - } if ($permissiontoclose) { $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); + } + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); } From dc1ba8f447b8ceb02f14042e04c25fa7c0be0e3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:19:24 +0100 Subject: [PATCH 40/47] Fix phpunit --- test/phpunit/FunctionsLibTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index d910a9f9d57..92b75c5aa97 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -185,7 +185,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase // A real search string $filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))'; $sql = forgeSQLFromUniversalSearchCriteria($filter); - $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc = 1.23))'); + $this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc <> 1.23))'); $filter="(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.date_creation:<:'2016-01-01 12:30:00') or (t.nature:is:NULL)"; $sql = forgeSQLFromUniversalSearchCriteria($filter); From 7a1404c4430cbda3a65f4486672239865d03dd83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 13:21:48 +0100 Subject: [PATCH 41/47] Fix sql --- .../install/mysql/data/llx_00_c_country.sql | 498 +++++++++--------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index bbc0be55335..829d6ffe8cb 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -279,255 +279,255 @@ INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUE -UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG"; -UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA"; -UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB"; -UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU"; -UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND"; -UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO"; -UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA"; -UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA"; -UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG"; -UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU"; -UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA"; -UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG"; -UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM"; -UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW"; -UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS"; -UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT"; -UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE"; -UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS"; -UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD"; -UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB"; -UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR"; -UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL"; -UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ"; -UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN"; -UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU"; -UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR"; -UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL"; -UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES"; -UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH"; -UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA"; -UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA"; -UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN"; -UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR"; -UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA"; -UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI"; -UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN"; -UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV"; -UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM"; -UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR"; -UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN"; -UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT"; -UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD"; -UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL"; -UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN"; -UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP"; -UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL"; -UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM"; -UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK"; -UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR"; -UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV"; -UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI"; -UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV"; -UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB"; -UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW"; -UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK"; -UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA"; -UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU"; -UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY"; -UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV"; -UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE"; -UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI"; -UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK"; -UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN"; -UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP"; -UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA"; -UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST"; -UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH"; -UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL"; -UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN"; -UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI"; -UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA"; -UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB"; -UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB"; -UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO"; -UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA"; -UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB"; -UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD"; -UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC"; -UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL"; -UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP"; -UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM"; -UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM"; -UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF"; -UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY"; -UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN"; -UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB"; -UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ"; -UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY"; -UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI"; -UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND"; -UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG"; -UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN"; -UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND"; -UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN"; -UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ"; -UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN"; -UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL"; -UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT"; -UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN"; -UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR"; -UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL"; -UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM"; -UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK"; -UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK"; -UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO"; -UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS"; -UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD"; -UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK"; -UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP"; -UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL"; -UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN"; -UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB"; -UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA"; -UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI"; -UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB"; -UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR"; -UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR"; -UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA"; -UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM"; -UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN"; -UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY"; -UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR"; -UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ"; -UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN"; -UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ"; -UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR"; -UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT"; -UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO"; -UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO"; -UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA"; -UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN"; -UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR"; -UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY"; -UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE"; -UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU"; -UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX"; -UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC"; -UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD"; -UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG"; -UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS"; -UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI"; -UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV"; -UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI"; -UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT"; -UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR"; -UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ"; -UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS"; -UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT"; -UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT"; -UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX"; -UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM"; -UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA"; -UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO"; -UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG"; -UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE"; -UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR"; -UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ"; -UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR"; -UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM"; -UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU"; -UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL"; -UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC"; -UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER"; -UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA"; -UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU"; -UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK"; -UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR"; -UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL"; -UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL"; -UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN"; -UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD"; -UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK"; -UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW"; -UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE"; -UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN"; -UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG"; -UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY"; -UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER"; -UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF"; -UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL"; -UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT"; -UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI"; -UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR"; -UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH"; -UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF"; -UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE"; -UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG"; -UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD"; -UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM"; -UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU"; -UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA"; -UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU"; -UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS"; -UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM"; -UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM"; -UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM"; -UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA"; -UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR"; -UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF"; -UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM"; -UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT"; -UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN"; -UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA"; -UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP"; -UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN"; -UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB"; -UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC"; -UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE"; -UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP"; -UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM"; -UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR"; -UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM"; -UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA"; -UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ"; -UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF"; -UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN"; -UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD"; -UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE"; -UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE"; -UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR"; -UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM"; -UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA"; -UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN"; -UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA"; -UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK"; -UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT"; -UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF"; -UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS"; -UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO"; -UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL"; -UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON"; -UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO"; -UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN"; -UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM"; -UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR"; -UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV"; -UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR"; -UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA"; -UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY"; -UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB"; -UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT"; -UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT"; -UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN"; -UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM"; -UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF"; -UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM"; -UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI"; -UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB"; -UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE"; +UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG'; +UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA'; +UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB'; +UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU'; +UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND'; +UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO'; +UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA'; +UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA'; +UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG'; +UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU'; +UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA'; +UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG'; +UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM'; +UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW'; +UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS'; +UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT'; +UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE'; +UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS'; +UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD'; +UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB'; +UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR'; +UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL'; +UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ'; +UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN'; +UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU'; +UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR'; +UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL'; +UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES'; +UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH'; +UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA'; +UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA'; +UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN'; +UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR'; +UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA'; +UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI'; +UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN'; +UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV'; +UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM'; +UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR'; +UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN'; +UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT'; +UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD'; +UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL'; +UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN'; +UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP'; +UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL'; +UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM'; +UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK'; +UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR'; +UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV'; +UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI'; +UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV'; +UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB'; +UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW'; +UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK'; +UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA'; +UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU'; +UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY'; +UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV'; +UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE'; +UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI'; +UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK'; +UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN'; +UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP'; +UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA'; +UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST'; +UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH'; +UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL'; +UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN'; +UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI'; +UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA'; +UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB'; +UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB'; +UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO'; +UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA'; +UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB'; +UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD'; +UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC'; +UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL'; +UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP'; +UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM'; +UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM'; +UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF'; +UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY'; +UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN'; +UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB'; +UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ'; +UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY'; +UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI'; +UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND'; +UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG'; +UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN'; +UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND'; +UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN'; +UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ'; +UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN'; +UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL'; +UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT'; +UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN'; +UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR'; +UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL'; +UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM'; +UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK'; +UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK'; +UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO'; +UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS'; +UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD'; +UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK'; +UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP'; +UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL'; +UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN'; +UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB'; +UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA'; +UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI'; +UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB'; +UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR'; +UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR'; +UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA'; +UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM'; +UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN'; +UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY'; +UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR'; +UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ'; +UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN'; +UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ'; +UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR'; +UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT'; +UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO'; +UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO'; +UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA'; +UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN'; +UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR'; +UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY'; +UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE'; +UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU'; +UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX'; +UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC'; +UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD'; +UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG'; +UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS'; +UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI'; +UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV'; +UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI'; +UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT'; +UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR'; +UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ'; +UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS'; +UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT'; +UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT'; +UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX'; +UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM'; +UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA'; +UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO'; +UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG'; +UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE'; +UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR'; +UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ'; +UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR'; +UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM'; +UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU'; +UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL'; +UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC'; +UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER'; +UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA'; +UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU'; +UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK'; +UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR'; +UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL'; +UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL'; +UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN'; +UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD'; +UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK'; +UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW'; +UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE'; +UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN'; +UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG'; +UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY'; +UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER'; +UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF'; +UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL'; +UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT'; +UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI'; +UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR'; +UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH'; +UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF'; +UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE'; +UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG'; +UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD'; +UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM'; +UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU'; +UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA'; +UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU'; +UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS'; +UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM'; +UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM'; +UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM'; +UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA'; +UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR'; +UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF'; +UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM'; +UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT'; +UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN'; +UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA'; +UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP'; +UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN'; +UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB'; +UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC'; +UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE'; +UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP'; +UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM'; +UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR'; +UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM'; +UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA'; +UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ'; +UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF'; +UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN'; +UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD'; +UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE'; +UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE'; +UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR'; +UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM'; +UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA'; +UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN'; +UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA'; +UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK'; +UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT'; +UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF'; +UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS'; +UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO'; +UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL'; +UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON'; +UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO'; +UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN'; +UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM'; +UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR'; +UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV'; +UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR'; +UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA'; +UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY'; +UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB'; +UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT'; +UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT'; +UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN'; +UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM'; +UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF'; +UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM'; +UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI'; +UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB'; +UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE'; From 4f7c54c125f8f88a7d183078f49f978013950e50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 15:57:36 +0100 Subject: [PATCH 42/47] Debug v18 --- htdocs/core/ajax/security.php | 2 +- htdocs/core/lib/security2.lib.php | 3 + .../install/mysql/migration/17.0.0-18.0.0.sql | 498 +++++++++--------- htdocs/user/card.php | 12 +- 4 files changed, 260 insertions(+), 255 deletions(-) diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index b01c952662e..2a836359e1c 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -36,7 +36,7 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -// We need langs because the getRandomPassword may use user language to define some rules of pass generation +// We need langs because the getRandomPassword may use the user language to define some rules of pass generation /*if (!defined('NOREQUIRETRAN')) { define('NOREQUIRETRAN', '1'); }*/ diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index c68bb49d93b..b60054b9701 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -581,6 +581,9 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token token: \''.dol_escape_js(newToken()).'\' }, function(result) { + if ($("input#'.dol_escape_js($htmlname).'").attr("type") == "password") { + $("input#'.dol_escape_js($htmlname).'").attr("type", "text"); + } $("#'.dol_escape_js($htmlname).'").val(result); }); }); 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 e1830c6473b..1299e5f3a13 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 @@ -123,254 +123,254 @@ ALTER TABLE llx_element_time ADD INDEX idx_element_time_datehour (element_dateho ALTER TABLE llx_c_country ADD COLUMN numeric_code VARCHAR(3); -UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG"; -UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA"; -UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB"; -UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU"; -UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND"; -UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO"; -UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA"; -UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA"; -UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG"; -UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU"; -UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA"; -UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG"; -UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM"; -UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW"; -UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS"; -UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT"; -UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE"; -UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS"; -UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD"; -UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB"; -UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR"; -UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL"; -UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ"; -UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN"; -UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU"; -UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR"; -UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL"; -UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES"; -UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH"; -UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA"; -UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA"; -UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN"; -UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR"; -UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA"; -UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI"; -UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN"; -UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV"; -UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM"; -UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR"; -UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN"; -UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT"; -UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD"; -UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL"; -UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN"; -UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP"; -UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL"; -UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM"; -UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK"; -UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR"; -UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV"; -UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI"; -UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV"; -UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB"; -UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW"; -UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK"; -UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA"; -UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU"; -UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY"; -UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV"; -UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE"; -UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI"; -UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK"; -UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN"; -UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP"; -UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA"; -UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST"; -UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH"; -UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL"; -UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN"; -UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI"; -UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA"; -UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB"; -UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB"; -UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO"; -UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA"; -UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB"; -UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD"; -UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC"; -UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL"; -UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP"; -UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM"; -UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM"; -UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF"; -UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY"; -UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN"; -UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB"; -UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ"; -UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY"; -UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI"; -UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND"; -UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG"; -UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN"; -UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND"; -UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN"; -UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ"; -UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN"; -UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL"; -UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT"; -UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN"; -UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR"; -UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL"; -UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM"; -UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK"; -UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK"; -UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO"; -UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS"; -UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD"; -UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK"; -UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP"; -UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL"; -UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN"; -UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB"; -UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA"; -UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI"; -UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB"; -UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR"; -UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR"; -UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA"; -UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM"; -UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN"; -UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY"; -UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR"; -UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ"; -UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN"; -UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ"; -UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR"; -UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT"; -UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO"; -UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO"; -UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA"; -UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN"; -UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR"; -UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY"; -UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE"; -UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU"; -UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX"; -UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC"; -UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD"; -UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG"; -UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS"; -UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI"; -UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV"; -UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI"; -UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT"; -UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR"; -UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ"; -UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS"; -UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT"; -UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT"; -UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX"; -UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM"; -UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA"; -UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO"; -UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG"; -UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE"; -UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR"; -UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ"; -UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR"; -UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM"; -UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU"; -UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL"; -UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC"; -UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER"; -UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA"; -UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU"; -UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK"; -UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR"; -UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL"; -UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL"; -UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN"; -UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD"; -UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK"; -UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW"; -UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE"; -UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN"; -UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG"; -UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY"; -UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER"; -UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF"; -UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL"; -UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT"; -UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI"; -UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR"; -UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH"; -UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF"; -UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE"; -UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG"; -UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD"; -UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM"; -UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU"; -UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA"; -UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU"; -UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS"; -UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM"; -UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM"; -UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM"; -UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA"; -UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR"; -UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF"; -UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM"; -UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT"; -UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN"; -UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA"; -UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP"; -UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN"; -UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB"; -UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC"; -UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE"; -UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP"; -UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM"; -UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR"; -UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM"; -UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA"; -UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ"; -UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF"; -UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN"; -UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD"; -UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE"; -UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE"; -UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR"; -UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM"; -UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA"; -UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN"; -UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA"; -UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK"; -UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT"; -UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF"; -UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS"; -UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO"; -UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL"; -UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON"; -UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO"; -UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN"; -UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM"; -UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR"; -UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV"; -UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR"; -UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA"; -UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY"; -UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB"; -UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT"; -UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT"; -UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN"; -UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM"; -UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF"; -UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM"; -UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI"; -UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB"; -UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE"; +UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG'; +UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA'; +UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB'; +UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU'; +UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND'; +UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO'; +UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA'; +UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA'; +UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG'; +UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU'; +UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA'; +UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG'; +UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM'; +UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW'; +UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS'; +UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT'; +UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE'; +UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS'; +UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD'; +UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB'; +UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR'; +UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL'; +UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ'; +UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN'; +UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU'; +UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR'; +UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL'; +UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES'; +UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH'; +UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA'; +UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA'; +UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN'; +UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR'; +UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA'; +UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI'; +UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN'; +UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV'; +UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM'; +UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR'; +UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN'; +UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT'; +UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD'; +UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL'; +UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN'; +UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP'; +UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL'; +UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM'; +UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK'; +UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR'; +UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV'; +UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI'; +UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV'; +UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB'; +UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW'; +UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK'; +UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA'; +UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU'; +UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY'; +UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV'; +UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE'; +UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI'; +UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK'; +UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN'; +UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP'; +UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA'; +UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST'; +UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH'; +UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL'; +UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN'; +UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI'; +UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA'; +UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB'; +UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB'; +UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO'; +UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA'; +UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB'; +UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD'; +UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC'; +UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL'; +UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP'; +UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM'; +UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM'; +UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF'; +UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY'; +UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN'; +UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB'; +UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ'; +UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY'; +UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI'; +UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND'; +UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG'; +UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN'; +UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND'; +UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN'; +UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ'; +UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN'; +UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL'; +UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT'; +UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN'; +UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR'; +UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL'; +UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM'; +UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK'; +UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK'; +UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO'; +UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS'; +UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD'; +UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK'; +UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP'; +UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL'; +UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN'; +UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB'; +UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA'; +UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI'; +UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB'; +UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR'; +UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR'; +UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA'; +UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM'; +UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN'; +UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY'; +UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR'; +UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ'; +UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN'; +UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ'; +UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR'; +UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT'; +UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO'; +UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO'; +UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA'; +UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN'; +UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR'; +UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY'; +UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE'; +UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU'; +UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX'; +UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC'; +UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD'; +UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG'; +UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS'; +UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI'; +UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV'; +UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI'; +UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT'; +UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR'; +UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ'; +UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS'; +UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT'; +UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT'; +UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX'; +UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM'; +UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA'; +UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO'; +UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG'; +UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE'; +UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR'; +UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ'; +UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR'; +UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM'; +UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU'; +UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL'; +UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC'; +UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER'; +UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA'; +UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU'; +UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK'; +UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR'; +UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL'; +UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL'; +UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN'; +UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD'; +UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK'; +UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW'; +UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE'; +UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN'; +UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG'; +UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY'; +UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER'; +UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF'; +UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL'; +UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT'; +UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI'; +UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR'; +UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH'; +UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF'; +UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE'; +UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG'; +UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD'; +UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM'; +UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU'; +UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA'; +UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU'; +UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS'; +UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM'; +UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM'; +UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM'; +UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA'; +UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR'; +UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF'; +UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM'; +UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT'; +UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN'; +UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA'; +UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP'; +UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN'; +UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB'; +UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC'; +UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE'; +UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP'; +UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM'; +UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR'; +UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM'; +UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA'; +UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ'; +UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF'; +UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN'; +UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD'; +UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE'; +UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE'; +UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR'; +UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM'; +UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA'; +UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN'; +UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA'; +UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK'; +UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT'; +UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF'; +UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS'; +UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO'; +UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL'; +UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON'; +UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO'; +UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN'; +UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM'; +UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR'; +UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV'; +UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR'; +UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA'; +UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY'; +UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB'; +UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT'; +UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT'; +UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN'; +UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM'; +UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF'; +UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM'; +UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI'; +UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB'; +UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8db29a87449..dfd90b4dc0f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1046,13 +1046,13 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword"); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read $valuetoshow .= ($valuetoshow ? ' + ' : '').''; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } else { // We do not use a field password but a field text to show new password to use. - $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; + $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; if (!empty($conf->use_javascript_ajax)) { $valuetoshow .= ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject"'); } @@ -1076,7 +1076,7 @@ if ($action == 'create' || $action == 'adduserldap') { //$generated_password = getRandomPassword(false); print ''.$langs->trans("ApiKey").''; print ''; - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); } @@ -2423,14 +2423,16 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$form->textwithpicto($text, $langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1, 'warning'); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if ($caneditpassword) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; + if (!empty($conf->use_javascript_ajax)) { + $valuetoshow .= ' '.img_picto((getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? $langs->trans('NoPasswordGenerationRuleConfigured') : $langs->trans('Generate')), 'refresh', 'id="generate_password" class="'.(getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? ' opacitymedium' : ' linkobject').'"'); + } } else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); } } - // Other form for user password $parameters = array('valuetoshow' => $valuetoshow, 'caneditpassword' => $caneditpassword); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From ca096089fb8c5d26d0fdb2914f0a79ffbfa0e931 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Mar 2023 16:28:58 +0100 Subject: [PATCH 43/47] Debug v18 --- htdocs/public/users/view.php | 15 ++++++++++++++- htdocs/user/class/user.class.php | 7 ++++++- htdocs/user/virtualcard.php | 7 ++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 30b76404472..c62420c76d8 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -205,7 +205,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview nopointervent' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print ''."\n"; print '
'."\n"; @@ -463,6 +463,19 @@ print '
'; //print '
'; print '
'; +$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); +$fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); + +print ''; + llxFooter('', 'public'); $db->close(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fac112bd7b4..1186cf7a914 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3869,9 +3869,10 @@ class User extends CommonObject * Return string with full Url to virtual card * * @param string $mode Mode for link + * @param string $typeofurl 'external' or 'internal' * @return string Url string link */ - public function getOnlineVirtualCardUrl($mode = '') + public function getOnlineVirtualCardUrl($mode = '', $typeofurl = 'external') { global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; global $conf; @@ -3887,6 +3888,10 @@ class User extends CommonObject $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + if ($typeofurl == 'internal') { + $urlwithroot = DOL_URL_ROOT; + } + return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr.($mode ? '&mode='.urlencode($mode) : ''); } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 252ae3aca80..55d63c3d40a 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -165,7 +165,8 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'globe').' '.$langs->trans('PublicVirtualCardUrl').'
'; - $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl(); + $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); + $fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); print '
'; + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id); + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'invoice', $socid, 1); + $somethingshown = $formactions->showactions($object, 'invoice', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty print '
'; } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php deleted file mode 100644 index 0619d629385..00000000000 --- a/htdocs/compta/facture/info.php +++ /dev/null @@ -1,144 +0,0 @@ - - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2017 Ferran Marcet - * - * 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/compta/facture/info.php - * \ingroup facture - * \brief Page des informations d'une facture - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; -if (isModEnabled('project')) { - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} - -// Load translation files required by the page -$langs->loadLangs(array('companies', 'bills')); - -$id = GETPOST("facid", "int"); -$ref = GETPOST("ref", 'alpha'); - -$object = new Facture($db); - -$extrafields = new ExtraFields($db); - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); -} - -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); - -$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); - -$usercancreate = $user->hasRight("facture", "creer"); - - -/* - * View - */ - -$form = new Form($db); - -$title = $object->ref." - ".$langs->trans('Info'); -$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; - -llxHeader('', $title, $help_url); - -if (empty($object->id)) { - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} - -$object->fetch_thirdparty(); - -$object->info($object->id); - -$head = facture_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'); - -$totalpaid = $object->getSommePaiement(); - -// Invoice content - -$linkback = ''.$langs->trans("BackToList").''; - -$morehtmlref = '
'; -// 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 .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); -// Project -if (isModEnabled('project')) { - $langs->load("projects"); - $morehtmlref .= '
'; - if (0) { - $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 .= '
'; - -$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - -dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); - -print '
'; -print '
'; - -print '
'; - -print '
'; -dol_print_object_info($object); -print '
'; - -print '
'; - -print dol_get_fiche_end(); - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index eb428c8a1cd..360e9680cb6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -112,6 +112,7 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'alpha'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); +$search_company_code_client = GETPOST("search_type_thirdparty", 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_date_startday = GETPOST('search_date_startday', 'int'); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index adf9d00e871..ecedab797ac 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -190,14 +190,10 @@ class FormActions $num = count($listofactions); if ($num || $forceshowtitle) { - if ($typeelement == 'invoice') { - $title = $langs->trans('ActionsOnBill'); - } elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') { + if ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') { $title = $langs->trans('ActionsOnBill'); } elseif ($typeelement == 'supplier_proposal') { $title = $langs->trans('ActionsOnSupplierProposal'); - } elseif ($typeelement == 'order') { - $title = $langs->trans('ActionsOnOrder'); } elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') { $title = $langs->trans('ActionsOnOrder'); } elseif ($typeelement == 'shipping') { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a560f5e34f7..f35561d25a1 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1644,11 +1644,21 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin if ($filterobj->id) { $sql .= " AND a.fk_element = ".((int) $filterobj->id); } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; if ($filterobj->id) { $sql .= " AND a.fk_element = ".((int) $filterobj->id); } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; if ($filterobj->id) { diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index cf02832606a..3b17c830ed4 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -35,19 +35,19 @@ */ function facture_prepare_head($object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?id='.$object->id; $head[$h][1] = $langs->trans('CustomerInvoice'); $head[$h][2] = 'compta'; $h++; if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?id='.urlencode($object->id); $head[$h][1] = $langs->trans('ContactsAddresses'); if ($nbContact > 0) { $head[$h][1] .= ''.$nbContact.''; @@ -73,7 +73,7 @@ function facture_prepare_head($object) } $langs->load("banks"); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?id='.urlencode($object->id); $head[$h][1] = $langs->trans('StandingOrders'); if ($nbStandingOrders > 0) { $head[$h][1] .= ''.$nbStandingOrders.''; @@ -96,7 +96,7 @@ function facture_prepare_head($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { $head[$h][1] .= ''.$nbNote.''; @@ -110,7 +110,7 @@ function facture_prepare_head($object) $upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { $head[$h][1] .= ''.($nbFiles + $nbLinks).''; @@ -118,9 +118,39 @@ function facture_prepare_head($object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; - $head[$h][1] = $langs->trans('Info'); - $head[$h][2] = 'info'; + + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + $nbEvent = 0; + // Enable caching of thirdparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_facture_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $nbEvent = $dataretrieved; + } else { + $sql = "SELECT COUNT(id) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".((int) $object->id); + $sql .= " AND elementtype = 'invoice'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbEvent = $obj->nb; + } else { + dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); + } + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. + } + + $head[$h][1] .= '/'; + $head[$h][1] .= $langs->trans("Agenda"); + if ($nbEvent > 0) { + $head[$h][1] .= ''.$nbEvent.''; + } + } + $head[$h][2] = 'agenda'; $h++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'add', 'external'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index a106bf62369..cb5a2247953 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -128,9 +128,39 @@ function commande_prepare_head(Commande $object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; + + $head[$h][0] = DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + $nbEvent = 0; + // Enable caching of thirdparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_propal_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $nbEvent = $dataretrieved; + } else { + $sql = "SELECT COUNT(id) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".((int) $object->id); + $sql .= " AND elementtype = 'order'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbEvent = $obj->nb; + } else { + dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); + } + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. + } + + $head[$h][1] .= '/'; + $head[$h][1] .= $langs->trans("Agenda"); + if ($nbEvent > 0) { + $head[$h][1] .= ''.$nbEvent.''; + } + } + $head[$h][2] = 'agenda'; $h++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'add', 'external');