From 1a9e98cda9563b42f1f7e7d1faf215d165ff34bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 8 Aug 2014 19:30:21 +0200 Subject: [PATCH 01/16] Fix categories bug When using the string type, $typeid == 1 matched all strings making other conditions ineffective. --- htdocs/categories/class/categorie.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b7e2ed030ab..1788f2e1ac6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1123,11 +1123,11 @@ class Categorie $cats = array(); $table=''; $type=''; - if ($typeid == 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } - else if ($typeid == 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } - else if ($typeid == 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } - else if ($typeid == 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($typeid == 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + if ($typeid === 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } + else if ($typeid === 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } + else if ($typeid === 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } + else if ($typeid === 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } + else if ($typeid === 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; From 739d309a0d3e38becd20c28bf07e41078fcf49c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 14 Aug 2014 08:46:51 +0200 Subject: [PATCH 02/16] Updated category fix Categories ID can be passed as strings PSR code formatting --- htdocs/categories/class/categorie.class.php | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 1788f2e1ac6..60b738ea8ba 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1122,12 +1122,29 @@ class Categorie { $cats = array(); - $table=''; $type=''; - if ($typeid === 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } - else if ($typeid === 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } - else if ($typeid === 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } - else if ($typeid === 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($typeid === 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + $table = ''; + $type = ''; + if ($typeid === 0 || $typeid === '0' || $typeid == 'product') { + $typeid = 0; + $table = 'product'; + $type = 'product'; + } else if ($typeid === 1 || $typeid === '1' || $typeid == 'supplier') { + $typeid = 1; + $table = 'societe'; + $type = 'fournisseur'; + } else if ($typeid === 2 || $typeid === '2' || $typeid == 'customer') { + $typeid = 2; + $table = 'societe'; + $type = 'societe'; + } else if ($typeid === 3 || $typeid === '3' || $typeid == 'member') { + $typeid = 3; + $table = 'member'; + $type = 'member'; + } else if ($typeid === 4 || $typeid === '4' || $typeid == 'contact') { + $typeid = 4; + $table = 'socpeople'; + $type = 'contact'; + } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; From 67b308cb2549550777d76551800db94c4cf2b3d0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:14:41 +0200 Subject: [PATCH 03/16] Fix: list event view lost type event filter --- ChangeLog | 1 + htdocs/comm/action/listactions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80696a3d7a6..9a40ed7e9ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Fix: Missing include files.lib.php in some pages to use dol_delete_recursive. Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref. Fix: [ bug #1553 ] Saving User displays setup removes menu. Fix: [ bug #1544 ] Can remove date from invoice +Fix: list event view lost type event filter ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index ebe68fa3328..8b945a16670 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -211,7 +211,7 @@ if ($resql) $head = calendars_prepare_head(''); dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1,$actioncode); dol_fiche_end(); // Add link to show birthdays From 911aca399ddad5ecc9ebe7100eff5f89d31687f4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:30:35 +0200 Subject: [PATCH 04/16] save code event --- ChangeLog | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9a40ed7e9ab..3b4def098c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old Fix: [ bug #1553 ] Saving User displays setup removes menu. Fix: [ bug #1544 ] Can remove date from invoice Fix: list event view lost type event filter +Fix: Add code save on create event ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 10082062d06..b51b33e5b66 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -140,6 +140,7 @@ class ActionComm extends CommonObject if ($result > 0) { $this->type_id=$cactioncomm->id; + $this->code=$cactioncomm->code; } else if ($result == 0) { From bd99f3943df513830407cc98577fcaff635ae91e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:31:40 +0200 Subject: [PATCH 05/16] Payment VAT :: Add control on field required --- htdocs/compta/tva/fiche.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 65c4285d7d1..a4a5a8831c4 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $tva->label=GETPOST("label"); $tva->note=GETPOST("note"); + if (empty($tva->datev)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors'); + $error++; + } + if (empty($tva->datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors'); + $error++; + } if (empty($tva->type_payment) || $tva->type_payment < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); From 4e05afdd6682d7fcebc4958fb8d6c0c87588ca61 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:32:31 +0200 Subject: [PATCH 06/16] Payment Salaries :: Add field required & control on it --- htdocs/compta/salaries/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index ae74344ccf8..c46f83dd6fb 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $sal->num_payment=GETPOST("num_payment"); $sal->fk_user_creat=$user->id; - if (empty($datep) || empty($datesp) || empty($dateep)) + if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); $error++; @@ -219,7 +219,7 @@ if ($action == 'create') print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print ''; From cd00ec29bf6f307c74d301599f4fcbb3ce757ef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 19:00:28 +0200 Subject: [PATCH 07/16] Fix: Dictionnary with one n Conflicts: htdocs/expedition/fiche.php --- htdocs/expedition/fiche.php | 4 ++-- htdocs/fichinter/fiche.php | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 9a52ce47788..f676c1b2138 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -698,7 +698,7 @@ if ($action == 'create') print ''; $expe->fetch_delivery_methods(); print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print "\n"; // Tracking number @@ -1262,7 +1262,7 @@ else if ($id || $ref) print ''; $object->fetch_delivery_methods(); print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; print ''; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index fcd03755136..bf0583ce0ba 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -63,6 +63,7 @@ $confirm = GETPOST('confirm','alpha'); $mesg = GETPOST('msg','alpha'); $origin=GETPOST('origin','alpha'); $originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility +$note_public = GETPOST('note_public'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -919,8 +920,8 @@ if ($action == 'create') $soc = $objectsrc->client; - $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); - $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private'))); + $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public')); // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1,'external',1); @@ -928,8 +929,6 @@ if ($action == 'create') } else { $projectid = GETPOST('projectid','int'); - $note_private = ''; - $note_public = ''; } if (! $conf->global->FICHEINTER_ADDON) @@ -966,7 +965,7 @@ if ($action == 'create') // Description (must be a textarea and not html must be allowed (used in list view) print ''.$langs->trans("Description").''; print ''; - print ''; + print ''; print ''; // Project From 643fc6c61f8ae7ea4d726be32a2a68ec54f185c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 19:03:48 +0200 Subject: [PATCH 08/16] Fix: Bad use of fetch_lines Conflicts: htdocs/comm/propal.php htdocs/contrat/fiche.php htdocs/opensurvey/class/opensurveysondage.class.php --- htdocs/commande/fiche.php | 17 +++++++---- htdocs/commande/orderstoinvoice.php | 10 +++++-- htdocs/compta/facture.php | 6 +++- htdocs/contrat/fiche.php | 28 +++++++++++-------- htdocs/expedition/fiche.php | 2 -- htdocs/fichinter/class/fichinter.class.php | 4 +-- htdocs/fichinter/fiche.php | 12 ++++++-- htdocs/fourn/facture/fiche.php | 6 +++- htdocs/livraison/class/livraison.class.php | 2 +- htdocs/livraison/fiche.php | 11 ++++---- .../class/opensurveysondage.class.php | 4 +-- htdocs/opensurvey/public/studs.php | 2 +- htdocs/opensurvey/results.php | 2 +- 13 files changed, 68 insertions(+), 38 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f6df313506..25c8d068ae1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -269,10 +269,12 @@ else if ($action == 'add' && $user->rights->commande->creer) { if ($ret < 0) $error ++; - if (! $error) { + if (! $error) + { $object_id = $object->create($user); - if ($object_id > 0) { + if ($object_id > 0) + { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); @@ -280,15 +282,20 @@ else if ($action == 'add' && $user->rights->commande->creer) { dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines"); $result = $srcobject->fetch($object->origin_id); - if ($result > 0) { + if ($result > 0) + { $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject, 'fetch_lines')) - $lines = $srcobject->fetch_lines(); + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line = 0; $num = count($lines); - for($i = 0; $i < $num; $i ++) { + for($i = 0; $i < $num; $i ++) + { $label = (! empty($lines [$i]->label) ? $lines [$i]->label : ''); $desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle); $product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bdb96718dfa..5332690e40b 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -97,7 +97,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - + $langs->load('bills'); $langs->load('products'); $langs->load('main'); @@ -213,13 +213,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $result=$objectsrc->fetch($orders_id[$ii]); if ($result > 0) { - if ($closeOrders) + if ($closeOrders) { $objectsrc->classifyBilled(); $objectsrc->setStatut(3); } $lines = $objectsrc->lines; - if (empty($lines) && method_exists($objectsrc,'fetch_lines')) $lines = $objectsrc->fetch_lines(); + if (empty($lines) && method_exists($objectsrc, 'fetch_lines')) + { + $objectsrc->fetch_lines(); + $lines = $objectsrc->lines; + } $fk_parent_line=0; $num=count($lines); for ($i=0;$i<$num;$i++) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8138c56450e..0e237af632c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -924,7 +924,11 @@ else if ($action == 'add' && $user->rights->facture->creer) if ($result > 0) { $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject, 'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 7bcd7fcbc8d..38a2b3f1095 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -250,7 +250,11 @@ if ($action == 'add' && $user->rights->contrat->creer) { $srcobject->fetch_thirdparty(); $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject,'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); @@ -337,10 +341,10 @@ if ($action == 'add' && $user->rights->contrat->creer) } else { - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - + $result = $object->create($user); if ($result > 0) { @@ -715,7 +719,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $error ++; if (! $error) { - + $result = $object->insertExtraFields(); if ($result < 0) { $error ++; @@ -948,7 +952,7 @@ if ($action == 'create') // Other attributes $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + // Other attributes if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields, 'edit'); @@ -1112,7 +1116,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + $res = $object->fetch_optionals($object->id, $extralabels); if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach ($extrafields->attribute_label as $key => $label) { @@ -1132,16 +1136,16 @@ else if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { $value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]); } - + if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) { print '
'; print ''; print ''; print ''; print ''; - + print $extrafields->showInputField($key, $value); - + print ''; print '
'; } else { @@ -1153,9 +1157,9 @@ else } } } - - - + + + print ""; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f676c1b2138..c11c1d549a9 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -112,7 +112,6 @@ if ($action == 'add') $classname = ucfirst($object->origin); $objectsrc = new $classname($db); $objectsrc->fetch($object->origin_id); - //$object->fetch_lines(); $object->socid = $objectsrc->socid; $object->ref_customer = $objectsrc->ref_client; @@ -717,7 +716,6 @@ if ($action == 'create') * Lignes de commandes */ - //$lines = $object->fetch_lines(1); $numAsked = count($object->lines); print '