From 4311a1ece8ae08226ae6d2bab94a3b2b0fede48f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 19 May 2019 01:58:20 +0200 Subject: [PATCH 01/46] fix: #11187 --- 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 e63cbe80fee..9caa873f170 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -537,7 +537,7 @@ class Project extends CommonObject } elseif ($type == 'project_task') { - $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt, " . MAIN_DB_PREFIX . "projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (". $ids .")"; + $sql = "SELECT DISTINCT pt.rowid FROM " . MAIN_DB_PREFIX . "projet_task as pt WHERE pt.fk_projet IN (". $ids .")"; } elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user { From e4d87ab2e7c1bdb09f9d7a302f621547ae37dd8f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Sun, 19 May 2019 02:05:13 +0200 Subject: [PATCH 02/46] fix: #11189 --- htdocs/core/class/extrafields.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f8ae333935e..b3c257bfaaa 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1194,13 +1194,14 @@ class ExtraFields if ($value == $obj->rowid) { - foreach ($fields_label as $field_toshow) - { - $translabel=$langs->trans($obj->$field_toshow); - if ($translabel!=$obj->$field_toshow) { - $labeltoshow=dol_trunc($translabel,18).' '; - }else { - $labeltoshow=dol_trunc($obj->$field_toshow,18).' '; + if (! $notrans) { + foreach ($fields_label as $field_toshow) { + $translabel = $langs->trans($obj->$field_toshow); + if ($translabel != $obj->$field_toshow) { + $labeltoshow = dol_trunc($translabel, 18) . ' '; + } else { + $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; + } } } $out.=''; From 19085ed200d89ee974d18afae0e1ce4d07d37fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:08:59 +0200 Subject: [PATCH 03/46] dol_print_object_info return void --- htdocs/bom/bom_agenda.php | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index a1db711dd3e..a4bf134e3ce 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -23,25 +23,12 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page @@ -196,7 +183,7 @@ if ($object->id > 0) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From 06421c200dbba9e4d79bb2c91f889734bd9c6b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:13:46 +0200 Subject: [PATCH 04/46] Update agenda.php --- htdocs/adherents/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 5b2c3e912dd..105251ec114 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -137,7 +137,7 @@ if ($object->id > 0) print '
'; $object->info($id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From 7d66cc1ab1bd0a4905515d36edfec5b4126e119c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:14:29 +0200 Subject: [PATCH 05/46] Update agenda.php --- htdocs/societe/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 2bf407ec88d..a9283f6e236 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -127,7 +127,7 @@ if ($socid > 0) print '
'; $object->info($socid); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From c8027ccf1a2aac850dfa62064e36d0c633dc7799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:15:10 +0200 Subject: [PATCH 06/46] Update agenda.php --- htdocs/contact/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 6e093a934dd..2b135c3cc37 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -227,7 +227,7 @@ else print '
'; $object->info($id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From 53a09a0dd46f06b77357bb3174ec701956e53090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:15:51 +0200 Subject: [PATCH 07/46] Update agenda.php --- htdocs/product/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 28b3c06ffa1..2ec5345009e 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -141,7 +141,7 @@ if ($id > 0 || $ref) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From ff37fddcf16a14407403d3364b6b2a3a16377e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:16:45 +0200 Subject: [PATCH 08/46] Update myobject_agenda.php --- htdocs/modulebuilder/template/myobject_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 924db3b8632..b536b264952 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -196,7 +196,7 @@ if ($object->id > 0) print '
'; $object->info($object->id); - print dol_print_object_info($object, 1); + dol_print_object_info($object, 1); print ''; From 7b317c4cbfc8c0ce38b2fec02fc6bcffbc6cf189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:28:34 +0200 Subject: [PATCH 09/46] printObjectLines return void --- htdocs/modulebuilder/template/myobject_card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e5223c86608..ed6a421ac86 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -389,7 +389,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (! empty($object->lines)) { - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + // printObjectLines return void + $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); } // Form to add new line From a09584ae4ba93a995db3780870cf83b071d47f58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:46:47 +0200 Subject: [PATCH 10/46] The method _load_ldap_dn() cannot be called... The method _load_ldap_dn() cannot be called from this context as it is declared private in class AdherentType. --- htdocs/adherents/class/adherent_type.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index c310bb18627..d51bbfef28a 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -462,7 +462,7 @@ class AdherentType extends CommonObject return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -472,7 +472,7 @@ class AdherentType extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - private function _load_ldap_dn($info, $mode = 0) + public function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; From 5a05cc184beacdcfba01480b433613b99e5f33d9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 19 May 2019 10:48:43 +0200 Subject: [PATCH 11/46] Fix Accountancy Export OpenConcerto --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index b9339a8150b..8ca2de4a132 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -616,7 +616,7 @@ class AccountancyExport $date = dol_print_date($line->doc_date, '%d/%m/%Y'); print $date . $separator; - print $line->code_journal; + print $line->code_journal . $separator; if (empty($line->subledger_account)) { print length_accountg($line->numero_compte) . $separator; } else { From a368a6a43ed8b59570289ac855976f5012783e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 19 May 2019 09:51:54 +0200 Subject: [PATCH 12/46] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index d51bbfef28a..5e7847efa82 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -65,7 +65,7 @@ class AdherentType extends CommonObject * @var string Adherent type label */ public $label; - + /** * @var string Adherent type nature */ @@ -410,7 +410,7 @@ class AdherentType extends CommonObject return -1; } } - + /** * Return translated label by the nature of a adherent (physical or moral) * @@ -422,7 +422,7 @@ class AdherentType extends CommonObject global $langs; if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } - else return $langs->trans("Physical & Morale"); + else return $langs->trans("Physical & Morale"); //return $morphy; } @@ -462,7 +462,8 @@ class AdherentType extends CommonObject return ''; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -485,12 +486,13 @@ class AdherentType extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - private function _load_ldap_info() + public function _load_ldap_info() { // phpcs:enable global $conf,$langs; From d86fc28aba46f06221fc0877e673b2d2a1d24eba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 13:01:11 +0200 Subject: [PATCH 13/46] Fix CSS --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 4 +-- htdocs/core/tpl/commonfields_view.tpl.php | 8 +++-- htdocs/core/tpl/extrafields_view.tpl.php | 1 - htdocs/theme/eldy/global.inc.php | 36 +++++++++++------------ htdocs/theme/md/style.css.php | 24 +++++++-------- 6 files changed, 36 insertions(+), 39 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 42dd3ba7d95..8052b80da20 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -310,7 +310,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - //$keyforbreak='fieldkeytoswithonsecondcolumn'; + $keyforbreak='description'; include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; // Other attributes diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9646b5d0d2e..2ee6399ba65 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -16,7 +16,7 @@ */ /** - * \file class/bom.class.php + * \file bom/class/bom.class.php * \ingroup bom * \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete) */ @@ -98,7 +98,7 @@ class BOM extends CommonObject 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), - 'date_valid' => array('type'=>'datetime', 'label'=>'DateValid', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), + 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,), diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 129c1a70575..7c30aa0ce86 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -48,7 +48,7 @@ foreach($object->fields as $key => $val) $value=$object->$key; print ' 0) print ' fieldrequired'; // No fieldrequired on the view output if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; @@ -65,9 +65,11 @@ foreach($object->fields as $key => $val) } print '
'; + +// We close div and reopen for second column print ''; print '
'; -print '
'; + print '
'; print ''; @@ -87,7 +89,7 @@ foreach($object->fields as $key => $val) $value=$object->$key; print ' 0) print ' fieldrequired'; if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; print '">'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index db0d6a4897d..a34308432e4 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -155,7 +155,6 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] print ''; print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); - print ''; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c1167524bf5..efd47a94631 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1126,15 +1126,14 @@ div.fichetwothirdright { } div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> - browser->layout != 'phone') { print "width: 50%;\n"; } ?> + browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?> } div.fichehalfright { browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> - browser->layout != 'phone') { print "width: 50%;\n"; } ?> + browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?> } -div.ficheaddleft { - browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } - else print "margin-top: 10px;\n"; ?> +div.fichehalfright { + browser->layout == 'phone') { print "margin-top: 10px;\n"; } ?> } div.firstcolumn div.box { padding-right: 10px; @@ -1174,8 +1173,7 @@ div.secondcolumn div.box { float: none; width: auto; } - div.ficheaddleft { - + div.fichehalfright { margin-top: 10px; } div.firstcolumn div.box { @@ -1198,13 +1196,13 @@ div.secondcolumn div.box { width: auto; } - .fichehalfright-lg .ficheaddleft{ + .fichehalfright-lg .fichehalfright { padding-left:0; } } /* For table into table into card */ -div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { +div.fichehalfright tr.liste_titre:first-child td table.nobordernopadding td { padding: 0 0 0 0; } div.nopadding { @@ -2466,9 +2464,9 @@ td.border, div.tagtable div div.border { } -/*.ficheaddleft table.noborder { +.fichehalfright table.noborder { margin: 0px 0px 0px 0px; -}*/ +} table.liste, table.noborder, table.formdoc, div.noborder { width: 100%; @@ -2498,7 +2496,7 @@ table.liste tr:last-of-type td, table.noborder:not(#tablelines) tr:last-of-type border-bottom-color: rgb(); border-bottom-style: solid; } -div.tabBar div.ficheaddleft table.noborder:not(.margintable):not(.paymenttable):last-of-type { +div.tabBar div.fichehalfright table.noborder:not(.margintable):not(.paymenttable):last-of-type { border-bottom: 1px solid rgb(); } div.tabBar table.border>tbody>tr:last-of-type>td { @@ -2506,7 +2504,7 @@ div.tabBar table.border>tbody>tr:last-of-type>td { border-bottom-color: rgb(); border-bottom-style: solid; } -div.tabBar div.ficheaddleft table.noborder { +div.tabBar div.fichehalfright table.noborder { border-bottom: none; } @@ -3013,8 +3011,8 @@ div.tabBar .noborder { /* Prepare to remove class pair - impair */ .noborder > tbody > tr:nth-child(even):not(.liste_titre), .liste > tbody > tr:nth-child(even):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) { background: linear-gradient(bottom, rgb() 85%, rgb() 100%); background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); @@ -3029,8 +3027,8 @@ div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth- } .noborder > tbody > tr:nth-child(odd):not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) { background: linear-gradient(bottom, rgb() 85%, rgb() 100%); background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); @@ -3057,9 +3055,9 @@ ul.noborder li:nth-child(even):not(.liste_titre) { overflow-x: auto; min-height: 40px; } -/*.ficheaddleft div.boxstats, .ficheaddright div.boxstats { +.ficheaddleft div.boxstats, .ficheaddright div.boxstats { border: none; -}*/ +} .boxstatsborder { /* border: 1px solid #CCC !important; */ } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3aea173df6c..6e569fa93d3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1364,9 +1364,8 @@ div.fichehalfright { browser->layout != 'phone') { print "float: ".$right.";\n"; } ?> browser->layout != 'phone') { print "width: 50%;\n"; } ?> } -div.ficheaddleft { - browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; } - else print "margin-top: 10px;\n"; ?> +div.fichehalfright { + browser->layout == 'phone') { print "margin-top: 10px;\n"; } ?> } div.firstcolumn div.box { padding-right: 10px; @@ -1408,8 +1407,7 @@ div.secondcolumn div.box { float: none; width: auto; } - div.ficheaddleft { - + div.fichehalfright { margin-top: 10px; } div.firstcolumn div.box { @@ -1421,7 +1419,7 @@ div.secondcolumn div.box { } /* For table into table into card */ -div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td, div.nopadding { +div.fichehalfright tr.liste_titre:first-child td table.nobordernopadding td, div.nopadding { padding: 0 0 0 0; } div.nopadding { @@ -2736,7 +2734,7 @@ td.border, div.tagtable div div.border { border-bottom: 1px solid rgb(); } -.ficheaddleft table.noborder { +.fichehalfright table.noborder { margin: 0px 0px 0px 0px; } div.colorback @@ -3275,8 +3273,8 @@ div .tdtop { /* Prepare to remove class pair - impair */ .noborder > tbody > tr:nth-child(even):not(.liste_titre), .liste > tbody > tr:nth-child(even):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(even):not(.liste_titre), .liste > tbody > tr:nth-of-type(even):not(.liste_titre), +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(even):not(.liste_titre) { background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); @@ -3291,8 +3289,8 @@ div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth- } .noborder > tbody > tr:nth-child(odd):not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), -div:not(.fichecenter):not(.fichehalfleft):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) > .border > tbody > tr:nth-of-type(odd):not(.liste_titre), .liste > tbody > tr:nth-of-type(odd):not(.liste_titre), +div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright):not(.ficheaddleft) .oddeven.tagtr:nth-of-type(odd):not(.liste_titre) { background: linear-gradient(to bottom, rgb() 85%, rgb() 100%); background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); @@ -3319,9 +3317,9 @@ ul.noborder li:nth-child(even):not(.liste_titre) { overflow-x: auto; min-height: 40px; } -/*.ficheaddleft div.boxstats, .ficheaddright div.boxstats { +.ficheaddleft div.boxstats, .ficheaddright div.boxstats { border: none; -}*/ +} .boxstatsborder { /* border: 1px solid #CCC !important; */ } From 5f23cf7e2a64065ce10f6e32cfd787ab1d76297d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 13:51:47 +0200 Subject: [PATCH 14/46] CSS --- htdocs/accountancy/admin/account.php | 2 +- htdocs/admin/agenda.php | 2 +- htdocs/admin/emailcollector_list.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/admin/tools/listevents.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/mailing/list.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/various_payment/list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/compta/deplacement/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/compta/prelevement/bons.php | 2 +- htdocs/compta/prelevement/list.php | 2 +- htdocs/compta/salaries/list.php | 2 +- htdocs/compta/sociales/list.php | 2 +- htdocs/compta/tva/list.php | 2 +- htdocs/contact/consumption.php | 2 +- htdocs/contact/list.php | 8 ++++---- htdocs/contrat/services_list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/fichinter/list.php | 2 +- htdocs/fourn/facture/impayees.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/facture/paiement.php | 2 +- htdocs/fourn/product/list.php | 2 +- htdocs/holiday/define_holiday.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/holiday/view_log.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/price.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 6 +++--- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/resource/list.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/price.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/theme/eldy/btn.inc.php | 2 ++ htdocs/ticket/list.php | 2 +- htdocs/user/hierarchy.php | 2 +- htdocs/user/list.php | 2 +- 54 files changed, 60 insertions(+), 58 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index f007d4f8299..8daae94efe6 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -297,7 +297,7 @@ if ($resql) if (! empty($arrayfields['aa.pcg_type']['checked'])) print ''; if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print ''; if (! empty($arrayfields['aa.active']['checked'])) print ''; - print ''; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 24b4766471d..649bfab3d97 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -143,7 +143,7 @@ print ''; print ''; print ''; // Action column -print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index d67936edfb5..a7e6a1aff67 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -384,7 +384,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index fa895f84182..f6a526600d7 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -356,7 +356,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 987f965576a..d508afe63d2 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -255,7 +255,7 @@ if ($result) //print ''; print ''; - print ''; diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 029b5334d55..c0c67c52331 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -372,7 +372,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 8c9d60f1fe7..62e6a21ac22 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -387,7 +387,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index b9c93ece52c..619f61bdc67 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -505,7 +505,7 @@ if ($object->fetch($id) >= 0) print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1); print ''; // Action column - print ''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 7e058819771..da74efaaf98 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -191,7 +191,7 @@ if ($result) if (! $filteremail) print ''; print ''; print ''; - print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 68c0ada46df..0c43475f2fb 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -906,7 +906,7 @@ if ($resql) } if (! empty($arrayfields['balance']['checked'])) { - print ''; diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 8be0b075e40..537bd6aee66 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -223,7 +223,7 @@ if ($result) // Credit print ''; - print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 32a5e50a452..816d1486970 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -402,7 +402,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 9ad85788ca0..58a8fd32ef5 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -153,7 +153,7 @@ if ($resql) print ''; - print ''; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 401d12aec4b..11de8aa48a2 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -175,7 +175,7 @@ if ($resql) print ''; print ''; print ''; - print ''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c005e0d70e6..39089c31274 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -255,7 +255,7 @@ if ($resql) print ''; - print ''; diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 9fcb77d9b42..2b67b73c95b 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -134,7 +134,7 @@ if ($result) print ''; print ''; print ''; - print ''; diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 8180517a2e8..81e58e19cca 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -146,7 +146,7 @@ if ($result) print ''; print ''; print ''; - print ''; diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index 6ce49536d20..4fa8bd09a76 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -196,7 +196,7 @@ if ($result) // Amount print ''; - print ''; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 01efe621dc8..7e25d8c3423 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -236,7 +236,7 @@ if ($resql) print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; - print ''; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 1d6b08735a0..d735edd5840 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -187,7 +187,7 @@ if ($result) print ''; } print ''; - print ''; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 667965396a6..3f0d0313ee0 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -390,7 +390,7 @@ if ($sql_select) print ''; print ''; - print ''; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 6749ac0a7f5..fa26c5ed30b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -693,8 +693,8 @@ if (! empty($arrayfields['p.import_key']['checked'])) print ''; } // Action column -print ''; @@ -783,7 +783,7 @@ while ($i < min($num, $limit)) // Name if (! empty($arrayfields['p.lastname']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -791,7 +791,7 @@ while ($i < min($num, $limit)) // Firstname if (! empty($arrayfields['p.firstname']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Job position diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 19b40fa451d..07b5cceee1a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -524,7 +524,7 @@ if (! empty($arrayfields['status']['checked'])) print ''; } // Action column -print ''; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index f5cf23bceb7..1af11afca24 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -193,7 +193,7 @@ if ($resql) } print ''; print ''; - print ''; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index bff598873ce..f8697fb52fc 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -433,7 +433,7 @@ if ($resql) { print ''; } - print ''; diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 27a659300cc..02c8af6ebc6 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -213,7 +213,7 @@ if ($user->rights->fournisseur->facture->lire) print ''; - print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index fa13e329b0e..fe3deb6459b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -728,7 +728,7 @@ if ($resql) } if (! empty($arrayfields['rtp']['checked'])) { - print ''; } // Extra fields diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index a84acde6e04..f45d4009d05 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -944,7 +944,7 @@ if (empty($action) || $action == 'list') print ''; - print ''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 218379ce7b8..7b319490815 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -243,7 +243,7 @@ if ($resql) print ''; print ''; print ''; - print ''; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 1404391f521..c0b25e57769 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -271,7 +271,7 @@ else print ''; // Action column - print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index a93be6e096d..84e7b36c239 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -460,7 +460,7 @@ $holiday->selectStatutCP($search_statut, 'search_statut'); print ''; // Actions -print ''; diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index f27f1a5f10b..a37d3490c97 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -193,7 +193,7 @@ print ''; print ''; print ''; // Action column -print ''; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e8efedcf075..8fee6ca6664 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -428,7 +428,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 58b34b6e8ea..b102e6ebad4 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -380,7 +380,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 688fef19654..93bcb936e98 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -676,7 +676,7 @@ if ($resql) print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')), $search_tobuy, 1); print ''; } - print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f6efc0296b1..ccde05d1e24 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1989,7 +1989,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; // Print the search button - print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index f8800aabc38..476fec36c2a 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -297,7 +297,7 @@ if ($resql) print ''; print ''; print ''; - print ''; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 5142b05b4c4..faf91184dd1 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -293,7 +293,7 @@ if ($resql) print ''; print ''; print ''; - print ''; @@ -388,7 +388,7 @@ if ($resql) //print ''; // Warehouse - print ''; // Lot - print ''; - print ''; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 7983c1d2547..b75042c7cca 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -904,7 +904,7 @@ if ($resql) print ''; } // Actions - print ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 183927af207..836bb97e50c 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -880,7 +880,7 @@ if ($resql) print ''; } // Actions - print ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index ae127bb03b6..d0d7b5da8e6 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -368,7 +368,7 @@ if ($resql) print ''; }*/ // Action column - print ''; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 0de9fa76786..069be8aca96 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -562,12 +562,12 @@ print ''; print ''; print ''; print ''; -print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 1e8efc15581..34dd5547f7b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -655,7 +655,7 @@ if (! empty($arrayfields['p.fk_statut']['checked'])) print ''; } // Action column -print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c7053bc7079..ccc8a0548c8 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -762,7 +762,7 @@ elseif ($id > 0 || ! empty($ref)) if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; // Action column - print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 4a6d2633354..b97710ba7b6 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -588,7 +588,7 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; } // Action column -print ''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 3e613c3d99c..6765d2d7147 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -224,7 +224,7 @@ if (! empty($arrayfields['ty.label']['checked'])) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column -print ''; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index c16ef378bd0..d158fb49698 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -396,7 +396,7 @@ if ($sql_select) print ''; print ''; - print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 76824ca0140..1476bb8ce75 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -545,7 +545,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; // Print the search button - print ''; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 6b4a85f28c8..ef19f266597 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -391,7 +391,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 927c92c5f41..f95940a61a0 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -70,6 +70,8 @@ border-bottom-left-radius: 0 !important;*/ } a.butActionNew>span.fa-plus-circle, a.butActionNew>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-circle:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } +a.butActionNew>span.fa-list-alt, a.butActionNew>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } +a.butActionNewRefused>span.fa-list-alt, a.butActionNewRefused>span.fa-list-alt:hover { padding-left: 6px; font-size: 1.5em; border: none; box-shadow: none; webkit-box-shadow: none; } .butAction:hover { -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 481ad2add76..1c3995391de 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -553,7 +553,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index a54e3070573..be18cb4051a 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -172,7 +172,7 @@ print ''; print ''; -print ''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 62d32bc1654..ad310b0041e 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -439,7 +439,7 @@ if (! empty($arrayfields['u.statut']['checked'])) print ''; } // Action column -print ''; From 2debffe170136a6ba17aa7ceef15fe3b136e81a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 16:21:11 +0200 Subject: [PATCH 15/46] Debug modulebuilder for lines --- htdocs/bom/bom_card.php | 56 ++++++++++++++ htdocs/bom/class/bom.class.php | 25 ++++++ htdocs/modulebuilder/index.php | 77 ++++++++++++++++--- .../template/class/myobject.class.php | 24 ++++++ 4 files changed, 173 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 8052b80da20..de6189c946a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -325,6 +325,62 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea dol_fiche_end(); + + /* + * Lines + */ + + if (! empty($object->table_element_line)) + { + // Show object lines + $result = $object->getLinesArray(); + + print '
+ + + + + '; + + if (! empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + } + + print '
'; + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print '
 '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print '   '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); print $form->textwithpicto('', $htmltext, 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; // print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '  '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '  '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; -$searchpicto=$form->showFilterButtons(); +print ''; +$searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; print $contactstatic->getNomUrl(1, '', 0); print ''.$obj->firstname.''.$obj->firstname.''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ' '; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ' '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '  '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '   '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''.$objp->desiredstock.''; + print ''; if ($objp->fk_entrepot > 0) { print $warehousetmp->getNomUrl(1); @@ -396,7 +396,7 @@ if ($resql) print ''; + print ''; if ($product_lot_static->batch) { print $product_lot_static->getNomUrl(1); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index e36312e196c..b9876bdf36a 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -177,7 +177,7 @@ if ($result) print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ' ' . $langs->trans('AlertOnly') . ' ' . $langs->trans('IncludeAlsoDraftOrders') . '  '; // Fields from hook $parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ' '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ' '; print $form->selectarray('search_statut', array('-1'=>'','1'=>$langs->trans('Enabled')), $search_statut); print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + } + + if (! empty($object->lines)) + { +// $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); + } + + // Form to add new line + if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') + { + if ($action != 'editline') + { + // Add products/services form +// $object->formAddObjectLine(1, $mysoc, $soc); + + $parameters = array(); + $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + } + } + + if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + { + print '
'; + } + print '
'; + + print "\n"; + } + + + // Buttons for actions if ($action != 'presend' && $action != 'editline') { print '
'."\n"; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 2ee6399ba65..6ada9b167f9 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -850,6 +850,31 @@ class BOM extends CommonObject } } + /** + * Create an array of lines + * + * @return array|int array of lines if OK, <0 if KO + */ + public function getLinesArray() + { + $this->lines=array(); + + $objectline = new BOMLine($this->db); + $result = $objectline->fetchAll('', '', 0, 0, array('fk_bom'=>$this->id)); + + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines(); + } + } + /** * Initialise object with example values * Id must be 0 if object instance is a specimen diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 21fb23f017c..e5024f6949f 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -163,7 +163,10 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/myobject_agenda.php'); dol_delete_file($destdir.'/myobject_list.php'); dol_delete_file($destdir.'/lib/'.strtolower($modulename).'_myobject.lib.php'); + dol_delete_file($destdir.'/test/phpunit/MyObjectFunctionnalTest.php'); dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); + dol_delete_file($destdir.'/test/phpunit'); + dol_delete_file($destdir.'/test'); dol_delete_file($destdir.'/sql/llx'.strtolower($modulename).'_myobject.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); @@ -223,6 +226,9 @@ if ($dirins && $action == 'initmodule' && $modulename) if ($dirins && $action == 'initapi' && !empty($module)) { + $modulename = ucfirst($module); // Force first letter in uppercase + $objectname = $tabobj; + dol_mkdir($dirins.'/'.strtolower($module).'/class'); $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $srcfile = $srcdir.'/class/api_mymodule.class.php'; @@ -232,9 +238,6 @@ if ($dirins && $action == 'initapi' && !empty($module)) if ($result > 0) { - $modulename = ucfirst($module); // Force first letter in uppercase - $objectname = $tabobj; - //var_dump($phpfileval['fullname']); $arrayreplacement=array( 'mymodule'=>strtolower($modulename), @@ -254,6 +257,46 @@ if ($dirins && $action == 'initapi' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } } + +if ($dirins && $action == 'initphpunit' && !empty($module)) +{ + $modulename = ucfirst($module); // Force first letter in uppercase + $objectname = $tabobj; + + dol_mkdir($dirins.'/'.strtolower($module).'/class'); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $srcfile = $srcdir.'/test/phpunit/MyObjectTest.php'; + $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($objectname).'Test.php'; + $result = dol_copy($srcfile, $destfile, 0, 0); + /*$srcfile = $srcdir.'/test/phpunit/MyModuleFunctionnalTest.class.php'; + $destfile = $dirins.'/'.strtolower($module).'/test/phpunit/'.strtolower($module).'FunctionnalTest.class.php'; + $result = dol_copy($srcfile, $destfile, 0, 0);*/ + if ($result > 0) + { + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + 'myobject'=>strtolower($objectname), + 'MyObject'=>$objectname, + 'MYOBJECT'=>strtoupper($objectname), + '---Put here your own copyright and developer email---'=>dol_print_date($now, '%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); + + dolReplaceInFile($destfile, $arrayreplacement); + } + else + { + + } +} + if ($dirins && $action == 'inithook' && !empty($module)) { dol_mkdir($dirins.'/'.strtolower($module).'/class'); @@ -518,7 +561,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) dol_mkdir($destdir.'/lib'); dol_mkdir($destdir.'/scripts'); dol_mkdir($destdir.'/sql'); - dol_mkdir($destdir.'/test/phpunit'); // Scan dir class to find if an object with same name already exists. if (! $error) @@ -548,7 +590,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', 'myobject_list.php'=>strtolower($objectname).'_list.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', @@ -912,7 +954,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) 'myobject_list.php'=>strtolower($objectname).'_list.php', 'lib/mymodule.lib.php'=>'lib/'.strtolower($module).'.lib.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', @@ -1803,17 +1845,17 @@ elseif (! empty($module)) $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; - $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; + $pathtophpunit = strtolower($module).'/test/phpunit/'.strtolower($tabobj).'Test.php'; $pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql'; $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.sql'; $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.key.sql'; + $pathtosqlextrakey = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'_extrafields.key.sql'; $pathtolib = strtolower($module).'/lib/'.strtolower($module).'.lib.php'; $pathtoobjlib = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php'; $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; $pathtoscript = strtolower($module).'/scripts/'.strtolower($tabobj).'.php'; //var_dump($pathtolib); - $realpathtoclass = dol_buildpath($pathtoclass, 0, 2); $realpathtoapi = dol_buildpath($pathtoapi, 0, 2); $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 2); @@ -1825,6 +1867,7 @@ elseif (! empty($module)) $realpathtosql = dol_buildpath($pathtosql, 0, 2); $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 2); $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 2); + $realpathtosqlextrakey = dol_buildpath($pathtosqlextrakey, 0, 2); $realpathtolib = dol_buildpath($pathtolib, 0, 2); $realpathtoobjlib = dol_buildpath($pathtoobjlib, 0, 2); $realpathtopicto = dol_buildpath($pathtopicto, 0, 2); @@ -1855,9 +1898,21 @@ elseif (! empty($module)) //print ''.$langs->trans("FileNotYetGenerated").' '; print ''; } + // PHPUnit print '
'; print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit?'':'').$pathtophpunit.($realpathtophpunit?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + + if ($realpathtophpunit) + { + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '; + print ''.img_picto($langs->trans("Delete"), 'delete').''; + } + else + { + //print ''.$langs->trans("FileNotYetGenerated").' '; + print ''; + } print '
'; print '
'; @@ -1887,6 +1942,10 @@ elseif (! empty($module)) print ' '.img_picto($langs->trans("Edit"), 'edit').''; //print '   '.$langs->trans("RunSql").''; print '
'; + print ' '.$langs->trans("SqlFileKeyExtraFields").' : '.($realpathtosqlextrakey?'':'').$pathtosqlextrakey.($realpathtosqlextrakey?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + //print '   '.$langs->trans("RunSql").''; + print '
'; print '
'; print '
'; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 74b2c6b50c0..06658b71576 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -644,6 +644,30 @@ class MyObject extends CommonObject $this->initAsSpecimenCommon(); } + /** + * Create an array of lines + * + * @return array|int array of lines if OK, <0 if KO + */ + public function getLinesArray() + { + $this->lines=array(); + + $objectline = new BOMLine($this->db); + $result = $objectline->fetchAll('', '', 0, 0, array('fk_myobject'=>$this->id)); + + if (is_numeric($result)) + { + $this->error = $this->error; + $this->errors = $this->errors; + return $result; + } + else + { + $this->lines = $result; + return $this->lines(); + } + } /** * Action executed by scheduler From 27ed095181f6d436ce0ea92b52a4f5ba2f89efa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 16:40:25 +0200 Subject: [PATCH 16/46] Debug BOM module --- htdocs/bom/bom_document.php | 6 ++---- htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 197b9779988..1738efc605c 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -132,10 +132,8 @@ if ($object->id) dol_fiche_end(); $modulepart = 'bom'; - //$permission = $user->rights->bom->create; - $permission = 1; - //$permtoedit = $user->rights->bom->create; - $permtoedit = 1; + $permission = $user->rights->bom->write; + $permtoedit = $user->rights->bom->write; $param = '&id=' . $object->id; //$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 576aff4db66..55196c91fb5 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1830,7 +1830,7 @@ class FormFile print '' . dol_print_date($link->datea, "dayhour", "tzuser") . ''; print ''; print ''; - print '' . img_edit() . ''; // id= is included into $param + print '' . img_edit() . ''; // id= is included into $param if ($permtodelete) { print '   ' . img_delete() . ''; // id= is included into $param } else { From e84e3ef01fafabd51f10df939c179b03938a09b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 19:15:18 +0200 Subject: [PATCH 17/46] Move module into external module --- build/rpm/dolibarr_fedora.spec | 1 - build/rpm/dolibarr_generic.spec | 1 - build/rpm/dolibarr_mandriva.spec | 1 - build/rpm/dolibarr_opensuse.spec | 1 - htdocs/ifttt/README.md | 7 -- htdocs/ifttt/admin/index.php | 126 ------------------------------- 6 files changed, 137 deletions(-) delete mode 100644 htdocs/ifttt/README.md delete mode 100644 htdocs/ifttt/admin/index.php diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 881b5b1a6a4..b6d526bf8e1 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -191,7 +191,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 74d6bf700bb..32c6e50018e 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -271,7 +271,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 181bdb4ded4..dbb8e0d1310 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -188,7 +188,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 1410e5097cf..aa810a737b9 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -199,7 +199,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/hrm -%_datadir/dolibarr/htdocs/ifttt %_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/install diff --git a/htdocs/ifttt/README.md b/htdocs/ifttt/README.md deleted file mode 100644 index 581853f80c6..00000000000 --- a/htdocs/ifttt/README.md +++ /dev/null @@ -1,7 +0,0 @@ -API REST -======== - -## Integrate your ERP with any other applications using IFTTT - -This module provides the triggers and services to make Dolibarr compatible with IFTTT Services. - diff --git a/htdocs/ifttt/admin/index.php b/htdocs/ifttt/admin/index.php deleted file mode 100644 index 30ed2ef0a86..00000000000 --- a/htdocs/ifttt/admin/index.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2005-2016 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012-2018 Regis Houssin - * Copyright (C) 2015 Jean-François Ferry - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/ifttt/admin/index.php - * \ingroup api - * \brief Page to setup IFTTT module - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - -// Load translation files required by the page -$langs->load("admin"); - -if (! $user->admin) - accessforbidden(); - -$action=GETPOST('action', 'aZ09'); - - -if ($action == 'set') -{ - $res1 = dolibarr_set_const($db, 'IFTTT_SERVICE_KEY', GETPOST('IFTTT_SERVICE_KEY', 'alpha'), 'chaine', 0, '', 0); - $res2 = dolibarr_set_const($db, 'IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', GETPOST('IFTTT_DOLIBARR_ENDPOINT_SECUREKEY', 'alpha'), 'chaine', 0, '', 0); - - if ($res1 > 0 && $res2) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } -} - - -/* - * View - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("IFTTTSetup"), $linkback, 'title_setup'); - -print ''.$langs->trans("IFTTTDesc")."
\n"; -print "
\n"; - -print '
'; -print ''; -print ''; -print ''; - -print ''; -print ""; -print '"; -print ""; -print ""; - -print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; - -print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'.$langs->trans("IFTTT_SERVICE_KEY").''; -print ''; -print ''.$langs->trans("YouWillFindItOnYourIFTTTAccount").'
'.$langs->trans("IFTTT_DOLIBARR_ENDPOINT_SECUREKEY").''; -print ''; -print '
'; - -print '
'; -print ''; -print '
'; - -print '
'; - -print '

'; - - - -// Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - -// Show message -$message=''; -$url=$urlwithroot.'/public/ifttt/index.php?securekey='.$conf->global->IFTTT_DOLIBARR_ENDPOINT_SECUREKEY; -$message.=$langs->trans("UrlForIFTTT").':
'; -$message.=img_picto('', 'object_globe.png').' '; -print $message; -print ajax_autoselect("endpointforifttt"); -print '
'; -print '
'; - - -llxFooter(); -$db->close(); From 6780befb2df939c48f8378fd6b8200f807ee0a12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 May 2019 21:59:03 +0200 Subject: [PATCH 18/46] Fix css --- htdocs/theme/eldy/global.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index efd47a94631..f66a037d43a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1124,6 +1124,9 @@ div.fichetwothirdright { browser->layout != 'phone') { print "width: 50%;\n"; } ?> browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> } +div.fichetwothirdright div.ficheaddleft { + padding-left: 20px; +} div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?> From 5def839813af872aa7fff871cf945174fe59540a Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 20 May 2019 11:56:26 +0200 Subject: [PATCH 19/46] FIX : Padding on create project icon --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 4950efb19ab..c8cba5c3dda 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1679,7 +1679,7 @@ if ($action == 'create') print ''; print '' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ''; print ''; print ''; } From 3c1b860da475bf3311bae1e81bd515026b80631f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 12:16:39 +0200 Subject: [PATCH 20/46] Fix css --- htdocs/bom/bom_card.php | 4 ++-- htdocs/bom/bom_document.php | 6 +++--- htdocs/core/menus/standard/eldy.lib.php | 4 ++-- htdocs/core/tpl/commonfields_view.tpl.php | 2 +- htdocs/core/tpl/resource_add.tpl.php | 2 +- htdocs/core/tpl/resource_view.tpl.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/modulebuilder/template/myobject_document.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index de6189c946a..fddba91eeeb 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -307,7 +307,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; print '
'; - print ''."\n"; + print '
'."\n"; // Common attributes $keyforbreak='description'; @@ -391,7 +391,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - print '' . $langs->trans('SendMail') . ''."\n"; + //print '' . $langs->trans('SendMail') . ''."\n"; // Modify if ($user->rights->bom->write) diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 1738efc605c..012094fbb05 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -68,8 +68,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->ref); +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->ref); /* @@ -117,7 +117,7 @@ if ($object->id) print '
'; print '
'; - print '
'; + print '
'; // Number of files print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fc639802e7f..3710cc2cf91 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -540,10 +540,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, global $langs; if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; + print ''; print ''; print $text; print ''; diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 7c30aa0ce86..f6d59435e74 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -71,7 +71,7 @@ print ''; print '
'; print '
'; -print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'; +print '
'; $alreadyoutput = 1; foreach($object->fields as $key => $val) diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 34246bcf0b6..4e5967b30b4 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -14,7 +14,7 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; $form = new Form($db); $formresources = new FormResource($db); -$out = '
'; +$out = '
'; $out .= '
'; $out .= ''; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 76a565cf7d6..d2e0441b60b 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -13,7 +13,7 @@ $form= new Form($db); print '
'; -print ''; +print ''; print '
'; print '
'.$langs->trans('Resource').'
'; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e5223c86608..02b7aa42315 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -223,7 +223,7 @@ if (($id || $ref) && $action == 'edit') dol_fiche_head(); - print '
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index d9542daf64f..55fcdc6f9eb 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -81,8 +81,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject'); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/myobject/" . dol_sanitizeFileName($object->ref); +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->ref); /* diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f66a037d43a..691daebf894 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2555,7 +2555,7 @@ table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.nobor } table.liste td, table.noborder td, div.noborder form div, table.tableforservicepart1 td, table.tableforservicepart2 td { padding: 7px 8px 7px 8px; /* t r b l */ - line-height: 1.2em; + line-height: 22px; height: 22px; } div.liste_titre_bydiv .divsearchfield { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 70479584c5a..dfb180f0dad 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -13,7 +13,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FI8TNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 6437fa2de72..f02c25113ef 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -51,10 +51,10 @@ $colorbacklinepairhover='230,237,244'; // line hover $colorbacklinepairchecked='230,237,244'; // line checked $colorbacklinebreak='223,218,220'; // line break $colorbackbody='255,255,255'; -$colortexttitlenotab='100,60,20'; +$colortexttitlenotab='110,80,20'; $colortexttitle='0,0,0'; $colortext='0,0,0'; -$colortextlink='8, 85, 134'; +$colortextlink='10, 10, 100'; $fontsize='0.86em'; $fontsizesmaller='0.75em'; $topMenuFontSize='1.2em'; From 827a2e18095bc76a1b3f631fd973799b48e42122 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 12:47:02 +0200 Subject: [PATCH 21/46] Fix test if qualified for stock change at wrong place --- htdocs/compta/facture/card.php | 213 ++++++++++++++++++--------------- 1 file changed, 117 insertions(+), 96 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 85b4e3bb728..69f647e0757 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -518,20 +518,23 @@ if (empty($reshook)) } } - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - // Check for warehouse - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - if (! $idwarehouse || $idwarehouse == - 1) { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); - $action = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + if (! $idwarehouse || $idwarehouse == - 1) { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $action = ''; + } } } @@ -575,20 +578,23 @@ if (empty($reshook)) $object->fetch($id); $object->fetch_thirdparty(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - // Check parameters - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - if (! $idwarehouse || $idwarehouse == - 1) { - $error++; - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); - $action = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change)) + { + if (! $idwarehouse || $idwarehouse == - 1) { + $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $action = ''; + } } } @@ -3426,28 +3432,35 @@ elseif ($id > 0 || ! empty($ref)) $text = $langs->trans('ConfirmDeleteBill', $object->ref); $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $object->statut >= 1) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); - $forcecombo=0; - if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) - ); - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); + } else { + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) + ); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); + } + else + { + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); + } } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); } @@ -3496,35 +3509,38 @@ elseif ($id > 0 || ! empty($ref)) } $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; - $formproduct = new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array)); - $value = ''; + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); } else { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $formproduct = new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array)); + $value = ''; + } else { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease"); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + } + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value)); } - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => - // 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' - // => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value)); } if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on { @@ -3538,33 +3554,38 @@ elseif ($id > 0 || ! empty($ref)) $text = $langs->trans('ConfirmUnvalidateBill', $object->ref); $formquestion = array(); - $qualified_for_stock_change = 0; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $qualified_for_stock_change = $object->hasProductsOrServices(2); - } else { - $qualified_for_stock_change = $object->hasProductsOrServices(1); - } - if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) { - $langs->load("stocks"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; - $formproduct = new FormProduct($db); - $warehouse = new Entrepot($db); - $warehouse_array = $warehouse->list_array(); - if (count($warehouse_array) == 1) { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array)); - $value = ''; + if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + { + $qualified_for_stock_change = 0; + if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $qualified_for_stock_change = $object->hasProductsOrServices(2); } else { - $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); - $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + $qualified_for_stock_change = $object->hasProductsOrServices(1); + } + + if ($qualified_for_stock_change) + { + $langs->load("stocks"); + require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + $formproduct = new FormProduct($db); + $warehouse = new Entrepot($db); + $warehouse_array = $warehouse->list_array(); + if (count($warehouse_array) == 1) { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array)); + $value = ''; + } else { + $label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); + $value = $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1); + } + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => + // 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' + // => 1), + array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value)); } - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => - // 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' - // => 1), - array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $value)); } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('UnvalidateBill'), $text, 'confirm_modif', $formquestion, "yes", 1); From 91dd8a71d3d07922008ffc4a4e49fef803828ac7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 12:50:00 +0200 Subject: [PATCH 22/46] Fix syntax error --- htdocs/compta/facture/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 69f647e0757..329ecbbedcc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -527,7 +527,7 @@ if (empty($reshook)) } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } - + if ($qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == - 1) { @@ -587,8 +587,8 @@ if (empty($reshook)) } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } - - if ($qualified_for_stock_change)) + + if ($qualified_for_stock_change) { if (! $idwarehouse || $idwarehouse == - 1) { $error++; @@ -3440,7 +3440,7 @@ elseif ($id > 0 || ! empty($ref)) } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } - + if ($qualified_for_stock_change) { $langs->load("stocks"); @@ -3517,7 +3517,7 @@ elseif ($id > 0 || ! empty($ref)) } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } - + if ($qualified_for_stock_change) { $langs->load("stocks"); @@ -3562,7 +3562,7 @@ elseif ($id > 0 || ! empty($ref)) } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } - + if ($qualified_for_stock_change) { $langs->load("stocks"); From 83c369cc0f1f9b0fe50dfdea91e8e719df7d04d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 13:02:33 +0200 Subject: [PATCH 23/46] Add $array_to_check for property in invoice instead of thirdparty --- htdocs/compta/facture/card.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 329ecbbedcc..6cef63af90a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -477,7 +477,7 @@ if (empty($reshook)) // Check parameters - // Check for mandatory fields defined into setup + // Check for mandatory fields in thirdparty (defined into setup) $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL'); foreach($array_to_check as $key) { @@ -518,6 +518,23 @@ if (empty($reshook)) } } + // Check for mandatory fields in invoice + $array_to_check=array('REF_CUSTOMER'=>'RefCustomer'); + foreach($array_to_check as $key => $val) + { + $keymin=strtolower($key); + $vallabel=$object->$keymin; + + // Check for mandatory + $keymandatory ='INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION'; + if (! $vallabel && ! empty($conf->global->$keymandatory)) + { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors'); + } + } + // Check for warehouse if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) { From c3732f2b7a06ffd3aae656633355f8d0c9b0a593 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 14:41:47 +0200 Subject: [PATCH 24/46] Fix edition of margins in recurring invoices --- htdocs/compta/facture/card.php | 6 +- .../facture/class/facture-rec.class.php | 47 ++-- htdocs/compta/facture/fiche-rec.php | 254 +++++++++--------- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 4 +- htdocs/core/tpl/objectline_edit.tpl.php | 9 +- htdocs/core/tpl/objectline_view.tpl.php | 106 ++++---- 7 files changed, 224 insertions(+), 204 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6cef63af90a..894e14eefa7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1943,7 +1943,7 @@ if (empty($reshook)) if ($result > 0) { - // Define output language + // Define output language and generate document if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; @@ -2055,7 +2055,7 @@ if (empty($reshook)) $line->fetch(GETPOST('lineid')); $percent = $line->get_prev_progress($object->id); - if($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0) + if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0) { // in case of situation credit note if(GETPOST('progress') >= 0 ) @@ -2147,7 +2147,7 @@ if (empty($reshook)) } } -$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), + $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'), $_POST['units'], $pu_ht_devise); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 89f324d2450..c1cc9df9e5c 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -527,7 +527,7 @@ class FactureRec extends CommonInvoice $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, '; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; - $sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc,'; + $sql.= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; //$sql.= ' l.situation_percent, l.fk_prev_id,'; //$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql.= ' l.rang, l.special_code,'; @@ -583,6 +583,11 @@ class FactureRec extends CommonInvoice $line->total_tva = $objp->total_tva; $line->total_ttc = $objp->total_ttc; $line->code_ventilation = $objp->fk_code_ventilation; + $line->fk_fournprice = $objp->fk_fournprice; + $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); + $line->pa_ht = $marginInfos[0]; + $line->marge_tx = $marginInfos[1]; + $line->marque_tx = $marginInfos[2]; $line->rang = $objp->rang; $line->special_code = $objp->special_code; $line->fk_unit = $objp->fk_unit; @@ -695,15 +700,17 @@ class FactureRec extends CommonInvoice * @param double $pu_ht_devise Unit price in currency * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice + * @param int $fk_fournprice Supplier price id (to calculate margin) or '' + * @param int $pa_ht Buying price of line (to calculate margin) or '' * @return int <0 if KO, Id of line if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { global $mysoc; $facid=$this->id; - dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill", LOG_DEBUG); + dol_syslog(get_class($this)."::addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit,pu_ht_devise=$pu_ht_devise,date_start_fill=$date_start_fill,date_end_fill=$date_end_fill,pa_ht=$pa_ht", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Check parameters @@ -795,6 +802,8 @@ class FactureRec extends CommonInvoice $sql.= ", total_ttc"; $sql.= ", date_start_fill"; $sql.= ", date_end_fill"; + $sql.= ", fk_product_fournisseur_price"; + $sql.= ", buy_price_ht"; $sql.= ", info_bits"; $sql.= ", rang"; $sql.= ", special_code"; @@ -824,6 +833,8 @@ class FactureRec extends CommonInvoice $sql.= ", ".price2num($total_ttc); $sql.= ", ".(int) $date_start_fill; $sql.= ", ".(int) $date_end_fill; + $sql.= ", ".($fk_fournprice > 0 ? $fk_fournprice : 'null'); + $sql.= ", ".($pa_ht ? price2num($pa_ht) : 0); $sql.= ", ".$info_bits; $sql.= ", ".$rang; $sql.= ", ".$special_code; @@ -877,9 +888,11 @@ class FactureRec extends CommonInvoice * @param int $notrigger disable line update trigger * @param int $date_start_fill 1=Flag to fill start date when generating invoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice + * @param int $fk_fournprice Id of origin supplier price + * @param int $pa_ht Price (without tax) of product when it was bought * @return int <0 if KO, Id of line if OK */ - public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0) + public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0, $fk_fournprice = null, $pa_ht = 0) { global $mysoc; @@ -894,16 +907,6 @@ class FactureRec extends CommonInvoice // Check parameters if ($type < 0) return -1; - $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); - - // Clean vat code - $vat_src_code=''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } - if ($this->brouillon) { // Clean parameters @@ -932,10 +935,20 @@ class FactureRec extends CommonInvoice $pu=$pu_ttc; } - // Calcul du total TTC et de la TVA pour la ligne a partir de - // qty, pu, remise_percent et txtva + // Calculate total with, without tax and tax from qty, pu, remise_percent and txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. + + $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); + + // Clean vat code + $vat_src_code=''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. + } + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; @@ -984,6 +997,8 @@ class FactureRec extends CommonInvoice $sql.= ", total_ttc='".price2num($total_ttc)."'"; $sql.= ", date_start_fill=".((int) $date_start_fill); $sql.= ", date_end_fill=".((int) $date_end_fill); + $sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : 'null'); + $sql.= ", buy_price_ht=".($pa_ht ? price2num($pa_ht) : 0); $sql.= ", info_bits=".$info_bits; $sql.= ", rang=".$rang; $sql.= ", special_code=".$special_code; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fa8af87ac29..e490fa57520 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -100,6 +100,20 @@ $permissionnote = $user->rights->facture->creer; // Used by the include of actio $permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php $permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php +$usercanread = $user->rights->facture->lire; +$usercancreate = $user->rights->facture->creer; +$usercanissuepayment = $user->rights->facture->paiement; +$usercandelete = $user->rights->facture->supprimer; +$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send); +$usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->reopen); +$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($usercancreate)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate))); + +$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); +$usercancreatemargin = $user->rights->margins->creer; +$usercanreadallmargin = $user->rights->margins->liretous; +$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; + $now = dol_now(); @@ -435,10 +449,12 @@ if (empty($reshook)) $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); $price_ht = GETPOST('price_ht'); - if (GETPOST('prod_entry_mode') == 'free') + $price_ht_devise = GETPOST('multicurrency_price_ht'); + $prod_entry_mode = GETPOST('prod_entry_mode', 'alpha'); + if ($prod_entry_mode == 'free') { $idprod=0; - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } else { @@ -466,11 +482,11 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) { + if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' + if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error ++; @@ -479,7 +495,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error ++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) { + if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors'); $error ++; } @@ -491,128 +507,97 @@ if (empty($reshook)) if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) { - $ret = $object->fetch($id); - if ($ret < 0) { - dol_print_error($db, $object->error); - exit(); - } - $ret = $object->fetch_thirdparty(); - - // Clean parameters - $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); - $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); - $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); - - // Define special_code for special lines - $special_code = 0; - // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices - - // Ecrase $pu par celui du produit - // Ecrase $desc par celui du produit - // Ecrase $tva_tx par celui du produit - // Ecrase $base_price_type par celui du produit - // Replaces $fk_unit with the product's - if (! empty($idprod)) - { - $prod = new Product($db); - $prod->fetch($idprod); - - $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - - // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); - if (empty($tva_tx)) $tva_npr=0; - - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; - - // We define price for product - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) - { - $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } + $ret = $object->fetch($id); + if ($ret < 0) { + dol_print_error($db, $object->error); + exit(); } - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + $ret = $object->fetch_thirdparty(); + + // Clean parameters + $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); + $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); + $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); + + // Define special_code for special lines + $special_code = 0; + // if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices + + // Ecrase $pu par celui du produit + // Ecrase $desc par celui du produit + // Ecrase $tva_tx par celui du produit + // Ecrase $base_price_type par celui du produit + // Replaces $fk_unit with the product's + if (! empty($idprod)) { - include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; + $prod = new Product($db); + $prod->fetch($idprod); - $prodcustprice = new Productcustomerprice($db); + $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); + // Update if prices fields are defined + $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); + $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); + if (empty($tva_tx)) $tva_npr=0; - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) + // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. + $pqp = (GETPOST('pbq', 'int') ? GETPOST('pbq', 'int') : 0); + + $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); + + $pu_ht = $datapriceofproduct['pu_ht']; + $pu_ttc = $datapriceofproduct['pu_ttc']; + $price_min = $datapriceofproduct['price_min']; + $price_base_type = $datapriceofproduct['price_base_type']; + $tva_tx = $datapriceofproduct['tva_tx']; + $tva_npr = $datapriceofproduct['tva_npr']; + + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); + $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + + // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? + if (! empty($price_ht)) { - if (count($prodcustprice->lines) > 0) + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + } + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). + elseif ($tmpvat != $tmpprodvat) + { + if ($price_base_type != 'HT') { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = $prodcustprice->lines[0]->tva_tx; - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; - $tva_npr = $prodcustprice->lines[0]->recuperableonly; - if (empty($tva_tx)) $tva_npr=0; + $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + } + else + { + $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } - } - $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); - $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); + $desc = ''; - // if price ht was forced (ie: from gui when calculated by margin rate and cost price). TODO Why this ? - if (! empty($price_ht)) - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } - // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tmpvat != $tmpprodvat) - { - if ($price_base_type != 'HT') + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) + $newlang = GETPOST('lang_id', 'aZ09'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; } else { - $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); + $desc = $prod->description; } - } - - $desc = ''; - - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id', 'aZ09')) - $newlang = GETPOST('lang_id', 'aZ09'); - if (empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - - $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; - } - else - { - $desc = $prod->description; - } $desc = dol_concatdesc($desc, $product_desc); @@ -620,12 +605,33 @@ if (empty($reshook)) if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { $tmptxt = '('; - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'alpha')) + $newlang = GETPOST('lang_id', 'alpha'); + if (empty($newlang)) + $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + if (! empty($prod->customcode)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) + $tmptxt .= ' - '; + if (! empty($prod->country_code)) + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } $tmptxt .= ')'; $desc = dol_concatdesc($desc, $tmptxt); } @@ -661,18 +667,18 @@ if (empty($reshook)) if ($tva_npr) $info_bits |= 0x01; - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) - { + if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill); + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); if ($result > 0) { + // Define output language and generate document /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { // Define output language @@ -741,7 +747,7 @@ if (empty($reshook)) } } - elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel', 'alpha')) + elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -855,7 +861,7 @@ if (empty($reshook)) // Update line if (! $error) { -$result = $object->updateline( + $result = $object->updateline( GETPOST('lineid'), $description, $pu_ht, @@ -877,7 +883,9 @@ $result = $object->updateline( $pu_ht_devise, 0, $date_start_fill, - $date_end_fill + $date_end_fill, + $fournprice, + $buyingprice ); if ($result >= 0) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a32c55a13e8..ab29a100894 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3913,7 +3913,7 @@ abstract class CommonObject // Define usemargins $usemargins=0; - if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','propal','commande'))) $usemargins=1; + if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element, array('facture','facturerec','propal','commande'))) $usemargins=1; $num = count($this->lines); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4a4febe65d3..bf46ecb9890 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -40,7 +40,7 @@ if (empty($object) || ! is_object($object)) { $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) { $usemargins=1; } @@ -55,7 +55,7 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -// Define colspan for button Add +// Define colspan for the button 'Add' $colspan = 3; // Columns: total ht + col edit + col delete if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index f4e5634fbc9..ddb737bbdd6 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -40,7 +40,7 @@ if (empty($object) || ! is_object($object)) $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) $usemargins=1; +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) $usemargins=1; global $forceall, $senderissupplier, $inputalsopricewithtax; if (empty($dateSelector)) $dateSelector=0; @@ -49,11 +49,10 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; -// Define colspan for button Add +// Define colspan for the button 'Add' $colspan = 3; // Col total ht + col edit + col delete if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc -if (in_array($object->element, array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button -if (empty($user->rights->margins->creer)) $colspan++; +if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; ?> @@ -252,7 +251,7 @@ $coldisplay=0; } ?> - + - - global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> - - global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> - - + if (!empty($user->rights->margins->creer)) { ?> + + + global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) { ?> + + global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) {?> + + special_code == 3) { ?> @@ -300,51 +298,51 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> - + + + - - + if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> + + + + 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> - - - - - - - + + - - + + if($action == 'selectlines'){ ?> + From ec922d3d1714c710d1e6a5e390ddb11868002152 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 14:54:09 +0200 Subject: [PATCH 25/46] Add CONTRACT_HIDE_PLANNED_DATE_ON_PDF and CONTRACT_HIDE_REAL_DATE_ON_PDF --- .../modules/contract/doc/pdf_strato.modules.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 03dae9cbe5e..97fedf45808 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -353,11 +353,17 @@ class pdf_strato extends ModelePDFContract $desc=dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines) $txt=''; $txt.=$outputlangs->transnoentities("Quantity").' : '.$objectligne->qty.' - '.$outputlangs->transnoentities("UnitPrice").' : '.price($objectligne->subprice).''; // Desc (not empty for free lines) - $txt.='
'; - $txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; - $txt.='
'; - $txt.=$outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; - if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; + if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) + { + $txt.='
'; + $txt.=$outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee.''; + } + if (empty($conf->global->CONTRACT_HIDE_REAL_DATE_ON_PDF)) + { + $txt.='
'; + $txt.=$outputlangs->transnoentities("DateStartRealShort")." : ".$daters.''; + if ($objectligne->date_cloture) $txt.=" - ".$outputlangs->transnoentities("DateEndRealShort")." : ''".$datere.''; + } $pdf->startTransaction(); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); From 321544b3fae3aa9bff703cb761166c5c39238682 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 15:25:39 +0200 Subject: [PATCH 26/46] Fix phpcs --- htdocs/compta/facture/fiche-rec.php | 401 ++++++++++++++++++---------- 1 file changed, 264 insertions(+), 137 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index e490fa57520..867b4e8df30 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -281,6 +281,141 @@ if (empty($reshook)) // Set mode elseif ($action == 'setmode' && $user->rights->facture->creer) { + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt = '('; + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha'); + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } + $tmptxt .= ')'; + $desc = dol_concatdesc($desc, $tmptxt); + } + + $type = $prod->type; + $fk_unit = $prod->fk_unit; + } + else + { + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); + $tva_tx = str_replace('*', '', $tva_tx); + if (empty($tva_tx)) $tva_npr=0; + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + $desc = $product_desc; + $type = GETPOST('type'); + $fk_unit= GETPOST('units', 'alpha'); + } + + $date_start_fill = GETPOST('date_start_fill', 'int'); + $date_end_fill = GETPOST('date_end_fill', 'int'); + + // Margin + $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); + $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value + + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + + $info_bits = 0; + if ($tva_npr) + $info_bits |= 0x01; + + if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); + setEventMessages($mesg, null, 'errors'); + } + else + { + // Insert line + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); + + if ($result > 0) + { + // Define output language and generate document + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + }*/ + $object->fetch($object->id); // Reload lines + + unset($_POST['prod_entry_mode']); + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['date_start_fill']); + unset($_POST['date_end_fill']); + + unset($_POST['situations']); + unset($_POST['progress']); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + + $action = ''; + } $result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } // Set project @@ -599,151 +734,143 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc); + $desc = dol_concatdesc($desc, $product_desc); - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt = '('; - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id', 'alpha')) - $newlang = GETPOST('lang_id', 'alpha'); - if (empty($newlang)) - $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('products'); - } - if (! empty($prod->customcode)) - $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); - } else { - if (! empty($prod->customcode)) - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) - $tmptxt .= ' - '; - if (! empty($prod->country_code)) - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + // Add custom code and origin country into description + if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) + { + $tmptxt = '('; + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha'); + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); + } else { + if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; + if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; + if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); + } + $tmptxt .= ')'; + $desc = dol_concatdesc($desc, $tmptxt); } - $tmptxt .= ')'; - $desc = dol_concatdesc($desc, $tmptxt); - } - $type = $prod->type; - $fk_unit = $prod->fk_unit; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); - $tva_tx = str_replace('*', '', $tva_tx); - if (empty($tva_tx)) $tva_npr=0; - $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - $desc = $product_desc; - $type = GETPOST('type'); - $fk_unit= GETPOST('units', 'alpha'); - } - - $date_start_fill = GETPOST('date_start_fill', 'int'); - $date_end_fill = GETPOST('date_end_fill', 'int'); - - // Margin - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value - - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - - $info_bits = 0; - if ($tva_npr) - $info_bits |= 0x01; - - if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessages($mesg, null, 'errors'); - } - else - { - // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); - - if ($result > 0) - { - // Define output language and generate document - /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - }*/ - $object->fetch($object->id); // Reload lines - - unset($_POST['prod_entry_mode']); - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['multicurrency_price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - unset($_POST['np_marginRate']); - unset($_POST['np_markRate']); - unset($_POST['dp_desc']); - unset($_POST['idprod']); - unset($_POST['units']); - - unset($_POST['date_starthour']); - unset($_POST['date_startmin']); - unset($_POST['date_startsec']); - unset($_POST['date_startday']); - unset($_POST['date_startmonth']); - unset($_POST['date_startyear']); - unset($_POST['date_endhour']); - unset($_POST['date_endmin']); - unset($_POST['date_endsec']); - unset($_POST['date_endday']); - unset($_POST['date_endmonth']); - unset($_POST['date_endyear']); - - unset($_POST['date_start_fill']); - unset($_POST['date_end_fill']); - - unset($_POST['situations']); - unset($_POST['progress']); + $type = $prod->type; + $fk_unit = $prod->fk_unit; } else { - setEventMessages($object->error, $object->errors, 'errors'); + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); + $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); + $tva_tx = str_replace('*', '', $tva_tx); + if (empty($tva_tx)) $tva_npr=0; + $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); + $desc = $product_desc; + $type = GETPOST('type'); + $fk_unit= GETPOST('units', 'alpha'); } - $action = ''; - } + $date_start_fill = GETPOST('date_start_fill', 'int'); + $date_end_fill = GETPOST('date_end_fill', 'int'); + + // Margin + $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); + $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value + + // Local Taxes + $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); + $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); + + $info_bits = 0; + if ($tva_npr) + $info_bits |= 0x01; + + if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { + $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); + setEventMessages($mesg, null, 'errors'); + } + else + { + // Insert line + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); + + if ($result > 0) + { + // Define output language and generate document + /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model=$object->modelpdf; + $ret = $object->fetch($id); // Reload to get new records + + $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + }*/ + $object->fetch($object->id); // Reload lines + + unset($_POST['prod_entry_mode']); + + unset($_POST['qty']); + unset($_POST['type']); + unset($_POST['remise_percent']); + unset($_POST['price_ht']); + unset($_POST['multicurrency_price_ht']); + unset($_POST['price_ttc']); + unset($_POST['tva_tx']); + unset($_POST['product_ref']); + unset($_POST['product_label']); + unset($_POST['product_desc']); + unset($_POST['fournprice']); + unset($_POST['buying_price']); + unset($_POST['np_marginRate']); + unset($_POST['np_markRate']); + unset($_POST['dp_desc']); + unset($_POST['idprod']); + unset($_POST['units']); + + unset($_POST['date_starthour']); + unset($_POST['date_startmin']); + unset($_POST['date_startsec']); + unset($_POST['date_startday']); + unset($_POST['date_startmonth']); + unset($_POST['date_startyear']); + unset($_POST['date_endhour']); + unset($_POST['date_endmin']); + unset($_POST['date_endsec']); + unset($_POST['date_endday']); + unset($_POST['date_endmonth']); + unset($_POST['date_endyear']); + + unset($_POST['date_start_fill']); + unset($_POST['date_end_fill']); + + unset($_POST['situations']); + unset($_POST['progress']); + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + + $action = ''; + } } } From 2a2fcf6784843606297ab573cc86edf3425ed158 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 May 2019 15:38:33 +0200 Subject: [PATCH 27/46] FIX only profid1 to 4 were editable for pdf option to show. Not 5 and 6. --- htdocs/admin/pdf.php | 180 ++++++++++--------------------------------- 1 file changed, 40 insertions(+), 140 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 37c836043a0..70fa3dc38b7 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -61,6 +61,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"],'chaine',0,'', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"],'chaine',0,'', $conf->entity); + dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"],'chaine',0,'', $conf->entity); @@ -177,76 +179,25 @@ if ($action == 'edit') // Edit print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1); print ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) + // Show prof id in address into pdf + for($i=1; $i<=6; $i++) { - $pid1=$langs->transcountry("ProfId1",$mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print '
'; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2",$mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3",$mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4",$mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''; + if (! $noCountryCode) + { + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; + } + else + { + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } + if ($pid) + { + print ''; + } } print '
">
"> diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 09bedf2ec53..53c55a8163b 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -48,7 +48,7 @@ if (empty($object) || ! is_object($object)) global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; $usemargins=0; -if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','propal','commande'))) $usemargins=1; +if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element, array('facture','facturerec','propal','commande'))) $usemargins=1; if (empty($dateSelector)) $dateSelector=0; if (empty($forceall)) $forceall=0; @@ -253,19 +253,17 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id)) { - ?> - - rights->margins->creer)) { ?> -
pa_ht); ?>pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>marque_tx, null, null, null, null, $rounding).'%'; ?>pa_ht); ?>pa_ht == 0)?'n/a':price($line->marge_tx, null, null, null, null, $rounding).'%'); ?>marque_tx, null, null, null, null, $rounding).'%'; ?>trans('Option'); ?> - info_bits & 2) == 2 || ! empty($disableedit)) { ?> - - id.'#line_'.$line->id; ?>"> - - - - + info_bits & 2) == 2 || ! empty($disableedit)) { ?> + + id.'#line_'.$line->id; ?>"> + + + + + fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id . '">'; + print img_delete(); + print ''; + } + ?> + fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation - print 'id . '">'; - print img_delete(); - print ''; - } - ?> - + 0) { ?> + id; ?>"> + + + + + id; ?>"> + + + + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>> - 0) { ?> - id; ?>"> - - - - - id; ?>"> - - - - browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>>
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode); - print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant)?$conf->global->$keyforconstant:0, 1, $noCountryCode); + print '
'; @@ -419,77 +370,26 @@ else // Show print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1); print ''; - // Show prof id 1 in address into pdf - - if (! $noCountryCode) - { - $pid1=$langs->transcountry("ProfId1",$mysoc->country_code); - if ($pid1 == '-') $pid1=false; - } - else - { - $pid1 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid1) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; - print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1); - print ''; - } - - // Show prof id 2 in address into pdf - - if (! $noCountryCode) - { - $pid2=$langs->transcountry("ProfId2",$mysoc->country_code); - if ($pid2 == '-') $pid2=false; - } - else - { - $pid2 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid2) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; - print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1); - print ''; - } - - // Show prof id 3 in address into pdf - - if (! $noCountryCode) - { - $pid3=$langs->transcountry("ProfId3",$mysoc->country_code); - if ($pid3 == '-') $pid3=false; - } - else - { - $pid3 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid3) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; - print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1); - print ''; - } - - // Show prof id 4 in address into pdf - - if (! $noCountryCode) - { - $pid4=$langs->transcountry("ProfId4",$mysoc->country_code); - if ($pid4 == '-') $pid4=false; - } - else - { - $pid4 = img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; - } - if ($pid4) - { - print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; - print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1); - print ''; - } + // Show prof id in address into pdf + for ($i=1; $i<=6; $i++) + { + if (! $noCountryCode) + { + $pid=$langs->transcountry("ProfId".$i, $mysoc->country_code); + if ($pid == '-') $pid=false; + } + else + { + $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } + if ($pid) + { + print ''.$langs->trans("ShowProfIdInAddress").' - '.$pid.''; + $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; + print yn($conf->global->$keyforconstant, 1); + print ''; + } + } print ''."\n"; print '
'; From 6365c7cd00b0a0c05d5fbc7685228395ba2a504a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 May 2019 12:17:07 +0200 Subject: [PATCH 28/46] Bad cut and paste --- htdocs/compta/facture/fiche-rec.php | 135 ---------------------------- 1 file changed, 135 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 867b4e8df30..5eedb9b5740 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -281,141 +281,6 @@ if (empty($reshook)) // Set mode elseif ($action == 'setmode' && $user->rights->facture->creer) { - // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) - { - $tmptxt = '('; - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $outputlangs = $langs; - $newlang = ''; - if (empty($newlang) && GETPOST('lang_id', 'alpha')) $newlang = GETPOST('lang_id', 'alpha'); - if (empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('products'); - } - if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; - if (! empty($prod->country_code)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); - } else { - if (! empty($prod->customcode)) $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; - if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt .= ' - '; - if (! empty($prod->country_code)) $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); - } - $tmptxt .= ')'; - $desc = dol_concatdesc($desc, $tmptxt); - } - - $type = $prod->type; - $fk_unit = $prod->fk_unit; - } - else - { - $pu_ht = price2num($price_ht, 'MU'); - $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); - $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); - $tva_tx = str_replace('*', '', $tva_tx); - if (empty($tva_tx)) $tva_npr=0; - $label = (GETPOST('product_label') ? GETPOST('product_label') : ''); - $desc = $product_desc; - $type = GETPOST('type'); - $fk_unit= GETPOST('units', 'alpha'); - } - - $date_start_fill = GETPOST('date_start_fill', 'int'); - $date_end_fill = GETPOST('date_end_fill', 'int'); - - // Margin - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value - - // Local Taxes - $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); - $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); - - $info_bits = 0; - if ($tva_npr) - $info_bits |= 0x01; - - if ($usercanproductignorepricemin && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { - $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); - setEventMessages($mesg, null, 'errors'); - } - else - { - // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); - - if ($result > 0) - { - // Define output language and generate document - /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - { - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $model=$object->modelpdf; - $ret = $object->fetch($id); // Reload to get new records - - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - }*/ - $object->fetch($object->id); // Reload lines - - unset($_POST['prod_entry_mode']); - - unset($_POST['qty']); - unset($_POST['type']); - unset($_POST['remise_percent']); - unset($_POST['price_ht']); - unset($_POST['multicurrency_price_ht']); - unset($_POST['price_ttc']); - unset($_POST['tva_tx']); - unset($_POST['product_ref']); - unset($_POST['product_label']); - unset($_POST['product_desc']); - unset($_POST['fournprice']); - unset($_POST['buying_price']); - unset($_POST['np_marginRate']); - unset($_POST['np_markRate']); - unset($_POST['dp_desc']); - unset($_POST['idprod']); - unset($_POST['units']); - - unset($_POST['date_starthour']); - unset($_POST['date_startmin']); - unset($_POST['date_startsec']); - unset($_POST['date_startday']); - unset($_POST['date_startmonth']); - unset($_POST['date_startyear']); - unset($_POST['date_endhour']); - unset($_POST['date_endmin']); - unset($_POST['date_endsec']); - unset($_POST['date_endday']); - unset($_POST['date_endmonth']); - unset($_POST['date_endyear']); - - unset($_POST['date_start_fill']); - unset($_POST['date_end_fill']); - - unset($_POST['situations']); - unset($_POST['progress']); - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - - $action = ''; - } $result=$object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } // Set project From 54441a1abda3ef245ec5ea202e81cb251c81033c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 May 2019 12:36:18 +0200 Subject: [PATCH 29/46] Fix css --- htdocs/main.inc.php | 6 +++--- htdocs/theme/eldy/dropdown.inc.php | 6 +++--- htdocs/theme/md/dropdown.inc.php | 18 ++++++++++++++++++ htdocs/theme/md/style.css.php | 6 ++++-- 4 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 htdocs/theme/md/dropdown.inc.php diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b0036b01ed4..a7d0669db22 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1811,11 +1811,11 @@ function top_menu_user(User $user, Translate $langs) $btnUser = '