From fea4b3e00f9a412bfa8db8255748eb2d344f1ee0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 03:03:32 +0200 Subject: [PATCH 01/35] Clean sql --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index acb3ad16abd06..a5748873d77f5 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2374,7 +2374,7 @@ public function set_remise_client($remise, $note, User $user) // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; $sql .= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; @@ -2435,7 +2435,7 @@ public function set_remise_supplier($remise, $note, User $user) // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; $sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; From 857405bea65b21dfe7330be99bf896d2aba5a5e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 03:47:30 +0200 Subject: [PATCH 02/35] Doc --- 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 b1c147c176175..f8621e2bbd2a1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12498,7 +12498,7 @@ function getFieldErrorIcon($fieldValidationErrorMsg) * @param string $url the url for link * @param string $id attribute id of button * @param int<-2,2> $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help - * @param array $params various params for future : recommended rather than adding more function arguments + * @param array $params various parameters for future : recommended rather than adding more function arguments * @return string html button */ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) From 10cc3327ab4240466711520922c2ec6ca4447672 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 14:49:28 +0200 Subject: [PATCH 03/35] Fix sql error --- htdocs/conf/conf.php.example | 1 + htdocs/install/mysql/data/llx_c_action_trigger.sql | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index dc98870682c02..c54d7284c0e7c 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -172,6 +172,7 @@ $dolibarr_main_db_character_set='utf8'; // Default value: depends on database driver // Examples: // $dolibarr_main_db_collation='utf8_unicode_ci'; +// $dolibarr_main_db_collation='utf8mb4_unicode_ci'; // $dolibarr_main_db_collation='utf8_unicode_ci'; diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index da8d3d8b492ac..a6c2b504489e5 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -108,7 +108,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modify','ficheinter',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34); @@ -142,7 +142,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652); From 62427cf8a2b103f144051cbf31d592737f080fd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 14:49:50 +0200 Subject: [PATCH 04/35] Fix sql error --- htdocs/install/mysql/data/llx_c_action_trigger.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index da8d3d8b492ac..a6c2b504489e5 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -108,7 +108,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',26); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_EXCLUDE','Member excluded','Executed when a member is excluded','member',27); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',30); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modify','Executed when a intervention is modify','ficheinter',30); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modify','ficheinter',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',32); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',33); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',34); @@ -142,7 +142,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',650); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',651); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652); From c6050e2a1e9905f2f9222d83c88c26ab357580e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 15:55:26 +0200 Subject: [PATCH 05/35] Add column to track when an event reminder was sent --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 3 +++ .../install/mysql/tables/llx_actioncomm_reminder.sql | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 0ea8ba4f4975f..88d81daffa516 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -120,6 +120,9 @@ ALTER TABLE llx_contrat ADD COLUMN denormalized_lower_planned_end_date datetime; ALTER TABLE llx_societe_perentity ADD COLUMN vat_reverse_charge tinyint DEFAULT 0; +ALTER TABLE llx_actioncomm_reminder ADD COLUMN datedone datetime NULL; + + -- Product attribut combination2val ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_combination (fk_prod_combination); ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_attr (fk_prod_attr); diff --git a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql index bc09c2e80dc9c..b1621fad65fc7 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm_reminder.sql @@ -16,13 +16,14 @@ CREATE TABLE llx_actioncomm_reminder( -- BEGIN MODULEBUILDER FIELDS - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - dateremind datetime NOT NULL, - typeremind varchar(32) NOT NULL, - fk_user integer NOT NULL, - offsetvalue integer NOT NULL, + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + dateremind datetime NOT NULL, + typeremind varchar(32) NOT NULL, + fk_user integer NOT NULL, + offsetvalue integer NOT NULL, offsetunit varchar(1) NOT NULL, status integer NOT NULL DEFAULT 0, + datedone datetime NULL, lasterror varchar(128) NULL, entity integer NOT NULL DEFAULT 1, fk_actioncomm integer NOT NULL, From da5d4f0f674dd47071de879e66ae2d9e6efaa305 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 15:58:26 +0200 Subject: [PATCH 06/35] Debug v20 --- htdocs/comm/action/card.php | 19 ++++++++++++++----- .../action/class/actioncommreminder.class.php | 3 +-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6384bb552adc7..b54e23487fc2f 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -185,10 +185,10 @@ $_SESSION['assignedtouser'] = json_encode($tmpassigneduserids); $donotclearsession = 1; - if ($action == 'add' && $usercancreate) { + if ($action == 'add') { // Test on permission not required here $action = 'create'; } - if ($action == 'update' && $usercancreate) { + if ($action == 'update') { // Test on permission not required here $action = 'edit'; } @@ -993,6 +993,13 @@ // the notification must be created for every user assigned to the event foreach ($object->userassigned as $userassigned) { $actionCommReminder->fk_user = $userassigned['id']; + + // We update the event, so we recreate the notification event. + // First we delete all reminders for the user and the type of reminding (all offset dates). + $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder"; + $sqldelete .= " WHERE fk_user = ".((int) $actionCommReminder->fk_user)." AND fk_actioncomm = ".((int) $object->id)." AND typeremind = '".$db->escape($remindertype)."'"; + $resqldelete = $db->query($sqldelete); + $res = $actionCommReminder->create($user); if ($res <= 0) { @@ -1007,13 +1014,14 @@ } } - unset($_SESSION['assignedtouser']); - unset($_SESSION['assignedtoresource']); - if (!$error) { + unset($_SESSION['assignedtouser']); + unset($_SESSION['assignedtoresource']); + $db->commit(); } else { $db->rollback(); + $action = 'edit'; } } else { setEventMessages($object->error, $object->errors, 'errors'); @@ -1968,6 +1976,7 @@ function setdatefields() $listofuserid = json_decode($_SESSION['assignedtouser'], true); } } + $listofcontactid = $object->socpeopleassigned; // Contact assigned $listofotherid = $object->otherassigned; // Other undefined email (not used yet) diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 27a063dea7b98..f430304d413b5 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -140,6 +140,7 @@ class ActionCommReminder extends CommonObject public $fk_email_template; // END MODULEBUILDER PROPERTIES + /** * Constructor * @@ -147,8 +148,6 @@ class ActionCommReminder extends CommonObject */ public function __construct(DoliDB $db) { - global $conf; - $this->db = $db; $this->ismultientitymanaged = 0; From 3ff6015b40f04f2bf681f5e0d78f5717856208d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 16:28:23 +0200 Subject: [PATCH 07/35] Comments --- htdocs/install/mysql/tables/llx_c_departements.key.sql | 4 ++-- htdocs/install/mysql/tables/llx_c_regions.key.sql | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_departements.key.sql b/htdocs/install/mysql/tables/llx_c_departements.key.sql index 19820231a6ca7..3fd7d59178a44 100644 --- a/htdocs/install/mysql/tables/llx_c_departements.key.sql +++ b/htdocs/install/mysql/tables/llx_c_departements.key.sql @@ -21,8 +21,8 @@ ALTER TABLE llx_c_departements ADD UNIQUE uk_departements (code_departement,fk_r ALTER TABLE llx_c_departements ADD INDEX idx_departements_fk_region (fk_region); --- NOTE: We duplicate creation of unique keys on llx_c_regions NOW to be able to create foreign keys. +-- NOTE: We duplicate creation of unique keys on llx_c_regions NOW to be able to create foreign keys. +-- This may generate a warning "Duplicate key name 'uk_code_region'" to ignore ALTER TABLE llx_c_regions ADD UNIQUE INDEX uk_code_region (code_region); ALTER TABLE llx_c_departements ADD CONSTRAINT fk_departements_fk_region FOREIGN KEY (fk_region) REFERENCES llx_c_regions (code_region); - diff --git a/htdocs/install/mysql/tables/llx_c_regions.key.sql b/htdocs/install/mysql/tables/llx_c_regions.key.sql index b21c0545337ec..0ce9db0bc207b 100644 --- a/htdocs/install/mysql/tables/llx_c_regions.key.sql +++ b/htdocs/install/mysql/tables/llx_c_regions.key.sql @@ -18,5 +18,9 @@ ALTER TABLE llx_c_regions ADD INDEX idx_c_regions_fk_pays (fk_pays); + +-- This unique key is also created into llx_c_departments +-- This may generate a warning "Duplicate key name 'uk_code_region'" to ignore ALTER TABLE llx_c_regions ADD UNIQUE INDEX uk_code_region (code_region); + ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid); From 3a4e2c2bcf23300f8c2bf76297da01918f8e73eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Sep 2024 16:35:20 +0200 Subject: [PATCH 08/35] Debug v20 - Fix sql --- .../mysql/tables/llx_bookcal_availabilities-bookcal.key.sql | 2 -- htdocs/install/mysql/tables/llx_don-don.key.sql | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql index 95a0ae1a4a440..79a7fe8347205 100644 --- a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql +++ b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql @@ -16,7 +16,6 @@ -- BEGIN MODULEBUILDER INDEXES ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_rowid (rowid); -ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_ref (ref); ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_status (status); ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_type (type); @@ -27,4 +26,3 @@ ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities --ALTER TABLE llx_bookcal_availabilities ADD UNIQUE INDEX uk_bookcal_availabilities_fieldxy(fieldx, fieldy); --ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bookcal_myotherobject(rowid); - diff --git a/htdocs/install/mysql/tables/llx_don-don.key.sql b/htdocs/install/mysql/tables/llx_don-don.key.sql index 2aef1dbd5be74..0f1c06133c189 100644 --- a/htdocs/install/mysql/tables/llx_don-don.key.sql +++ b/htdocs/install/mysql/tables/llx_don-don.key.sql @@ -20,7 +20,7 @@ ALTER TABLE llx_don ADD UNIQUE INDEX idx_don_uk_ref (ref, entity); ALTER TABLE llx_don ADD INDEX idx_don_fk_soc (fk_soc); -ALTER TABLE llx_don ADD INDEX idx_don_fk_project (fk_project); +ALTER TABLE llx_don ADD INDEX idx_don_fk_project (fk_projet); ALTER TABLE llx_don ADD INDEX idx_don_fk_user_author (fk_user_author); ALTER TABLE llx_don ADD INDEX idx_don_fk_user_valid (fk_user_valid); From 308178d5bc87597ccc3fb0e6c2b77418ddddefa3 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:30:41 +0200 Subject: [PATCH 09/35] QUAL : Ergo btn and fix (#30947) * Clean sql * Doc * Fix ergo feedback and accessibility button * Add hsl color var to allow css use user color with variants * Add hsl color var to allow css use user color with variants --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fourn/commande/dispatch.php | 18 ++++++-- htdocs/societe/class/societe.class.php | 4 +- htdocs/theme/eldy/btn.inc.php | 59 +++++++++++++++++++++++++- htdocs/theme/eldy/global.inc.php | 4 ++ htdocs/theme/eldy/style.css.php | 2 + htdocs/theme/md/btn.inc.php | 58 +++++++++++++++++++++++++ htdocs/theme/md/style.css.php | 6 +++ 8 files changed, 145 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a26fa443496e7..4dca2d3fd0241 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -12639,7 +12639,7 @@ function getFieldErrorIcon($fieldValidationErrorMsg) * @param string $url the url for link * @param string $id attribute id of button * @param int<-2,2> $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help - * @param array $params various params for future : recommended rather than adding more function arguments + * @param array $params various parameters for future : recommended rather than adding more function arguments * @return string html button */ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array()) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1b5edf77e7cf7..3aeac6573503a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -997,9 +997,13 @@ } // Qty to dispatch - print ''; - print ''.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').''; - print ''; + print ''; + if ($remaintodispatch>0) { + $btnLabel = $langs->trans("Fill").' : '.$remaintodispatch; + print ''; + } + print ''; + print ''; print ''; print ''; @@ -1136,6 +1140,11 @@ $("select[name^=entrepot_]").val(fk_default_warehouse).change(); }); + $(".auto-fill-qty").on("click touchstart", function(e){ + e.preventDefault(); + $("input[name="+$(this).data("rowname")+"]").val($(this).data("value")).trigger("change"); + }); + $("#autoreset").click(function() { $(".qtydispatchinput").each(function(){ id = $(this).attr("id"); @@ -1154,7 +1163,8 @@ }); }); - $(".resetline").click(function(){ + $(".resetline").click(function(e){ + e.preventDefault(); id = $(this).attr("id"); id = id.split("reset_"); console.log("Reset trigger for id = qty_"+id[1]); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7b2930044c34e..ccde48cade00a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2419,7 +2419,7 @@ public function set_remise_client($remise, $note, User $user) // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; $sql .= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; @@ -2480,7 +2480,7 @@ public function set_remise_supplier($remise, $note, User $user) // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; $sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; - $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; + $sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',"; $sql .= " '".$this->db->escape($note)."',"; $sql .= " ".((int) $user->id); $sql .= ")"; diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 7b41cfa6b2c25..95df3a93ebd8b 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -344,7 +344,7 @@ /* - * BTN LINK + * BTN LINK (used with tag in general but not with