From 03de8707510de11d19c3844aec8890d68a7c1223 Mon Sep 17 00:00:00 2001 From: bagtaib Date: Wed, 22 Jun 2022 16:29:15 +0200 Subject: [PATCH 1/9] NEW #21204 --- htdocs/admin/workflow.php | 6 ++++++ .../interface_20_modWorkflow_WorkflowManager.class.php | 6 ++++++ htdocs/langs/en_US/workflow.lang | 1 + 3 files changed, 13 insertions(+) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 47e6e87a244..4c7339f8520 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -65,6 +65,12 @@ $workflowcodes = array( 'enabled'=>(!empty($conf->propal->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order' ), + 'WORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS'=>array( + 'family'=>'create', + 'position'=>15, + 'enabled'=>(!empty($conf->propal->enabled) && !empty($conf->commande->enabled)), + 'picto'=>'order' + ), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( 'family'=>'create', 'position'=>20, diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 8bd1e0d647d..5dc95a0679e 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -86,8 +86,14 @@ class InterfaceWorkflowManager extends DolibarrTriggers } return $ret; } + if (!empty($conf->global->WORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS)) { + $object->fetchObjectLinked(); + if (!empty($object->linkedObjectsIds['commande'])) + return $ret; + } } + // Order to invoice if ($action == 'ORDER_CLOSE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 803a31c9646..15c8b75d3ed 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -3,6 +3,7 @@ WorkflowSetup=Workflow module setup WorkflowDesc=This module provides some automatic actions. By default, the workflow is open (you can do things in the order you want) but here you can activate some automatic actions. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. # Autocreate +descWORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS=Do not Automatically create a sales order after a commercial proposal is signed if it already exists descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a sales order after a commercial proposal is signed (the new order will have same amount as the proposal) descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (the new invoice will have same amount as the proposal) descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated From cc0be635dc38a722931dde3a2f4c5757cecb06af Mon Sep 17 00:00:00 2001 From: bagtaib Date: Thu, 23 Jun 2022 15:37:37 +0200 Subject: [PATCH 2/9] removed the new option and enhanced the old one --- htdocs/admin/workflow.php | 6 --- ...e_20_modWorkflow_WorkflowManager.class.php | 39 ++++++++++--------- htdocs/langs/en_US/orders.lang | 1 + htdocs/langs/en_US/workflow.lang | 1 - 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 4c7339f8520..47e6e87a244 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -65,12 +65,6 @@ $workflowcodes = array( 'enabled'=>(!empty($conf->propal->enabled) && !empty($conf->commande->enabled)), 'picto'=>'order' ), - 'WORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS'=>array( - 'family'=>'create', - 'position'=>15, - 'enabled'=>(!empty($conf->propal->enabled) && !empty($conf->commande->enabled)), - 'picto'=>'order' - ), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( 'family'=>'create', 'position'=>20, diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 5dc95a0679e..b04be51379d 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -72,27 +72,28 @@ class InterfaceWorkflowManager extends DolibarrTriggers if ($action == 'PROPAL_CLOSE_SIGNED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $newobject = new Commande($this->db); - - $newobject->context['createfrompropal'] = 'createfrompropal'; - $newobject->context['origin'] = $object->element; - $newobject->context['origin_id'] = $object->id; - - $ret = $newobject->createFromProposal($object, $user); - if ($ret < 0) { - $this->error = $newobject->error; - $this->errors[] = $newobject->error; - } - return $ret; - } - if (!empty($conf->global->WORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS)) { $object->fetchObjectLinked(); - if (!empty($object->linkedObjectsIds['commande'])) + if (!empty($object->linkedObjectsIds['commande'])){ + setEventMessages($langs->trans("OrderExists"), null, 'warnings'); return $ret; - } - } - + } + else { + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + $newobject = new Commande($this->db); + + $newobject->context['createfrompropal'] = 'createfrompropal'; + $newobject->context['origin'] = $object->element; + $newobject->context['origin_id'] = $object->id; + + $ret = $newobject->createFromProposal($object, $user); + if ($ret < 0) { + $this->error = $newobject->error; + $this->errors[] = $newobject->error; + } + return $ret; + } + } + } // Order to invoice if ($action == 'ORDER_CLOSE') { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index a4261f8e62c..aa7dd934ede 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -1,4 +1,5 @@ # Dolibarr language file - Source file is en_US - orders +OrderExists=An order was already open linked to this proposal, so no other order was created automatically OrdersArea=Customers orders area SuppliersOrdersArea=Purchase orders area OrderCard=Order card diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 15c8b75d3ed..803a31c9646 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -3,7 +3,6 @@ WorkflowSetup=Workflow module setup WorkflowDesc=This module provides some automatic actions. By default, the workflow is open (you can do things in the order you want) but here you can activate some automatic actions. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. # Autocreate -descWORKFLOW_PROPAL_NOTCREATE_ORDER_IFEXISTS=Do not Automatically create a sales order after a commercial proposal is signed if it already exists descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a sales order after a commercial proposal is signed (the new order will have same amount as the proposal) descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed (the new invoice will have same amount as the proposal) descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated From 2f1eff28815183ddd43b535e516a5fd465a1ee2a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Jun 2022 13:42:37 +0000 Subject: [PATCH 3/9] Fixing style errors. --- ...terface_20_modWorkflow_WorkflowManager.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index b04be51379d..cc6a1168c32 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -73,18 +73,17 @@ class InterfaceWorkflowManager extends DolibarrTriggers dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { $object->fetchObjectLinked(); - if (!empty($object->linkedObjectsIds['commande'])){ + if (!empty($object->linkedObjectsIds['commande'])) { setEventMessages($langs->trans("OrderExists"), null, 'warnings'); return $ret; - } - else { + } else { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $newobject = new Commande($this->db); - + $newobject->context['createfrompropal'] = 'createfrompropal'; $newobject->context['origin'] = $object->element; $newobject->context['origin_id'] = $object->id; - + $ret = $newobject->createFromProposal($object, $user); if ($ret < 0) { $this->error = $newobject->error; @@ -92,8 +91,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers } return $ret; } - } - } + } + } // Order to invoice if ($action == 'ORDER_CLOSE') { From d3807286d4af5cc60461c4219a52e04bb0c78193 Mon Sep 17 00:00:00 2001 From: bagtaib Date: Fri, 24 Jun 2022 13:41:21 +0200 Subject: [PATCH 4/9] fix spaces --- ...terface_20_modWorkflow_WorkflowManager.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index b04be51379d..cc6a1168c32 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -73,18 +73,17 @@ class InterfaceWorkflowManager extends DolibarrTriggers dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->commande->enabled) && !empty($conf->global->WORKFLOW_PROPAL_AUTOCREATE_ORDER)) { $object->fetchObjectLinked(); - if (!empty($object->linkedObjectsIds['commande'])){ + if (!empty($object->linkedObjectsIds['commande'])) { setEventMessages($langs->trans("OrderExists"), null, 'warnings'); return $ret; - } - else { + } else { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $newobject = new Commande($this->db); - + $newobject->context['createfrompropal'] = 'createfrompropal'; $newobject->context['origin'] = $object->element; $newobject->context['origin_id'] = $object->id; - + $ret = $newobject->createFromProposal($object, $user); if ($ret < 0) { $this->error = $newobject->error; @@ -92,8 +91,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers } return $ret; } - } - } + } + } // Order to invoice if ($action == 'ORDER_CLOSE') { From 0ce3acf52fe2693681f42e081ad8b64c4322a74d Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 4 Jul 2022 10:06:10 +0200 Subject: [PATCH 5/9] FIX - php V8 html form mail --- 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 f2697bc3873..469b6dabe29 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1551,7 +1551,7 @@ class FormMail extends Form if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) { foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) { - $substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key]; + isset($product->array_options['options_'.$key]) ? $substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key] : ''; } } } From 7cd085fd0b032b2e74bb1814da5a56679fedd1e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Jul 2022 15:50:41 +0200 Subject: [PATCH 6/9] 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 469b6dabe29..df7408200a9 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1551,7 +1551,7 @@ class FormMail extends Form if (!empty($extrafields->attributes[$product->table_element]['label']) && is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) { foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) { - isset($product->array_options['options_'.$key]) ? $substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key] : ''; + $substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = isset($product->array_options['options_'.$key]) ? $product->array_options['options_'.$key] : ''; } } } From f9eee31f74c7aabf0a91cff1dac75d5b52342eb4 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 4 Jul 2022 10:01:17 +0200 Subject: [PATCH 7/9] FIX - php V8 user class --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b47781a9db4..ee6d0e7bd14 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3796,7 +3796,7 @@ class User extends CommonObject foreach ($filter as $key => $value) { if ($key == 't.rowid') { $sqlwhere[] = $key." = ".((int) $value); - } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { + } elseif (isset($this->fields[$key]['type']) && in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { $sqlwhere[] = $key." = '".$this->db->idate($value)."'"; } elseif ($key == 'customsql') { $sqlwhere[] = $value; From a91d0a525fb139df6bb8d16fadc01a6a60e13f13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2022 02:39:28 +0200 Subject: [PATCH 8/9] Debug v16 --- htdocs/core/class/html.form.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d30eb562feb..9568ec25828 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4949,7 +4949,10 @@ class Form foreach ($formquestion as $key => $input) { if (is_array($input) && !empty($input)) { if ($input['type'] == 'hidden') { - $more .= ''."\n"; + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : ''); + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : ''); + + $more .= ''."\n"; } } } From a61e5c854ce52f0196b77fdab6999b165f10347f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Jul 2022 09:41:53 +0200 Subject: [PATCH 9/9] Fix link --- htdocs/admin/ihm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 959d881041d..8d5bcfc0492 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -646,7 +646,7 @@ if ($mode == 'login') { print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') '; } if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { - print '' . img_delete($langs->trans("Delete")) . ''; + print '' . img_delete($langs->trans("Delete")) . ''; if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) { print '   '; print '';