From 278b708e1729345b1d47f022ec2c55f3cd8651ad Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 11 Apr 2019 11:57:50 +0200 Subject: [PATCH 001/797] use subproducts costprice and pmp if empty on father --- htdocs/fourn/ajax/getSupplierPrices.php | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 85b0ed37155..57874e3a122 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,12 +86,46 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; + if (empty($price)) + { + // get costprice for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->cost_price; + } + } + } + $prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() if(!empty($conf->stock->enabled)) { // Add price for pmp $price=$producttmp->pmp; + if (empty($price)) + { + // get pmp for subproducts if any + $producttmp->get_sousproduits_arbo(); + $prods_arbo=$producttmp->get_arbo_each_prod(); + if (!empty($prods_arbo)) + { + $price = 0; + foreach($prods_arbo as $child) + { + $sousprod = new Product($db); + $sousprod->fetch($child['id']); + $price += $sousprod->pmp; + } + } + } + $prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price() } } From 30ad0e7e11260d089d30743f1536ab4248031fc8 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Apr 2019 09:00:39 +0200 Subject: [PATCH 002/797] introduce PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY --- htdocs/fourn/ajax/getSupplierPrices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/ajax/getSupplierPrices.php b/htdocs/fourn/ajax/getSupplierPrices.php index 57874e3a122..211734f1129 100644 --- a/htdocs/fourn/ajax/getSupplierPrices.php +++ b/htdocs/fourn/ajax/getSupplierPrices.php @@ -86,7 +86,7 @@ if ($idprod > 0) // Add price for costprice $price=$producttmp->cost_price; - if (empty($price)) + if (empty($price) && ! empty($conf->global->PRODUCT_USE_SUB_COST_PRICES_IF_COST_PRICE_EMPTY)) { // get costprice for subproducts if any $producttmp->get_sousproduits_arbo(); From 4aab805b4edfbb536690b2c279e0078374d7b165 Mon Sep 17 00:00:00 2001 From: Laurent Magnin Date: Fri, 16 Apr 2021 12:39:39 +0200 Subject: [PATCH 003/797] FIX:Add ticket substition template --- htdocs/core/lib/functions.lib.php | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2b981530834..c3ce5128f57 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6838,6 +6838,28 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, /*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__'; $substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/ } +// add variables subtitutions ticket + if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) { + $substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__'; + $substitutionarray['__TICKET_REF__'] = '__TICKET_REF__'; + $substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__'; + $substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__'; + $substitutionarray['__TICKET_SEVERITY__'] = '__TICKET_SEVERITY__'; + $substitutionarray['__TICKET_CATEGORY__'] = '__TICKET_CATEGORY__'; + $substitutionarray['__TICKET_ANALYTIC_CODE__'] = '__TICKET_ANALYTIC_CODE__'; + $substitutionarray['__TICKET_MESSAGE__'] = '__TICKET_MESSAGE__'; + $substitutionarray['__TICKET_PROGRESSION__'] = '__TICKET_PROGRESSION__'; + $substitutionarray['__TICKET_USER_ASSIGN__'] = '__TICKET_USER_ASSIGN__'; + $substitutionarray['__TICKET_USER_CREATE__'] = '__TICKET_USER_CREATE__'; + + +} + + + + + + if (!empty($conf->recruitment->enabled) && (!is_object($object) || $object->element == 'candidature')) { $substitutionarray['__CANDIDATE_FULLNAME__'] = '__CANDIDATE_FULLNAME__'; $substitutionarray['__CANDIDATE_FIRSTNAME__'] = '__CANDIDATE_FIRSTNAME__'; @@ -7025,6 +7047,21 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc'); $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard'); } +// add substition variable for ticket + if (is_object($object) && $object->element == 'ticket') { + $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; + $substitutionarray['__TICKET_REF__'] = $object->ref; + $substitutionarray['__TICKET_SUBJECT__'] = $object->subject; + $substitutionarray['__TICKET_TYPE__'] = $object->type_code; + $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code; + $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility + $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code; + $substitutionarray['__TICKET_MESSAGE__'] = $object->message; + $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress; + $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($user->firstname, $user->lastname); + $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($user->firstname, $user->lastname); + } + // Create dynamic tags for __EXTRAFIELD_FIELD__ if ($object->table_element && $object->id > 0) { From ff178667a3ee966b865c6693e961866bdd043893 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Tue, 11 May 2021 12:33:35 +0200 Subject: [PATCH 004/797] add thirdparty customer code to substitutionarray --- htdocs/comm/mailing/card.php | 7 +++++++ htdocs/core/class/html.formmail.class.php | 2 ++ htdocs/langs/fr_FR/mails.lang | 2 ++ 3 files changed, 11 insertions(+) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 5148956163e..4bf304bc519 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -201,6 +201,13 @@ if (empty($reshook)) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray['__ID__'] = $obj->source_id; + if ($obj->source_type == "thirdparty") { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($obj->source_id); + + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + } $substitutionarray['__EMAIL__'] = $obj->email; $substitutionarray['__LASTNAME__'] = $obj->lastname; $substitutionarray['__FIRSTNAME__'] = $obj->firstname; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index c4723eacc57..5947ad8d810 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1502,6 +1502,8 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; + $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; + $tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 3788acb53c4..9adfc684b8d 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -116,6 +116,8 @@ ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les liste NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés IdRecord=ID enregistrement +CustomerCode = Code client +CustomerCodeWithoutPrefix = Code client sans préfix DeliveryReceipt=Accusé de réception YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation virgule pour spécifier plusieurs destinataires. TagCheckMail=Suivre l'ouverture de l'email From 4ce81ee53591f9b98088c2bada735c1c1c113204 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Tue, 11 May 2021 20:30:57 +0200 Subject: [PATCH 005/797] set new outside the loop, add fetch result check --- htdocs/comm/mailing/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 4bf304bc519..2aae9ef1d73 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -171,6 +171,7 @@ if (empty($reshook)) dol_print_error($db); } + $thirdpartystatic = new Societe($db); // Loop on each email and send it $i = 0; @@ -202,11 +203,12 @@ if (empty($reshook)) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $substitutionarray['__ID__'] = $obj->source_id; if ($obj->source_type == "thirdparty") { - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($obj->source_id); + $result = $thirdpartystatic->fetch($obj->source_id); - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + if ($result > 0) { + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; + $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); + } } $substitutionarray['__EMAIL__'] = $obj->email; $substitutionarray['__LASTNAME__'] = $obj->lastname; From 09a694628106d1be9caae44a3f270571b0ed0588 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:34:58 +0200 Subject: [PATCH 006/797] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 5947ad8d810..a784521fcf9 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1503,7 +1503,7 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; - $tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; + //$tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; // Not yet working $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; From 40106ff7670afb1de4d887ee2f8cea08433278bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:35:29 +0200 Subject: [PATCH 007/797] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a784521fcf9..99b25d27fc4 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1503,7 +1503,6 @@ class FormMail extends Form // For mass emailing, we have different keys $tmparray['__ID__'] = 'IdRecord'; $tmparray['__THIRDPARTY_CUSTOMER_CODE__'] = 'CustomerCode'; - //$tmparray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = 'CustomerCodeWithoutPrefix'; // Not yet working $tmparray['__EMAIL__'] = 'EMailRecipient'; $tmparray['__LASTNAME__'] = 'Lastname'; $tmparray['__FIRSTNAME__'] = 'Firstname'; From a4f4cca895b7fcb3a4f1fd6c56f3f355d676fd45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:36:49 +0200 Subject: [PATCH 008/797] Prefix length may have different length and be at a different place so i remove this tag. Must be replaced by a generic method to substring a substitution variable. --- htdocs/comm/mailing/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2aae9ef1d73..f2b93ddbb80 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -207,7 +207,6 @@ if (empty($reshook)) if ($result > 0) { $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client; - $substitutionarray['__THIRDPARTY_CUSTOMER_CODE_WITHOUT_PREFIX__'] = substr($thirdpartystatic->code_client, 1); } } $substitutionarray['__EMAIL__'] = $obj->email; From aa9642b86fd58299131565fe58a276f9280e0146 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:38:38 +0200 Subject: [PATCH 009/797] Update mails.lang --- htdocs/langs/fr_FR/mails.lang | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index 9adfc684b8d..3788acb53c4 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -116,8 +116,6 @@ ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les liste NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés IdRecord=ID enregistrement -CustomerCode = Code client -CustomerCodeWithoutPrefix = Code client sans préfix DeliveryReceipt=Accusé de réception YouCanUseCommaSeparatorForSeveralRecipients=Vous pouvez utiliser le caractère de séparation virgule pour spécifier plusieurs destinataires. TagCheckMail=Suivre l'ouverture de l'email From 30e04714513f99c9f31a23078fa2f11558794d30 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 10 Jun 2021 23:04:56 +0200 Subject: [PATCH 010/797] NEW: leave requests: add field into type dictionary to block request if balance is negative --- htdocs/admin/dict.php | 20 +++++++++++++++---- htdocs/holiday/class/holiday.class.php | 11 ++++++++++ .../install/mysql/migration/13.0.0-14.0.0.sql | 2 +- .../mysql/tables/llx_c_holiday_types.sql | 1 + htdocs/langs/en_US/holiday.lang | 2 ++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index b8bf1a5998a..2d4c651255f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -223,7 +223,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI $tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")"; //$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm"; -$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; +$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; //$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; @@ -315,7 +315,7 @@ $tabfield[24] = "code,label"; $tabfield[25] = "code,label"; //$tabfield[26]= "code,label,short_label"; $tabfield[27] = "code,libelle,picto"; -$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country"; +$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative"; $tabfield[29] = "code,label,percent,position"; $tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfield[31]= "pcg_version,label"; @@ -361,7 +361,7 @@ $tabfieldvalue[24] = "code,label"; $tabfieldvalue[25] = "code,label"; //$tabfieldvalue[26]= "code,label,short_label"; $tabfieldvalue[27] = "code,libelle,picto"; -$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country"; +$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative"; $tabfieldvalue[29] = "code,label,percent,position"; $tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfieldvalue[31]= "pcg_version,label"; @@ -407,7 +407,7 @@ $tabfieldinsert[24] = "code,label"; $tabfieldinsert[25] = "code,label"; //$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27] = "code,libelle,picto"; -$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country"; +$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative"; $tabfieldinsert[29] = "code,label,percent,position"; $tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; //$tabfieldinsert[31]= "pcg_version,label"; @@ -1413,6 +1413,9 @@ if ($id) { if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') { $valuetoshow = $langs->trans('TicketGroupIsPublic'); $class = 'center'; } + if ($value == 'block_if_negative') { + $valuetoshow = $langs->trans('BlockHolidayIfNegative'); + } if ($id == 2) { // Special case for state page if ($value == 'region_id') { @@ -1758,6 +1761,9 @@ if ($id) { if ($value == 'public' && $tablib[$id] == 'TicketDictCategory') { $valuetoshow = $langs->trans('TicketGroupIsPublic'); $cssprefix = 'center '; } + if ($value == 'block_if_negative') { + $valuetoshow = $langs->trans('BlockHolidayIfNegative'); + } if ($value == 'region_id' || $value == 'country_id') { $showfield = 0; @@ -1984,6 +1990,8 @@ if ($id) { } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_productbatch_qcstatus') { $langs->load("productbatch"); $valuetoshow = $langs->trans($obj->{$value}); + } elseif ($value == 'block_if_negative') { + $valuetoshow = yn($obj->{$value}); } $class .= ($class ? ' ' : '').'tddict'; if ($value == 'note' && $id == 10) { @@ -2366,6 +2374,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; print $form->selectExpenseRanges($obj->fk_range); print ''; + } elseif ($value == 'block_if_negative') { + print ''; + print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1); + print ''; } else { $fieldValue = isset($obj->{$value}) ? $obj->{$value}:''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 7e3585bd5bc..dc992e53285 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -259,6 +259,17 @@ class Holiday extends CommonObject $this->error = "ErrorBadParameterFkType"; return -1; } + $checkBalance = getDictvalue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); + + if ($checkBalance > 0) { + $balance = $this->getCPforUser($this->fk_user, $this->fk_type); + + if ($balance < 0) { + $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; + return -1; + } + } + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday("; $sql .= "ref,"; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 741d92a88a1..6cc9bbeafd6 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -543,4 +543,4 @@ create table llx_c_partnership_type active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; - +ALTER TABLE llx_c_holiday_types ADD COLUMN block_if_negative integer NOT NULL DEFAULT 0 AFTER fk_country; diff --git a/htdocs/install/mysql/tables/llx_c_holiday_types.sql b/htdocs/install/mysql/tables/llx_c_holiday_types.sql index 9c09d486bec..612df739d04 100644 --- a/htdocs/install/mysql/tables/llx_c_holiday_types.sql +++ b/htdocs/install/mysql/tables/llx_c_holiday_types.sql @@ -24,5 +24,6 @@ CREATE TABLE llx_c_holiday_types ( delay integer NOT NULL, -- Minimum delay to be allowed to make request newByMonth double(8,5) DEFAULT 0 NOT NULL, -- Amount of new days for each user each month fk_country integer DEFAULT NULL, -- This type is dedicated to a country + block_if_negative integer NOT NULL DEFAULT 0, active integer DEFAULT 1 ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 2393a02ee50..95e77130564 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -132,3 +132,5 @@ FreeLegalTextOnHolidays=Free text on PDF WatermarkOnDraftHolidayCards=Watermarks on draft leave requests HolidaysToApprove=Holidays to approve NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays +BlockHolidayIfNegative=Block if balance negative +LeaveRequestCreationBlockedBecauseBalanceIsNegative=The creation of this leave request is blocked because your balance is negative From 084abe45474def01903f404227d2bbc71bfc4120 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 22 Jun 2021 16:27:43 +0200 Subject: [PATCH 011/797] FIX: holiday: also block if balance is negative at request update, validation and approval --- htdocs/holiday/class/holiday.class.php | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index dc992e53285..2db0f36115f 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -703,6 +703,17 @@ class Holiday extends CommonObject global $conf, $langs; $error = 0; + $checkBalance = getDictvalue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); + + if ($checkBalance > 0) { + $balance = $this->getCPforUser($this->fk_user, $this->fk_type); + + if ($balance < 0) { + $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; + return -1; + } + } + // Define new ref if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref) || $this->ref == $this->id)) { $num = $this->getNextNumRef(null); @@ -767,6 +778,17 @@ class Holiday extends CommonObject global $conf, $langs; $error = 0; + $checkBalance = getDictvalue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); + + if ($checkBalance > 0) { + $balance = $this->getCPforUser($this->fk_user, $this->fk_type); + + if ($balance < 0) { + $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; + return -1; + } + } + // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; @@ -876,6 +898,17 @@ class Holiday extends CommonObject global $conf, $langs; $error = 0; + $checkBalance = getDictvalue(MAIN_DB_PREFIX.'c_holiday_types', 'block_if_negative', $this->fk_type); + + if ($checkBalance > 0) { + $balance = $this->getCPforUser($this->fk_user, $this->fk_type); + + if ($balance < 0) { + $this->error = 'LeaveRequestCreationBlockedBecauseBalanceIsNegative'; + return -1; + } + } + // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; From db0b00f93abcf4b804f5a9eaa25b76ada2902f0b Mon Sep 17 00:00:00 2001 From: Laurent Magnin Date: Fri, 2 Jul 2021 12:30:07 +0200 Subject: [PATCH 012/797] Standard ticket substitutions --- htdocs/core/lib/functions.lib.php | 26 +++++++++++++------------- htdocs/ticket/card.php | 25 ------------------------- 2 files changed, 13 insertions(+), 38 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f25e13ee88c..149cbd8530a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6848,7 +6848,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, /*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__'; $substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/ } -// add variables subtitutions ticket + // add variables subtitutions ticket if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) { $substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__'; $substitutionarray['__TICKET_REF__'] = '__TICKET_REF__'; @@ -6861,14 +6861,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__TICKET_PROGRESSION__'] = '__TICKET_PROGRESSION__'; $substitutionarray['__TICKET_USER_ASSIGN__'] = '__TICKET_USER_ASSIGN__'; $substitutionarray['__TICKET_USER_CREATE__'] = '__TICKET_USER_CREATE__'; - - -} - - - - - + } if (!empty($conf->recruitment->enabled) && (!is_object($object) || $object->element == 'candidature')) { $substitutionarray['__CANDIDATE_FULLNAME__'] = '__CANDIDATE_FULLNAME__'; @@ -7058,7 +7051,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc'); $substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard'); } -// add substition variable for ticket + // add substition variable for ticket if (is_object($object) && $object->element == 'ticket') { $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; $substitutionarray['__TICKET_REF__'] = $object->ref; @@ -7069,10 +7062,17 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code; $substitutionarray['__TICKET_MESSAGE__'] = $object->message; $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress; - $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($user->firstname, $user->lastname); - $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($user->firstname, $user->lastname); - } + $userstat = new User($db); + if ($object->fk_user_assign > 0) { + $userstat->fetch($object->fk_user_assign); + $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } + if ($object->fk_user_create > 0) { + $userstat->fetch($object->fk_user_create); + $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } + } // Create dynamic tags for __EXTRAFIELD_FIELD__ if ($object->table_element && $object->id > 0) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 5faa7b201b7..7de6ea2d966 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1347,31 +1347,6 @@ if ($action == 'create' || $action == 'presend') { $morehtmlright = ''; $help = ""; $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); - if ($object->fk_soc > 0) { - $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name; - } - $substitutionarray['__USER_SIGNATURE__'] = $user->signature; - $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; - $substitutionarray['__TICKET_REF__'] = $object->ref; - $substitutionarray['__TICKET_SUBJECT__'] = $object->subject; - $substitutionarray['__TICKET_TYPE__'] = $object->type_code; - $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code; - $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility - $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code; - $substitutionarray['__TICKET_MESSAGE__'] = $object->message; - $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress; - if ($object->fk_user_assign > 0) { - $userstat->fetch($object->fk_user_assign); - $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } - - if ($object->fk_user_create > 0) { - $userstat->fetch($object->fk_user_create); - $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } - foreach ($substitutionarray as $key => $val) { - $help .= $key.' -> '.$langs->trans($val).'
'; - } $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
'; From 68130ec274c6c3bc3690d8f696e0ab2ea0183a5d Mon Sep 17 00:00:00 2001 From: atm-florian Date: Fri, 16 Jul 2021 19:24:34 +0200 Subject: [PATCH 013/797] FIX: line extrafields are inoperative in dispatch cards even when they exist --- htdocs/reception/card.php | 68 ++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 8a4d5edc611..70dfd7f28b0 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -876,7 +876,14 @@ if ($action == 'create') // Reception lines $numAsked = 0; + + /** + * @var array $suffix2numAsked map HTTP query parameter suffixes (like '1_0') to line indices so that + * extrafields from HTTP query can be assigned to the correct dispatch line + */ + $suffix2numAsked = array(); $dispatchLines = array(); + foreach ($_POST as $key => $value) { // If create form is coming from the button "Create Reception" of previous page @@ -884,14 +891,16 @@ if ($action == 'create') $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1] . '_' . $reg[2]; + $suffix2numAsked[$paramSuffix] = $numAsked; // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = "product_".$reg[1].'_'.$reg[2]; - $qty = "qty_".$reg[1].'_'.$reg[2]; - $ent = "entrepot_".$reg[1].'_'.$reg[2]; - $pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount - $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; + $prod = "product_" . $paramSuffix; + $qty = "qty_" . $paramSuffix; + $ent = "entrepot_" . $paramSuffix; + $pu = "pu_" . $paramSuffix; // This is unit price including discount + $fk_commandefourndet = "fk_commandefourndet_" . $paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int')); } @@ -899,41 +908,51 @@ if ($action == 'create') if (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1] . '_' . $reg[2]; + $suffix2numAsked[$paramSuffix] = $numAsked; // eat-by date dispatch // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = 'product_batch_'.$reg[1].'_'.$reg[2]; - $qty = 'qty_'.$reg[1].'_'.$reg[2]; - $ent = 'entrepot_'.$reg[1].'_'.$reg[2]; - $pu = 'pu_'.$reg[1].'_'.$reg[2]; - $lot = 'lot_number_'.$reg[1].'_'.$reg[2]; - $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$reg[1].'_'.$reg[2].'month'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'day'], $_POST['dluo_'.$reg[1].'_'.$reg[2].'year']); - $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$reg[1].'_'.$reg[2].'month'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'day'], $_POST['dlc_'.$reg[1].'_'.$reg[2].'year']); - $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; + $prod = 'product_batch_' . $paramSuffix; + $qty = 'qty_' . $paramSuffix; + $ent = 'entrepot_' . $paramSuffix; + $pu = 'pu_' . $paramSuffix; + $lot = 'lot_number_' . $paramSuffix; + $dDLUO = dol_mktime(12, 0, 0, $_POST['dluo_'.$paramSuffix.'month'], $_POST['dluo_'.$paramSuffix.'day'], $_POST['dluo_'.$paramSuffix.'year']); + $dDLC = dol_mktime(12, 0, 0, $_POST['dlc_'.$paramSuffix.'month'], $_POST['dlc_'.$paramSuffix.'day'], $_POST['dlc_'.$paramSuffix.'year']); + $fk_commandefourndet = 'fk_commandefourndet_'.$paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } // If create form is coming from same page post was sent but an error occured if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { $numAsked++; + $paramSuffix = $reg[1]; + $suffix2numAsked[$paramSuffix] = $numAsked; // eat-by date dispatch // $numline=$reg[2] + 1; // line of product $numline = $numAsked; - $prod = 'productid'.$reg[1]; - $comment = 'comment'.$reg[1]; - $qty = 'qtyl'.$reg[1]; - $ent = 'entl'.$reg[1]; - $pu = 'pul'.$reg[1]; - $lot = 'batch'.$reg[1]; - $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); - $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); - $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; + $prod = 'productid'.$paramSuffix; + $comment = 'comment'.$paramSuffix; + $qty = 'qtyl'.$paramSuffix; + $ent = 'entl'.$paramSuffix; + $pu = 'pul'.$paramSuffix; + $lot = 'batch'.$paramSuffix; + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$paramSuffix.'month', 'int'), GETPOST('dluo'.$paramSuffix.'day', 'int'), GETPOST('dluo'.$paramSuffix.'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$paramSuffix.'month', 'int'), GETPOST('dlc'.$paramSuffix.'day', 'int'), GETPOST('dlc'.$paramSuffix.'year', 'int')); + $fk_commandefourndet = 'fk_commandefournisseurdet'.$paramSuffix; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } } + // If extrafield values are passed in the HTTP query, assign them to the correct dispatch line + // Note that if an extrafield with the same name exists in the origin supplier order line, the value + // from the HTTP query will be ignored + foreach ($suffix2numAsked as $suffix => $n) { + $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('commande_fournisseur_dispatch', '_' . $suffix, ''); + } print ' '; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index f175cb083ff..015a33b202f 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -259,11 +259,13 @@ ShowAllBatchByDefault=By default, show batch details on product "stock" tab CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration ErrorWrongBarcodemode=Unknown Barcode mode ProductDoesNotExist=Product does not exist -ErrorSameBatchNumber=Same batch number found in inventory list +ErrorSameBatchNumber=Several record for the batch number were found in the inventory sheet. No way to know which one to increase. ProductBatchDoesNotExist=Product with batch/serial does not exist ProductBarcodeDoesNotExist=Product with barcode does not exist WarehouseId=Warehouse ID WarehouseRef=Warehouse Ref SaveQtyFirst=Save the real inventoried quantities first, before asking creation of the stock movement. InventoryStartedShort=Started -ErrorOnElementsInventory=Scan was aborted due to following barcode or batch number on error \ No newline at end of file +ErrorOnElementsInventory=Operation canceled for the following reason: +ErrorCantFindCodeInInventory=Can't find the following code in inventory +QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. \ No newline at end of file diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index c467b4367df..658a521fcc1 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -343,10 +343,15 @@ if (empty($reshook)) { $result = $tmp->create($user); if ($result < 0) { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->trans("DuplicateRecord"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } else { dol_print_error($db, $tmp->error, $tmp->errors); } + } else { + // Clear var + $_POST['batch'] = ''; + $_POST['qtytoadd'] = ''; } } } @@ -606,18 +611,28 @@ if ($object->id > 0) { print ''; + // Link to autofill + print ''.img_picto('', 'autofill', 'class="paddingrightonly"').$langs->trans('AutofillWithExpected').''; + print ''; + + // Link to reset qty + print ''.img_picto('', 'eraser', 'class="paddingrightonly"').$langs->trans("ClearQtys").''; + } else { + print ''.$langs->trans("Save").''."\n"; + } } print '
'; print '
'; @@ -623,7 +621,7 @@ if ($object->id > 0) { var barcodemode = $("input[name=barcodemode]:checked").val(); var barcodeproductqty = $("input[name=barcodeproductqty]").val(); var textarea = $("textarea[name=barcodelist]").val(); - var textarray = textarea.split(/[\s,]+/); + var textarray = textarea.split(/[\s,;]+/); var tabproduct = []; errortab1 = []; errortab2 = []; @@ -813,7 +811,12 @@ if ($object->id > 0) { //Call method to undo changes in real qty print ''."\n"; + } + } if (!empty($head)) { print $head."\n"; From a2cb020394be4a2d2d955359f07ac8170cfd88ff Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Dec 2021 12:45:26 +0000 Subject: [PATCH 193/797] Fixing style errors. --- .../emailcollector/class/emailcollector.class.php | 13 ++++++------- htdocs/main.inc.php | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 7e97cf9b110..243b93a55c3 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2068,7 +2068,7 @@ class EmailCollector extends CommonObject $this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error); $this->errors = $tickettocreate->errors; } else { - if($attachments) { + if ($attachments) { $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref; if (!dol_is_dir($destdir)) { dol_mkdir($destdir); @@ -2298,7 +2298,7 @@ class EmailCollector extends CommonObject * @param string $mid prefix * @return array Array with number and object */ - private function getmsg($mbox, $mid, $destdir='') + private function getmsg($mbox, $mid, $destdir = '') { // input $mbox = IMAP stream, $mid = message id // output all the following: @@ -2348,7 +2348,7 @@ class EmailCollector extends CommonObject * @param string $partno Partno * @return void */ - private function getpart($mbox, $mid, $p, $partno, $destdir='') + private function getpart($mbox, $mid, $p, $partno, $destdir = '') { // $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple global $htmlmsg, $plainmsg, $charset, $attachments; @@ -2386,11 +2386,11 @@ class EmailCollector extends CommonObject $filename = ($params['filename']) ? $params['filename'] : $params['name']; // filename may be encoded, so see imap_mime_header_decode() $attachments[$filename] = $data; // this is a problem if two files have same name - + // Get file name (with extension) $file_name_complete = $params['filename']; - + $destination = $destdir.'/'.$file_name_complete; // Extract file extension @@ -2407,7 +2407,7 @@ class EmailCollector extends CommonObject /** * Check if the same file name already exists in the upload folder, - * append increment number to the original filename + * append increment number to the original filename */ while (file_exists($destdir."/" . $file_name . "." . $extension)) { $file_name = (string) $file_name_original . ' (' . $num . ')'; @@ -2418,7 +2418,6 @@ class EmailCollector extends CommonObject file_put_contents($destination, $data); - } // TEXT diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index be964015f75..345ef7b496e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1744,9 +1744,9 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } } } - + //If you want to load custom javascript file from your selected theme directory - if (!empty($conf->global->ALLOW_THEME_JS)) { + if (!empty($conf->global->ALLOW_THEME_JS)) { $theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0); if (file_exists($theme_js)) { print ''."\n"; From 4eb9a7625a2628c8062bacbe0aca7d42d608003a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Dec 2021 15:12:35 +0100 Subject: [PATCH 194/797] Fix notification setup page. --- htdocs/admin/notification.php | 133 +++++++++++++++-------------- htdocs/core/class/notify.class.php | 10 +++ htdocs/langs/en_US/admin.lang | 6 +- 3 files changed, 85 insertions(+), 64 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 1b06e9dd25e..db79a1503c9 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -204,6 +204,18 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa print ''; print ''; +print ''; +print $langs->trans("NotificationDisableConfirmMessageContact").''; +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT); +} +print ''; +print ''; + print ''; print $langs->trans("NotificationDisableConfirmMessageUser").''; print ''; @@ -215,6 +227,7 @@ if ($conf->use_javascript_ajax) { } print ''; print ''; + print ''; print $langs->trans("NotificationDisableConfirmMessageFix").''; print ''; @@ -241,79 +254,68 @@ print ''; print ''; // Notification per contacts -$title = $langs->trans("ListOfNotificationsPerUser"); -if (!empty($conf->societe->enabled)) { - $title = $langs->trans("ListOfNotificationsPerUserOrContact"); -} -print load_fiche_titre($title, '', ''); +$title = $langs->trans("TemplatesForNotifications"); + +print load_fiche_titre($title, '', 'email'); // Load array of available notifications $notificationtrigger = new InterfaceNotification($db); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); +// Editing global variables not related to a specific theme +$constantes = array(); +foreach ($listofnotifiedevents as $notifiedevent) { + $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - // Editing global variables not related to a specific theme - $constantes = array(); - foreach ($listofnotifiedevents as $notifiedevent) { - $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; - $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); - - if ($notifiedevent['elementtype'] == 'order_supplier') { - $elementLabel = $langs->trans('SupplierOrder'); - } elseif ($notifiedevent['elementtype'] == 'propal') { - $elementLabel = $langs->trans('Proposal'); - } elseif ($notifiedevent['elementtype'] == 'facture') { - $elementLabel = $langs->trans('Bill'); - } elseif ($notifiedevent['elementtype'] == 'commande') { - $elementLabel = $langs->trans('Order'); - } elseif ($notifiedevent['elementtype'] == 'ficheinter') { - $elementLabel = $langs->trans('Intervention'); - } elseif ($notifiedevent['elementtype'] == 'shipping') { - $elementLabel = $langs->trans('Shipping'); - } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') { - $elementLabel = $langs->trans('ExpenseReport'); - } - - if ($notifiedevent['elementtype'] == 'propal') { - $model = 'propal_send'; - } elseif ($notifiedevent['elementtype'] == 'commande') { - $model = 'order_send'; - } elseif ($notifiedevent['elementtype'] == 'facture') { - $model = 'facture_send'; - } elseif ($notifiedevent['elementtype'] == 'shipping') { - $model = 'shipping_send'; - } elseif ($notifiedevent['elementtype'] == 'ficheinter') { - $model = 'fichinter_send'; - } elseif ($notifiedevent['elementtype'] == 'expensereport') { - $model = 'expensereport_send'; - } elseif ($notifiedevent['elementtype'] == 'order_supplier') { - $model = 'order_supplier_send'; - // } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send'; - } elseif ($notifiedevent['elementtype'] == 'member') { - $model = 'member'; - } - - $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); + if ($notifiedevent['elementtype'] == 'order_supplier') { + $elementLabel = $langs->trans('SupplierOrder'); + } elseif ($notifiedevent['elementtype'] == 'propal') { + $elementLabel = $langs->trans('Proposal'); + } elseif ($notifiedevent['elementtype'] == 'facture') { + $elementLabel = $langs->trans('Bill'); + } elseif ($notifiedevent['elementtype'] == 'commande') { + $elementLabel = $langs->trans('Order'); + } elseif ($notifiedevent['elementtype'] == 'ficheinter') { + $elementLabel = $langs->trans('Intervention'); + } elseif ($notifiedevent['elementtype'] == 'shipping') { + $elementLabel = $langs->trans('Shipping'); + } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') { + $elementLabel = $langs->trans('ExpenseReport'); } - $helptext = ''; - form_constantes($constantes, 3, $helptext, 'EmailTemplate'); - - print '
'; - print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; - if (!empty($conf->societe->enabled)) { - print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + if ($notifiedevent['elementtype'] == 'propal') { + $model = 'propal_send'; + } elseif ($notifiedevent['elementtype'] == 'commande') { + $model = 'order_send'; + } elseif ($notifiedevent['elementtype'] == 'facture') { + $model = 'facture_send'; + } elseif ($notifiedevent['elementtype'] == 'shipping') { + $model = 'shipping_send'; + } elseif ($notifiedevent['elementtype'] == 'ficheinter') { + $model = 'fichinter_send'; + } elseif ($notifiedevent['elementtype'] == 'expensereport') { + $model = 'expensereport_send'; + } elseif ($notifiedevent['elementtype'] == 'order_supplier') { + $model = 'order_supplier_send'; + // } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send'; + } elseif ($notifiedevent['elementtype'] == 'member') { + $model = 'member'; } - print '
'; - print $form->buttonsSaveCancel("Save", ''); + $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); +} + +$helptext = ''; +form_constantes($constantes, 3, $helptext, 'EmailTemplate'); + +print $form->buttonsSaveCancel("Save", ''); + +/* } else { print ''; print ''; print ''; - /*print ''; - print '';*/ //print ''; print "\n"; @@ -359,6 +361,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { } print ''; } +*/ print ''; @@ -371,7 +374,15 @@ print ''; print ''; print ''; -print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', ''); +print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', 'email'); + +print '
'; +print $langs->trans("Note").':
'; +print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; +if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; +} +print '
'; print '
'.$langs->trans("Label").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("NbOfTargetedContacts").'
'; print ''; @@ -488,8 +499,6 @@ foreach ($listofnotifiedevents as $notifiedevent) { } print '
'; -print '
'; - print $form->buttonsSaveCancel("Save", ''); print ''; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index a741af3d867..85b622f62ad 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -108,7 +108,9 @@ class Notify global $conf, $langs; $langs->load("mails"); + // Get full list of all notifications subscribed for $action, $socid and $object $listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0); + if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) { foreach ($listofnotiftodo as $val) { if ($val['type'] == 'touser') { @@ -117,6 +119,14 @@ class Notify } } } + if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT)) { + foreach ($listofnotiftodo as $val) { + if ($val['type'] == 'tocontact') { + unset($listofnotiftodo[$val['email']]); + //$listofnotiftodo = array_merge($listofnotiftodo); + } + } + } if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) { foreach ($listofnotiftodo as $val) { if ($val['type'] == 'tofixedemail') { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b4ce76ad884..23cb14faae1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1712,8 +1712,9 @@ MailingDelay=Seconds to wait after sending next message NotificationSetup=Email Notification module setup NotificationEMailFrom=Sender email (From) for emails sent by the Notifications module FixedEmailTarget=Recipient -NotificationDisableConfirmMessageFix=Disable the information about targets into the confirmation message before sending the notifications to the global emails -NotificationDisableConfirmMessageUser=Disable the information about targets into the confirmation message before sending the notifications to the user emails +NotificationDisableConfirmMessageContact=Hide the list of recipients (subscribed as contact) of notifications into the confirmation message +NotificationDisableConfirmMessageUser=Hide the list of recipients (subscribed as user) of notifications into the confirmation message +NotificationDisableConfirmMessageFix=Hide the list of recipients (subscribed as global email) of notifications into the confirmation message ##### Sendings ##### SendingsSetup=Shipping module setup SendingsReceiptModel=Sending receipt model @@ -1905,6 +1906,7 @@ ExpenseReportsRulesSetup=Setup of module Expense Reports - Rules ExpenseReportNumberingModules=Expense reports numbering module NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only. YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for email notifications by enabling and configuring the module "Notification". +TemplatesForNotifications=Templates for notifications ListOfNotificationsPerUser=List of automatic notifications per user* ListOfNotificationsPerUserOrContact=List of possible automatic notifications (on business event) available per user* or per contact** ListOfFixedNotifications=List of automatic fixed notifications From 67910db532a657fc98686574ac5d64387da5bca4 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 23 Dec 2021 19:00:39 +0100 Subject: [PATCH 195/797] FIX: discounts are applied both when fetching the best supplier price and when displaying it cf. PR #18873 commit 2be2423dee0136679c95641f2db4a0fa9805dbaf --- htdocs/fourn/class/fournisseur.product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 230c794b038..fe59b1d915d 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -846,7 +846,7 @@ class ProductFournisseur extends Product $this->fourn_qty = $record["quantity"]; $this->fourn_remise_percent = $record["remise_percent"]; $this->fourn_remise = $record["remise"]; - $this->fourn_unitprice = $fourn_unitprice; + $this->fourn_unitprice = !empty($conf->dynamicprices->enabled) ? $fourn_unitprice : $record["unitprice"]; $this->fourn_charges = $record["charges"]; // deprecated $this->fourn_tva_tx = $record["tva_tx"]; $this->fourn_id = $record["fourn_id"]; From 369d125002f5f01b1d71d8fdc9a338d82514c8b3 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Thu, 23 Dec 2021 22:47:30 +0100 Subject: [PATCH 196/797] Update card.php Fix bug when you create a supplier order from a project to keep the project when you select the supplier (Option RELOAD_PAGE_ON_SUPPLIER_CHANGE) --- htdocs/fourn/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0ee5a80ce58..510ed4f699a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1649,8 +1649,9 @@ if ($action == 'create') { $(document).ready(function() { $("#socid").change(function() { var socid = $(this).val(); + var prjid = $("#projectid").val(); // reload page - window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid; + window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&projectid="+prjid }); }); '; From d82c1f34e0a5d935761f335372158a75b5da1a47 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 25 Dec 2021 11:33:26 +0100 Subject: [PATCH 197/797] Fix modulebuilder params for updatemask action --- htdocs/modulebuilder/template/admin/setup.php | 6 +++--- .../core/modules/mymodule/mod_myobject_advanced.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index d66ede05696..1d00f81fffa 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -75,10 +75,10 @@ if ((float) DOL_VERSION >= 6) if ($action == 'updateMask') { - $maskconstorder = GETPOST('maskconstorder', 'alpha'); - $maskorder = GETPOST('maskorder', 'alpha'); + $maskconst = GETPOST('maskconst', 'alpha'); + $maskvalue = GETPOST('maskvalue', 'alpha'); - if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity); + if ($maskconstorder) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity); if (!$res > 0) $error++; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index ae5f5d1e876..d18001ba3fe 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -68,7 +68,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject $texte .= '
'; $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject")); @@ -79,7 +79,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; From 3fc0205d0bf6421b68f9561c4e94d5c360fca96c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Dec 2021 12:44:46 +0100 Subject: [PATCH 198/797] Fix responsive --- htdocs/adherents/type.php | 18 +++++------------- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 6 +++--- htdocs/public/payment/newpayment.php | 3 ++- htdocs/theme/eldy/global.inc.php | 10 +++++++++- htdocs/theme/md/style.css.php | 10 +++++++++- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 628313d5fe9..1d788457abe 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -292,7 +292,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { $membertype->amount = $objp->amount; print ''; - print ''; @@ -340,12 +340,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } } - -/* ************************************************************************** */ -/* */ -/* Creation mode */ -/* */ -/* ************************************************************************** */ +// Creation if ($action == 'create') { $object = new AdherentType($db); @@ -416,11 +411,7 @@ if ($action == 'create') { print "\n"; } -/* ************************************************************************** */ -/* */ -/* View mode */ -/* */ -/* ************************************************************************** */ +// View if ($rowid > 0) { if ($action != 'edit') { $object = new AdherentType($db); @@ -455,8 +446,9 @@ if ($rowid > 0) { print yn($object->subscription); print ''; + // Amount print ''; print ''; $stringtoprint .= ''; - $stringtoprint .= ''; + $stringtoprint .= ''; $stringtoprint .= "\n"; } } @@ -277,7 +277,7 @@ class box_funnel_of_prospection extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'tr' => 'class="oddeven"', - 'td' => 'class="right "', + 'td' => 'class="nowraponall right amount"', 'maxlength' => 500, 'text' => price($totalamount, 0, '', 1, -1, -1, $conf->currency) ); @@ -290,7 +290,7 @@ class box_funnel_of_prospection extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right "', + 'td' => 'class="nowraponall right amount"', 'maxlength' => 500, 'text' => price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency) ); diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 949edd567f3..930b4d3a874 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -152,8 +152,8 @@ class box_members_last_subscriptions extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right" width="18"', - 'text' => ''.price($obj->subscription).'', + 'td' => 'class="nowraponall right amount" width="18"', + 'text' => price($obj->subscription), ); $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 73c71521603..e7bf916d236 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -179,12 +179,12 @@ class box_members_subscriptions_by_year extends ModeleBoxes 'text' => $Number[$key], ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'text' => ''.price($value).'', + 'td' => 'class="nowraponall right amount"', + 'text' => price($value), ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'text' => ''.price(price2num($value / $Number[$key], 'MT')).'', + 'td' => 'class="nowraponall right amount"', + 'text' => price(price2num($value / $Number[$key], 'MT')), ); $line++; } @@ -204,12 +204,12 @@ class box_members_subscriptions_by_year extends ModeleBoxes 'text' => $numb, ); $this->info_box_contents[$line][] = array( - 'td' => 'class="liste_total right"', - 'text' => ''.price($tot).'', + 'td' => 'class="liste_total nowraponall right amount"', + 'text' => price($tot), ); $this->info_box_contents[$line][] = array( - 'td' => 'class="liste_total right"', - 'text' => ''.price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')).'', + 'td' => 'class="liste_total nowraponall right amount"', + 'text' => price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')), ); } } else { diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index d039881445e..9a0c76503d0 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -180,7 +180,7 @@ class box_produits extends ModeleBoxes } } $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="nowraponall right amount"', 'text' => $price, ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5e7ec72d0e1..edef4b3a38c 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -187,7 +187,7 @@ class box_produits_alerte_stock extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', + 'td' => 'class="nowraponall right amount"', 'text' => $price, ); diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 51d313b7254..f3f9496325f 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -160,7 +160,7 @@ class box_propales extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 2cc34a9255b..89fd7850c5c 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -147,7 +147,7 @@ class box_supplier_orders extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index f9d2de4b7fc..9a40c3f9aec 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -151,7 +151,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); From 873adb3cb14bb2d9aab7e04c6b885ded9531bafa Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 29 Dec 2021 13:57:22 +0100 Subject: [PATCH 229/797] Fix : add missing resource stats on stat box --- .../core/boxes/box_dolibarr_state_board.php | 14 +++++--- htdocs/resource/class/dolresource.class.php | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 21bf58b859f..0381b493448 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -105,7 +105,8 @@ class box_dolibarr_state_board extends ModeleBoxes 'supplier_invoices', 'contracts', 'interventions', - 'ticket' + 'ticket', + 'dolresource' ); $conditions = array( 'users' => $user->rights->user->user->lire, @@ -132,7 +133,8 @@ class box_dolibarr_state_board extends ModeleBoxes 'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire, 'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, 'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read, - 'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read + 'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read, + 'dolresource' => !empty($conf->resource->enabled) && $user->rights->resource->read ); $classes = array( 'users' => 'User', @@ -156,6 +158,7 @@ class box_dolibarr_state_board extends ModeleBoxes 'expensereports' => 'ExpenseReport', 'holidays' => 'Holiday', 'ticket' => 'Ticket', + 'dolresource' => 'Dolresource' ); $includes = array( 'users' => DOL_DOCUMENT_ROOT . "/user/class/user.class.php", @@ -178,7 +181,8 @@ class box_dolibarr_state_board extends ModeleBoxes 'projects' => DOL_DOCUMENT_ROOT . "/projet/class/project.class.php", 'expensereports' => DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php", 'holidays' => DOL_DOCUMENT_ROOT . "/holiday/class/holiday.class.php", - 'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php" + 'ticket' => DOL_DOCUMENT_ROOT . "/ticket/class/ticket.class.php", + 'dolresource' => DOL_DOCUMENT_ROOT . "/resource/class/dolresource.class.php" ); $links = array( 'users' => DOL_URL_ROOT . '/user/list.php', @@ -201,7 +205,8 @@ class box_dolibarr_state_board extends ModeleBoxes 'projects' => DOL_URL_ROOT . '/projet/list.php?mainmenu=project', 'expensereports' => DOL_URL_ROOT . '/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', 'holidays' => DOL_URL_ROOT . '/holiday/list.php?mainmenu=hrm&leftmenu=holiday', - 'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket' + 'ticket' => DOL_URL_ROOT . '/ticket/list.php?leftmenu=ticket', + 'dolresource' => DOL_URL_ROOT . '/resource/list.php?mainmenu=tools', ); $titres = array( 'users' => "Users", @@ -225,6 +230,7 @@ class box_dolibarr_state_board extends ModeleBoxes 'expensereports' => "ExpenseReports", 'holidays' => "Holidays", 'ticket' => "Ticket", + 'dolresource' => "Resources", ); $langfile = array( 'customers' => "companies", diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index a0f80d7b27c..1922d746c03 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -1016,4 +1016,36 @@ class Dolresource extends CommonObject return ''; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Charge indicateurs this->nb de tableau de bord + * + * @return int <0 if KO, >0 if OK + */ + public function load_state_board() + { + // phpcs:enable + global $conf; + + $this->nb = array(); + + $sql = "SELECT count(r.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."resource as r"; + $sql .= " WHERE r.entity IN (".getEntity('resource').")"; + + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $this->nb["dolresource"] = $obj->nb; + } + $this->db->free($resql); + return 1; + } else { + dol_print_error($this->db); + $this->error = $this->db->error(); + return -1; + } + } + } From 38aee545298e27e505a585b8281a2e52b6736b90 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 29 Dec 2021 12:58:36 +0000 Subject: [PATCH 230/797] Fixing style errors. --- htdocs/resource/class/dolresource.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 1922d746c03..2307f2039d1 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -1047,5 +1047,4 @@ class Dolresource extends CommonObject return -1; } } - } From e07905f9503b5cfeaeb798b55712d6056055c7b3 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 29 Dec 2021 20:34:08 +0100 Subject: [PATCH 231/797] var --- htdocs/theme/eldy/btn.inc.php | 6 ++++-- htdocs/theme/md/btn.inc.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index cf2f1ead60e..1b92ef80f04 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -5,11 +5,12 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { /*
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'; + print ''; print $membertype->getNomUrl(1); //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' print '
'.$langs->trans("Amount").''; - print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); + print ((is_null($object->amount) || $object->amount === '') ? '' : ''.price($object->amount).''); print '
'.$langs->trans("VoteAllowed").''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f9e28f5b4a..3539348e35a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -761,7 +761,7 @@ class FormFile $arraykeys = array_keys($modellist); $modelselected = $arraykeys[0]; } - $morecss = 'maxwidth200'; + $morecss = 'minwidth75 maxwidth200'; if ($conf->browser->layout == 'phone') { $morecss = 'maxwidth100'; } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 14a08c675ce..b6638daba51 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -195,7 +195,7 @@ print ''; print "\n"; print ''."\n"; -print ''."\n"; +print '
'."\n"; // Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo) // Define logo and logosmall @@ -358,7 +358,7 @@ if ($action == "dosign" && empty($cancel)) { print ' + + + + + + From 27134a1f914c013dd43dd75984ec71e7bd5adc24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Dec 2021 15:44:04 +0100 Subject: [PATCH 201/797] Fix position of menu --- htdocs/core/menus/init_menu_auguria.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index b032ba5beb4..3b173cecb26 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -283,6 +283,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__); +-- Export accounting documents +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Journals --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); @@ -295,8 +297,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); -- Journals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); --- Export accounting documents -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Closure insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2437__+MAX_llx_menu__, 'accountancy', 'accountancy_closure', 2400__+MAX_llx_menu__, '/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure', 'MenuAccountancyClosure', 1, 'accountancy', '$user->rights->accounting->fiscalyear->write', '', 0, 17, __ENTITY__); -- Reports From f8884d2c86bd532b8c937aeaafc4ad7fc956b88e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 27 Dec 2021 15:00:05 +0100 Subject: [PATCH 202/797] fix : units were not displayed --- .../core/modules/product/doc/pdf_standard.modules.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 37aca08d146..940aa1d4279 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -293,18 +293,21 @@ class pdf_standard extends ModelePDFProduct $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1); $nexY = $pdf->GetY(); } - if ($object->weight) { - $texttoshow = $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.($object->length != '' ? $object->length : '?').' x '.($object->width != '' ? $object->width : '?').' x '.($object->height != '' ? $object->height : '?'); + if ($object->length) { + $texttoshow = $langs->trans("Length") . ' x ' . $langs->trans("Width") . ' x ' . $langs->trans("Height") . ': ' . ($object->length != '' ? $object->length : '?') . ' x ' . ($object->width != '' ? $object->width : '?') . ' x ' . ($object->height != '' ? $object->height : '?'); + $texttoshow .= ' ' . measuringUnitString(0, "size", $object->length_units); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1); $nexY = $pdf->GetY(); } if ($object->surface) { - $texttoshow = $langs->trans("Area").': '.dol_htmlentitiesbr($object->surface); + $texttoshow = $langs->trans("Surface") . ': ' . dol_htmlentitiesbr($object->surface); + $texttoshow .= ' ' . measuringUnitString(0, "surface", $object->surface_units); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1); $nexY = $pdf->GetY(); } if ($object->volume) { - $texttoshow = $langs->trans("Volume").': '.dol_htmlentitiesbr($object->volume); + $texttoshow = $langs->trans("Volume") . ': ' . dol_htmlentitiesbr($object->volume); + $texttoshow .= ' ' . measuringUnitString(0, "volume", $object->volume_units); $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $texttoshow, 0, 1); $nexY = $pdf->GetY(); } From 559b0b4bfad72947813612d7f6f4d4457c546c31 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 28 Dec 2021 17:12:12 +0800 Subject: [PATCH 203/797] Fix - Currency of Account Statement --- htdocs/compta/bank/releve.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ae676209571..269282f6eb7 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -347,7 +347,7 @@ if (empty($numref)) { $balancestart[$objp->numr] = $obj->amount; $db->free($resql); } - print ''; + print ''; // Calculate end amount $sql = "SELECT sum(b.amount) as amount"; @@ -360,7 +360,7 @@ if (empty($numref)) { $content[$objp->numr] = $obj->amount; $db->free($resql); } - print ''; + print ''; print ''; - print ''; - print ''; - print ''; -} - - -/** - * Print a form part - * - * @param string $confkey the conf key - * @param bool $title Title of conf - * @param string $desc Description of - * @param array $metas html meta - * @param string $type type of input textarea or input - * @param bool $help help description - * - * @return void - */ -function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false) -{ - global $langs, $conf, $db, $inputCount; - - $inputCount = empty($inputCount) ? 1 : ($inputCount + 1); - $form = new Form($db); - - $defaultMetas = array( - 'name' => 'value'.$inputCount - ); - - if ($type != 'textarea') { - $defaultMetas['type'] = 'text'; - $defaultMetas['value'] = $conf->global->{$confkey}; - } - - - $metas = array_merge($defaultMetas, $metas); - $metascompil = ''; - foreach ($metas as $key => $values) { - $metascompil .= ' '.$key.'="'.$values.'" '; - } - - print ''; - print ''; - print ''; - print ''; -} diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0525ad6f3c8..693cf235cf3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3893,7 +3893,7 @@ class Form // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Return list of payment modes. + * print list of payment modes. * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. * See instead to force the default value by the caller. * @@ -3908,8 +3908,28 @@ class Form public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '') { // phpcs:enable - global $langs, $user, $conf; + print $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, $noinfoadmin, $morecss); + } + + /** + * Return list of payment modes. + * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. + * See instead to force the default value by the caller. + * + * @param int $selected Id of payment term to preselect by default + * @param string $htmlname Nom de la zone select + * @param int $filtertype Not used + * @param int $addempty Add an empty entry + * @param int $noinfoadmin 0=Add admin info, 1=Disable admin info + * @param string $morecss Add more CSS on select tag + * @return void + */ + public function getSelectConditionsPaiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '') + { + + global $langs, $user, $conf; + $out = ''; dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); $this->load_cache_conditions_paiements(); @@ -3919,24 +3939,25 @@ class Form $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID; } - print ''; if ($addempty) { - print ''; + $out.= ''; } foreach ($this->cache_conditions_paiements as $id => $arrayconditions) { if ($selected == $id) { - print ''; + $out.= $arrayconditions['label']; + $out.= ''; } - print ''; + $out.= ''; if ($user->admin && empty($noinfoadmin)) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - print ajax_combobox($htmlname); + $out.= ajax_combobox($htmlname); + return $out; } diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 25ab99bfe01..722d7a8f247 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -215,7 +215,7 @@ class FormSetup $out = '
'.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, $conf->currency).''.price($balancestart[$objp->numr], '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).''.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, $conf->currency).''.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).''; if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { From 3ada0a8741386289184f32ccea1d842bc889f146 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 10:40:44 +0100 Subject: [PATCH 204/797] Fix #19672 : email unicity was checked when email was null --- htdocs/recruitment/recruitmentcandidature_card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index a1e98ded601..18ecc57512b 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -260,6 +260,8 @@ if (empty($reshook)) { $nuser->employee = 1; $nuser->firstname = $object->firstname; $nuser->lastname = $object->lastname; + $nuser->email = ''; + $nuser->personal_email = $object->email; $nuser->personal_mobile = $object->phone; $nuser->birth = $object->date_birth; $nuser->salary = $object->remuneration_proposed; From 1bb07dbc6b4738b7e24d902eccc79f192cae4666 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 11:02:45 +0100 Subject: [PATCH 205/797] Fix #19404 : only validated invoice must be considered in unpaid indicator --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 077f306aa3f..66c441841d1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2418,7 +2418,7 @@ class FactureFournisseur extends CommonInvoice $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ' WHERE ff.paye=0'; - $sql .= ' AND ff.fk_statut > 0'; + $sql .= ' AND ff.fk_statut = '.self::STATUS_VALIDATED; $sql .= " AND ff.entity = ".$conf->entity; if ($user->socid) { $sql .= ' AND ff.fk_soc = '.$user->socid; From 81bee064afba78ba9c53d7b6260d9a04799efbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina?= Date: Tue, 28 Dec 2021 11:28:58 +0100 Subject: [PATCH 206/797] add getDolGlobalInt --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 61f955636f5..5e41a3538e3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -680,7 +680,7 @@ if ($action == "updateprice") { } else { if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code == "4")) { dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); - } elseif ($conf->global->TAKEPOS_CHANGE_PRICE_HT == 1) { + } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } else { $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); From 0e9b707801430f22b6d4d77375c6f1ce1b5b00d2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 11:57:26 +0100 Subject: [PATCH 207/797] Fix #19249 : wrong payment cond and mode on mass order billing --- htdocs/core/actions_massactions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index cadb7a1768a..64578ad68bb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -657,8 +657,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. // If we want one invoice per order or if there is no first invoice yet for this thirdparty. $objecttmp->socid = $cmd->socid; $objecttmp->type = $objecttmp::TYPE_STANDARD; - $objecttmp->cond_reglement_id = ($cmd->cond_reglement_id || $cmd->thirdparty->cond_reglement_id); - $objecttmp->mode_reglement_id = ($cmd->mode_reglement_id || $cmd->thirdparty->mode_reglement_id); + $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id; + $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id; $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; From b54e7bd86170ad5790c73e740c44a2cc77a3e19f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 12:22:23 +0100 Subject: [PATCH 208/797] Fix #19691 : wrong table name in sql file --- .../mysql/tables/llx_categorie_knowledgemanagement.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql index 47769643bd5..93222a62257 100644 --- a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql +++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql @@ -18,4 +18,4 @@ ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgem ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement_knowledgerecord (rowid); From 817a9594ae96ae0abaf04e1f80eae492193887d6 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 14:32:57 +0100 Subject: [PATCH 209/797] Convert setup of situation invoice to new setup system + fix size --- htdocs/admin/facture_situation.php | 204 ++------------------- htdocs/core/class/html.form.class.php | 43 +++-- htdocs/core/class/html.formsetup.class.php | 28 ++- 3 files changed, 68 insertions(+), 207 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 5aba9e62074..636c5781b69 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -94,47 +94,22 @@ $formSetup->newItem('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION') ->nameText = $langs->trans('RetainedwarrantyOnlyForSituationFinal'); -// TODO : TODO : TODO -$item = $formSetup->newItem('INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION'); - -$metas = array( +$item = $formSetup->newItem('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT'); +$item->nameText = $langs->trans('RetainedwarrantyDefaultPercent'); +$item->fieldAttr = array( 'type' => 'number', 'step' => '0.01', 'min' => 0, 'max' => 100 ); -_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); -/* -// Hôte -$item = $formSetup->newItem('NO_PARAM_JUST_TEXT'); -$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST']; -$item->cssClass = 'minwidth500'; - -// Setup conf MYMODULE_MYPARAM1 as a simple string input -$item = $formSetup->newItem('MYMODULE_MYPARAM1'); - -// Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title -$item = $formSetup->newItem('MYMODULE_MYPARAM2'); -$item->nameText = $item->getNameText().' more html text '; - -// Setup conf MYMODULE_MYPARAM3 -$item = $formSetup->newItem('MYMODULE_MYPARAM3'); -$item->setAsThirdpartyType(); - -// Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style -$formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo(); - -// Setup conf MYMODULE_MYPARAM5 -$formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty'); - -// Setup conf MYMODULE_MYPARAM6 -$formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled - -// Setup conf MYMODULE_MYPARAM7 -$formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct(); -*/ +// Conditions paiements +$item = $formSetup->newItem('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID'); +$item->nameText = $langs->trans('PaymentConditionsShortRetainedWarranty'); +$form->load_cache_conditions_paiements(); +$item->fieldOutputOverride = $form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label']; +$item->fieldInputOverride = $form->getSelectConditionsPaiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID', -1, 1); /* @@ -180,169 +155,18 @@ if ($action == 'edit') { } if (count($formSetup->items) > 0) { - print '
'; - print ''.$langs->trans("Modify").''; - print '
'; + if ($action != 'edit') { + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; + } } else { print '
'.$langs->trans("NothingToSetup"); } -print '
'; - - - -print '
'; -print ''; - - -print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table -print ''; - -print ''; -print ''; -print ''; -print ''; -print "\n"; - - - - - -$metas = array( - 'type' => 'number', - 'step' => '0.01', - 'min' => 0, - 'max' => 100 -); -_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); - -// Conditions paiements -$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); -print ''; -print ''; -print ''; -print ''; - - -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'.$langs->trans('PaymentConditionsShortRetainedWarranty').' '; -print ''; -$form->select_conditions_paiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'value'.$inputCount, -1, 1); -print '
'; -print '
'; - -print '
'; - -_updateBtn(); - -print '
'; - print dol_get_fiche_end(); // End of page llxFooter(); $db->close(); - -/** - * Print an update button - * - * @return void - */ -function _updateBtn() -{ - global $langs; - print '
'; - print ''; - print '
'; -} - -/** - * Print a On/Off button - * - * @param string $confkey the conf key - * @param bool $title Title of conf - * @param string $desc Description - * - * @return void - */ -function _printOnOff($confkey, $title = false, $desc = '') -{ - global $langs; - - print '
'.($title ? $title : $langs->trans($confkey)); - if (!empty($desc)) { - print '
'.$langs->trans($desc).''; - } - print '
 '; - print ajax_constantonoff($confkey); - print '
'; - - if (!empty($help)) { - print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); - } else { - print $title ? $title : $langs->trans($confkey); - } - - if (!empty($desc)) { - print '
'.$langs->trans($desc).''; - } - - print '
 '; - print ''; - - print ''; - if ($type == 'textarea') { - print ''; - } elseif ($type == 'input') { - print ''; - } else { - // custom - print $type; - } - print '
'; $out .= ''; $out .= ''; - $out .= ' '; + $out .= ' '; $out .= ' '; $out .= ''; $out .= ''; @@ -560,13 +560,16 @@ class FormSetupItem /** @var string $helpText */ public $helpText = ''; - /** @var string $value */ + /** @var string $fieldValue */ public $fieldValue; + /** @var array $fieldAttr fields attribute only for compatible fields like input text */ + public $fieldAttr; + /** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */ public $fieldOverride = false; - /** @var bool|string set this var to override field output */ + /** @var bool|string set this var to override field input */ public $fieldInputOverride = false; /** @var bool|string set this var to override field output */ @@ -583,6 +586,7 @@ class FormSetupItem /** * TODO each type must have setAs{type} method to help configuration * And set var as protected when its done configuration must be done by method + * this is important for retrocompatibility of futures versions * @var string $type 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type' */ protected $type = 'string'; @@ -598,9 +602,15 @@ class FormSetupItem */ public function __construct($confKey) { - global $langs, $db, $conf; + global $langs, $db, $conf, $form; $this->db = $db; - $this->form = new Form($this->db); + + if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // form class have cache inside so I use it for optimise + $this->form = $form; + } else { + $this->form = new Form($this->db); + } + $this->langs = $langs; $this->entity = $conf->entity; @@ -700,6 +710,10 @@ class FormSetupItem return $this->fieldInputOverride; } + $this->fieldAttr['name'] = $this->confKey; + $this->fieldAttr['id'] = 'setup-'.$this->confKey; + $this->fieldAttr['value'] = $this->fieldValue; + $out = ''; if ($this->type == 'title') { @@ -726,7 +740,9 @@ class FormSetupItem $out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1); } } else { - $out.= ''; + if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); } + + $out.= 'fieldAttr).' />'; } return $out; From e9e100410a814d917e452227091ab741a2618545 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 14:51:19 +0100 Subject: [PATCH 210/797] Fix empty value --- htdocs/admin/facture_situation.php | 4 +++- htdocs/core/class/html.formsetup.class.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 636c5781b69..789faacacad 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -108,7 +108,9 @@ $item->fieldAttr = array( $item = $formSetup->newItem('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID'); $item->nameText = $langs->trans('PaymentConditionsShortRetainedWarranty'); $form->load_cache_conditions_paiements(); -$item->fieldOutputOverride = $form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label']; +if (!empty($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID) && isset($form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label'])) { + $item->fieldOutputOverride = $form->cache_conditions_paiements[$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID]['label']; +} $item->fieldInputOverride = $form->getSelectConditionsPaiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID', -1, 1); diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 722d7a8f247..8cfab129444 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -605,7 +605,7 @@ class FormSetupItem global $langs, $db, $conf, $form; $this->db = $db; - if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // form class have cache inside so I use it for optimise + if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // the form class has a cache inside so I am using it to optimize $this->form = $form; } else { $this->form = new Form($this->db); From 1d20694f33de4b6196278b9fd7bde2dbdbfe7a41 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 15:47:46 +0100 Subject: [PATCH 211/797] Fix #19667 : bankentries wrong SQL parenthesis + missing filter --- htdocs/compta/bank/bankentries_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 84938f24dbc..b68d769da2b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -613,14 +613,14 @@ if ($search_thirdparty_user) { $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; $sql.= " JOIN ".MAIN_DB_PREFIX."user AS subUser ON (bu.type = 'user' AND bu.url_id = subUser.rowid)"; - $sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1)."))"; + $sql.= " WHERE ". natural_search(array("subUser.firstname", "subUser.lastname"), $search_thirdparty_user, '', 1).")"; $sql.= " OR b.rowid IN "; $sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu"; $sql.= " JOIN ".MAIN_DB_PREFIX."bank AS b2 ON b2.rowid = bu.fk_bank"; $sql.= " JOIN ".MAIN_DB_PREFIX."societe AS subSoc ON (bu.type = 'company' AND bu.url_id = subSoc.rowid)"; $sql.= " WHERE ". natural_search(array("subSoc.nom"), $search_thirdparty_user, '', 1); - $sql.= ")"; + $sql.= "))"; } if ($search_description) { $search_description_to_use = $search_description; @@ -1050,7 +1050,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['ba.ref']['checked'])) { print ''; print '
' . $this->langs->trans("Parameter") . '' . $this->langs->trans("Parameter") . '' . $this->langs->trans("Value") . '
'; From 12880f1716ec58cb8d388110c7da75c694193124 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 16:02:51 +0100 Subject: [PATCH 212/797] Fix : replace old filters by new ones --- htdocs/compta/bank/bankentries_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index b68d769da2b..d3ef0fc3077 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -283,17 +283,17 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' if ($search_description) { $param .= '&search_description='.urlencode($search_description); } - if ($search_start_dt) { - $param .= '&search_start_dt='.urlencode($search_start_dt); + if (dol_strlen($search_dt_start) > 0) { + $param .= '&search_start_dtmonth='.GETPOST('search_start_dtmonth', 'int').'&search_start_dtday='.GETPOST('search_start_dtday', 'int').'&search_start_dtyear='.GETPOST('search_start_dtyear', 'int'); } - if ($search_end_dt) { - $param .= '&search_end_dt='.urlencode($search_end_dt); + if (dol_strlen($search_dt_end) > 0) { + $param .= '&search_end_dtmonth='.GETPOST('search_end_dtmonth', 'int').'&search_end_dtday='.GETPOST('search_end_dtday', 'int').'&search_end_dtyear='.GETPOST('search_end_dtyear', 'int'); } - if ($search_start_dv) { - $param .= '&search_start_dv='.urlencode($search_start_dv); + if (dol_strlen($search_dv_start) > 0) { + $param .= '&search_start_dvmonth='.GETPOST('search_start_dvmonth', 'int').'&search_start_dvday='.GETPOST('search_start_dvday', 'int').'&search_start_dvyear='.GETPOST('search_start_dvyear', 'int'); } - if ($search_end_dv) { - $param .= '&search_end_dv='.urlencode($search_end_dv); + if (dol_strlen($search_dv_end) > 0) { + $param .= '&search_end_dvmonth='.GETPOST('search_end_dvmonth', 'int').'&search_end_dvday='.GETPOST('search_end_dvday', 'int').'&search_end_dvyear='.GETPOST('search_end_dvyear', 'int'); } if ($search_type) { $param .= '&search_type='.urlencode($search_type); From 4b3289ed842fc7bed20b03d25830545cbe75ed50 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 16:20:01 +0100 Subject: [PATCH 213/797] Fix #19666 : missing quotes in SQL statement --- .../mysql/data/llx_accounting_account_de.sql | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_de.sql b/htdocs/install/mysql/data/llx_accounting_account_de.sql index d1b6b00f800..0165c3ec06e 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_de.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_de.sql @@ -2739,21 +2739,21 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3866, 'SKR04', 'Anlagevermögen', 280, 3854, 'Außenanlagen für Geschäfts-, Fabrik- und andere Bauten'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3867, 'SKR04', 'Anlagevermögen', 285, 3854, 'Hof- und Wegbefestigungen'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3868, 'SKR04', 'Anlagevermögen', 290, 3854, 'Einrichtungen für Geschäfts-. Fabrik- und andere Bauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3869, 'SKR04', 'Anlagevermögen', 300, 3854, Wohnbauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3870, 'SKR04', 'Anlagevermögen', 305, 3854, Garagen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3871, 'SKR04', 'Anlagevermögen', 310, 3854, Außenanlagen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3872, 'SKR04', 'Anlagevermögen', 315, 3854, Hof- und Wegbefestigungen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3873, 'SKR04', 'Anlagevermögen', 320, 3854, Einrichtungen für Wohnbauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3874, 'SKR04', 'Anlagevermögen', 329, 3854, Gebäudeteil des häuslichen Arbeitszimmers'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3875, 'SKR04', 'Anlagevermögen', 330, 3854, Bauten auf fremden Grundstücken'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3876, 'SKR04', 'Anlagevermögen', 340, 3854, Geschäftsbauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3877, 'SKR04', 'Anlagevermögen', 350, 3854, Fabrikbauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3878, 'SKR04', 'Anlagevermögen', 360, 3854, Wohnbauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3879, 'SKR04', 'Anlagevermögen', 370, 3854, Andere Bauten'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3880, 'SKR04', 'Anlagevermögen', 380, 3854, Garagen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3881, 'SKR04', 'Anlagevermögen', 390, 3854, Außenanlagen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3882, 'SKR04', 'Anlagevermögen', 395, 3854, Hof- und Wegbefestigungen'); ---INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3883, 'SKR04', 'Anlagevermögen', 398, 3854, Einrichtungen für Geschäfts-. Fabrik-, Wohn- und andere Bauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3869, 'SKR04', 'Anlagevermögen', 300, 3854, 'Wohnbauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3870, 'SKR04', 'Anlagevermögen', 305, 3854, 'Garagen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3871, 'SKR04', 'Anlagevermögen', 310, 3854, 'Außenanlagen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3872, 'SKR04', 'Anlagevermögen', 315, 3854, 'Hof- und Wegbefestigungen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3873, 'SKR04', 'Anlagevermögen', 320, 3854, 'Einrichtungen für Wohnbauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3874, 'SKR04', 'Anlagevermögen', 329, 3854, 'Gebäudeteil des häuslichen Arbeitszimmers'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3875, 'SKR04', 'Anlagevermögen', 330, 3854, 'Bauten auf fremden Grundstücken'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3876, 'SKR04', 'Anlagevermögen', 340, 3854, 'Geschäftsbauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3877, 'SKR04', 'Anlagevermögen', 350, 3854, 'Fabrikbauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3878, 'SKR04', 'Anlagevermögen', 360, 3854, 'Wohnbauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3879, 'SKR04', 'Anlagevermögen', 370, 3854, 'Andere Bauten'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3880, 'SKR04', 'Anlagevermögen', 380, 3854, 'Garagen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3881, 'SKR04', 'Anlagevermögen', 390, 3854, 'Außenanlagen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3882, 'SKR04', 'Anlagevermögen', 395, 3854, 'Hof- und Wegbefestigungen'); +--INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3883, 'SKR04', 'Anlagevermögen', 398, 3854, 'Einrichtungen für Geschäfts-. Fabrik-, Wohn- und andere Bauten'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3884, 'SKR04', 'Anlagevermögen', 400, 0, 'Technische Anlagen und Maschinen'); --INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3885, 'SKR04', 'Anlagevermögen', 420, 3884, 'Technische Anlagen'); --INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3886, 'SKR04', 'Anlagevermögen', 440, 3884, 'Maschinen'); From 93393b82a3b99f28db78e838538d8fcc373345a2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 17:40:25 +0100 Subject: [PATCH 214/797] Fix nav + translations on supplier invoice credit transfer --- htdocs/compta/facture/prelevement.php | 5 +++-- htdocs/langs/en_US/withdrawals.lang | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 6fdc74a7539..6b9a28f8203 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -54,6 +54,7 @@ if ($user->socid) { if ($type == 'bank-transfer') { $object = new FactureFournisseur($db); + $moreparam = '&type='.$type; } else { $object = new Facture($db); } @@ -138,7 +139,7 @@ $form = new Form($db); $now = dol_now(); if ($type == 'bank-transfer') { - $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer'); + $title = $langs->trans('SupplierInvoice')." - ".$langs->trans('CreditTransfer'); $helpurl = ""; } else { $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('StandingOrders'); @@ -272,7 +273,7 @@ if ($object->id > 0) { $object->totalpaye = $totalpaye; // 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, '', ''); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', ''); print '
'; print '
'; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index a3773a427a1..aca238fcece 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -15,6 +15,7 @@ BankTransferReceipt=Credit transfer order LatestBankTransferReceipts=Latest %s credit transfer orders LastWithdrawalReceipts=Latest %s direct debit files WithdrawalsLine=Direct debit order line +CreditTransfer=Credit transfer CreditTransferLine=Credit transfer line WithdrawalsLines=Direct debit order lines CreditTransferLines=Credit transfer lines From 2237c09d64b68218bd089016ee2eb6a81469b0ff Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 17:59:41 +0100 Subject: [PATCH 215/797] Remove unused set_credit function --- htdocs/compta/prelevement/card.php | 21 ------ .../class/bonprelevement.class.php | 68 ------------------- 2 files changed, 89 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 8a232377ab7..6de7d5f1c39 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -102,21 +102,6 @@ if (empty($reshook)) { } } - // Seems to no be used and replaced with $action == 'infocredit' - if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') { - if ($object->statut == 2) { - $res = -1; - setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); - } else { - $res = $object->set_credite(); - } - - if ($res >= 0) { - header("Location: card.php?id=".$id); - exit; - } - } - if ($action == 'infotrans' && $user->rights->prelevement->bons->send) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -184,12 +169,6 @@ if ($id > 0 || $ref) { print '
'.$object->getErrorString(GETPOST('error', 'alpha')).'
'; } - /*if ($action == 'credite') - { - print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); - - }*/ - $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 25751a50df0..18216c1cda6 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -332,74 +332,6 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set credite and set status of linked invoices. Still used ?? - * - * @return int <0 if KO, >=0 if OK - */ - public function set_credite() - { - // phpcs:enable - global $user, $conf; - - $error = 0; - - if ($this->db->begin()) { - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; - $sql .= " SET statut = ".self::STATUS_TRANSFERED; - $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".((int) $conf->entity); - - $result = $this->db->query($sql); - if (!$result) { - dol_syslog(get_class($this)."::set_credite Erreur 1"); - $error++; - } - - if (!$error) { - $facs = array(); - $facs = $this->getListInvoices(); - - $num = count($facs); - for ($i = 0; $i < $num; $i++) { - /* Tag invoice as paid */ - dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]); - $fac = new Facture($this->db); - $fac->fetch($facs[$i]); - $result = $fac->setPaid($user); - } - } - - if (!$error) { - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes"; - $sql .= " SET statut = 2"; - $sql .= " WHERE fk_prelevement_bons = ".((int) $this->id); - - if (!$this->db->query($sql)) { - dol_syslog(get_class($this)."::set_credite Erreur 1"); - $error++; - } - } - - /* - * End of procedure - */ - if (!$error) { - $this->db->commit(); - return 0; - } else { - $this->db->rollback(); - dol_syslog(get_class($this)."::set_credite ROLLBACK "); - - return -1; - } - } else { - dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible "); - return -2; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set direct debit or credit transfer order to "paid" status. From 1e848f0ebbe95efcf0cfca67b4146d5023abfc84 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 18:17:57 +0100 Subject: [PATCH 216/797] Fix prelevement right management and action buttons --- htdocs/compta/prelevement/card.php | 12 +++++++----- htdocs/langs/en_US/withdrawals.lang | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 6de7d5f1c39..ab7b56c1bd4 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -302,20 +302,22 @@ if ($id > 0 || $ref) { print '
'; } - // Actions if ($action != 'settransmitted' && $action != 'setcredited') { print "\n".'
'."\n"; - if (empty($object->date_trans) && $user->rights->prelevement->bons->send) { - print ''.$langs->trans("SetToStatusSent").''; + if (empty($object->date_trans)) { + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); + else print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); } if (!empty($object->date_trans) && $object->date_credit == 0) { - print ''.$langs->trans("ClassCredited").''; + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); + else print dolGetButtonAction($langs->trans("ClassCredited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); } - print ''.$langs->trans("Delete").''; + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); + else print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); print '
'; } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index aca238fcece..5efc4bf8e35 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -48,6 +48,7 @@ ThirdPartyBankCode=Third-party bank code NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries. ClassCredited=Classify credited +ClassDebited=Classify debited ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account? TransData=Transmission date TransMetod=Transmission method From f27fda33e8446ffb78c87fc8e8879d538317b517 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 18:25:15 +0100 Subject: [PATCH 217/797] Fix prelevement action right management --- htdocs/compta/prelevement/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index ab7b56c1bd4..48f1e359b30 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -102,7 +102,7 @@ if (empty($reshook)) { } } - if ($action == 'infotrans' && $user->rights->prelevement->bons->send) { + if ($action == 'infotrans' && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer'))) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); @@ -135,10 +135,10 @@ if (empty($reshook)) { } // Set direct debit order to credited, create payment and close invoices - if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) { + if ($action == 'infocredit' && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer'))) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - if ($object->statut == 2) { + if ($object->statut == BonPrelevement::STATUS_CREDITED) { $error = 1; setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); } else { From 019b10c9eb6e0ffe760b371012b96054672ca473 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 18:27:29 +0100 Subject: [PATCH 218/797] Fix wrong method call --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 38449d1fba1..860e1b2ac24 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7615,7 +7615,7 @@ abstract class CommonObject $selectkey = $InfoFieldList[2]; } - if (!isInDb($value_arr, $InfoFieldList[0], $selectkey)) { + if (!$validate->isInDb($value_arr, $InfoFieldList[0], $selectkey)) { $this->setFieldError($fieldKey, $validate->error); return false; } else { return true; } From f9f1c7e3f833ed12cbb5f4007b24228587283041 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 28 Dec 2021 18:32:02 +0100 Subject: [PATCH 219/797] Fix action protection --- htdocs/compta/facture/prelevement.php | 1 + htdocs/compta/prelevement/card.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 6b9a28f8203..2fc980a122a 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -52,6 +52,7 @@ if ($user->socid) { $socid = $user->socid; } +$moreparam = ''; if ($type == 'bank-transfer') { $object = new FactureFournisseur($db); $moreparam = '&type='.$type; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 48f1e359b30..3620c5e3abc 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -138,7 +138,7 @@ if (empty($reshook)) { if ($action == 'infocredit' && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer'))) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - if ($object->statut == BonPrelevement::STATUS_CREDITED) { + if (($object->type != 'bank-transfer' && $object->statut == BonPrelevement::STATUS_CREDITED) || ($object->type == 'bank-transfer' && $object->statut == BonPrelevement::STATUS_DEBITED)) { $error = 1; setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); } else { @@ -286,6 +286,7 @@ if ($id > 0 || $ref) { } if (!empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action == 'setcredited') { + $btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited"); print '
'; print ''; print ''; @@ -297,7 +298,7 @@ if ($id > 0 || $ref) { print '
'; print '
'.$langs->trans("ThisWillAlsoAddPaymentOnInvoice").'
'; - print '
'; + print '
'; print ''; print '
'; } From 537965c7b77f081cce7671e10b575b0bb422bdf2 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 28 Dec 2021 17:34:11 +0000 Subject: [PATCH 220/797] Fixing style errors. --- htdocs/compta/prelevement/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 3620c5e3abc..fb63fa45b38 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -308,17 +308,17 @@ if ($id > 0 || $ref) { print "\n".'
'."\n"; if (empty($object->date_trans)) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); - else print dolGetButtonAction($langs->trans("SetToStatusSent"),'', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send); + else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send); } if (!empty($object->date_trans) && $object->date_credit == 0) { - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); - else print dolGetButtonAction($langs->trans("ClassCredited"),'', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit); + else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit); } - if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); - else print dolGetButtonAction($langs->trans("Delete"),'', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); + if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create); + else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer); print '
'; } From 9af621c6f882dedcaa47ec2eb6134fb0e2f7f4ee Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 18:43:04 +0100 Subject: [PATCH 221/797] Fix scrutinizerh --- htdocs/core/class/html.formsetup.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 8cfab129444..4f5557279f4 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -353,7 +353,8 @@ class FormSetup */ $item = new FormSetupItem($confKey); - $item->setTypeFromTypeString($params['type']); + // need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developper to use object oriented usage + /** @scrutinizer ignore-deprecated */ $item->setTypeFromTypeString($params['type']); if (!empty($params['enabled'])) { $item->enabled = $params['enabled']; @@ -598,7 +599,7 @@ class FormSetupItem /** * Constructor * - * @param $confKey the conf key used in database + * @param string $confKey the conf key used in database */ public function __construct($confKey) { From e20d669e34276d30695c83454cd2ecbad3551d5c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:08:47 +0100 Subject: [PATCH 222/797] Fix : prevent fatal error --- htdocs/core/class/validate.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php index 1b2447dc23a..389bb708e82 100644 --- a/htdocs/core/class/validate.class.php +++ b/htdocs/core/class/validate.class.php @@ -61,6 +61,11 @@ class Validate $this->outputLang = $outputLang; } + if (!is_object($this->outputLang) || !method_exists($outputLang, 'load')) { + return false; + } + + /** @var Translate $outputLang */ $outputLang->load('validate'); $this->db = $db; @@ -212,7 +217,7 @@ class Validate /** * Check Duration validity * - * @param string $duration to validate + * @param mixed $duration to validate * @return boolean Validity is ok or not */ public function isDuration($duration) From 5449d57d260573638a4e0a03be0787dd8fe1953b Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:19:51 +0100 Subject: [PATCH 223/797] fix variable does not seem to be defined for all execution --- htdocs/core/lib/images.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 0ccb6a415fc..6b973d89887 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -388,7 +388,7 @@ function dolRotateImage($file_path) * Add exif orientation correction for image * * @param string $fileSource Full path to source image to rotate - * @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly + * @param string|bool $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly * @param int $quality output image quality * @return bool : true on success or false on failure or gd img if $fileDest is false. */ @@ -630,7 +630,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // replace image with good orientation - if (!empty($rotated)) { + if (!empty($rotated) && isset($trueImgWidth) && isset($trueImgHeight)) { $img = $rotated; $imgWidth = $trueImgWidth; $imgHeight = $trueImgHeight; From 0f587a37e2def320139d37031086cf6215c75b8d Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:36:44 +0100 Subject: [PATCH 224/797] fix missing var definition --- htdocs/core/modules/DolibarrModules.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b90ea227037..675b0a80ab9 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -348,8 +348,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $hidden = false; - - + /** + * @var string url to check for module update + */ + public $url_last_version; /** From 38539dace3b1b48dec97378bbdb947484c768f32 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:44:10 +0100 Subject: [PATCH 225/797] fix test --- htdocs/theme/eldy/manifest.json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index ec6472c80e6..6f3dc2e9cbc 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -101,7 +101,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) { $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); - if ($imgSize) { + if (!empty($imgSize)) { $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->sizes = $imgSize[0]."x".$imgSize[1]; From 33ea8e850b77177a84c406ad2587f2fd78e8f638 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:47:58 +0100 Subject: [PATCH 226/797] Remove not defined param --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6d8b54d1954..f531d221aff 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,7 +747,7 @@ class Project extends CommonObject 'fk_projet' => $projectkey, 'ids' => $ids, ); - $reshook = $hookmanager->executeHooks('getElementList', $parameters, $object, $action); + $reshook = $hookmanager->executeHooks('getElementList', $parameters); if ($reshook > 0) { $sql = $hookmanager->resPrint; } else { From 2676427ec425fdfa44c428ec7268d35d7cff3f8d Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Wed, 29 Dec 2021 13:24:23 +0100 Subject: [PATCH 227/797] Update functions.lib.php #19709 --- 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 bf36a72bfa2..eb583962b1f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1710,7 +1710,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab //print "x $i $active ".$links[$i][2]." z"; $out .= '
'; if (!empty($links[$i][0])) { - $out .= ''; + $out .= ''; } $out .= $links[$i][1]; if (!empty($links[$i][0])) { From ac7fb65d041e1f00da36c23813fb3a536bc6bfd4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 29 Dec 2021 13:43:18 +0100 Subject: [PATCH 228/797] Fix missing amount css class on boxes --- .../box_accountancy_last_manual_entries.php | 2 +- htdocs/core/boxes/box_activity.php | 8 ++++---- htdocs/core/boxes/box_commandes.php | 2 +- htdocs/core/boxes/box_comptes.php | 9 ++++++--- htdocs/core/boxes/box_factures_fourn.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 2 +- htdocs/core/boxes/box_funnel_of_prospection.php | 6 +++--- .../boxes/box_members_last_subscriptions.php | 4 ++-- .../boxes/box_members_subscriptions_by_year.php | 16 ++++++++-------- htdocs/core/boxes/box_produits.php | 2 +- htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/boxes/box_supplier_orders.php | 2 +- .../box_supplier_orders_awaiting_reception.php | 2 +- 14 files changed, 32 insertions(+), 29 deletions(-) diff --git a/htdocs/core/boxes/box_accountancy_last_manual_entries.php b/htdocs/core/boxes/box_accountancy_last_manual_entries.php index b1e4a637046..96abd8699f3 100644 --- a/htdocs/core/boxes/box_accountancy_last_manual_entries.php +++ b/htdocs/core/boxes/box_accountancy_last_manual_entries.php @@ -134,7 +134,7 @@ class box_accountancy_last_manual_entries extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($amount, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 487c2170a4a..371a7a0dbed 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -174,7 +174,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -262,7 +262,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -350,7 +350,7 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][3] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency) ); @@ -433,7 +433,7 @@ class box_activity extends ModeleBoxes ); $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index abf9baf06f3..ae939afe25c 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -163,7 +163,7 @@ class box_commandes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index f42b7a2ef7c..5570051a065 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -141,8 +141,11 @@ class box_comptes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', - 'text' => price($solde, 0, $langs, 1, -1, -1, $objp->currency_code) + 'td' => 'class="nowraponall right amount"', + 'text' => '' + .price($solde, 0, $langs, 1, -1, -1, $objp->currency_code) + .'', + 'asis' => 1, ); $line++; @@ -161,7 +164,7 @@ class box_comptes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="liste_total right nowraponall"', + 'td' => 'class="liste_total nowraponall right amount"', 'text' => price($solde, 0, $langs, 0, -1, -1, $key) ); $line++; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index ae905d5d468..42a945b9289 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -183,7 +183,7 @@ class box_factures_fourn extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right nowraponall"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index cfef8801414..a421706e855 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -170,7 +170,7 @@ class box_factures_fourn_imp extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowraponall right"', + 'td' => 'class="nowraponall right amount"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index 89ed2215732..cdaa9298f63 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -219,7 +219,7 @@ class box_funnel_of_prospection extends ModeleBoxes if (!$conf->use_javascript_ajax) { $stringtoprint .= '
'.$labelStatus.''.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).''.price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency).'