From e8addcb8ba2df0c292f47cd14fe2b6fdcb9e968f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 12:25:21 +0100 Subject: [PATCH 1/8] Fixed: [ bug #1756 ] PHP error while removing an import profile --- htdocs/core/tpl/extrafields_view.tpl.php | 15 ++++++++------- htdocs/imports/class/import.class.php | 7 ++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index ad2fa068757..7f0115b83bc 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -33,13 +33,13 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) { if ($action == 'edit_extras') { - $value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]); + $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); } else { - $value = $object->array_options ["options_" . $key]; + $value = $object->array_options["options_" . $key]; } - if ($extrafields->attribute_type [$key] == 'separate') + if ($extrafields->attribute_type[$key] == 'separate') { print $extrafields->showSeparator($key); } @@ -47,7 +47,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) { print ''; print 'attribute_required [$key])) print ' class="fieldrequired"'; + //var_dump($action);exit; + if ((! empty($action) && $action != 'view') && ! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"'; print '>' . $label . ''; //TODO Improve element and rights detection @@ -67,8 +68,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print ''; @@ -925,7 +925,7 @@ if ($id > 0) $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); } } - print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); + print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': id]['transparency']?' checked="checked"':'').'">'.$langs->trans("Busy"); print ''; From a111c4765c250c9008e16de5d1c5ab2f46e3800d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 18:00:14 +0100 Subject: [PATCH 7/8] Fixed: Filter lost with navigation --- htdocs/fichinter/list.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9030cd9c4ac..851077b510f 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -121,7 +121,13 @@ if ($result) { $num = $db->num_rows($result); - $urlparam="&socid=$socid"; + $urlparam=''; + if ($socid) $urlparam.="&socid=".$socid; + if ($search_ref) $urlparam.="&search_ref=".urlencode($search_ref); + if ($search_company) $urlparam.="&search_company=".urlencode($search_company); + if ($search_desc) $urlparam.="&search_desc=".urlencode($search_desc); + if ($search_status != '' && $search_status > -1) $urlparam.="&search_status=".urlencode($search_status); + print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); print ''."\n"; @@ -193,7 +199,7 @@ if ($result) print ''; } print ''; - + print ''; print "\n"; @@ -207,7 +213,7 @@ if ($result) print ''; print ''; } - + print '
'; // Convert date into timestamp format - 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 (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]); } //TODO Improve element and rights detection @@ -77,7 +78,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) print '
'; print ''; print ''; - print ''; + print ''; print ''; print $extrafields->showInputField($key, $value); diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 58a1bf3e931..b846d158227 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -22,8 +22,7 @@ */ /** - * \class Import - * \brief Class to manage imports + * Class to manage imports */ class Import { @@ -313,10 +312,12 @@ class Import { if (! $notrigger) { + /* Not used. This is not a business object. To convert it we must herit from CommonObject // Call trigger $result=$this->call_trigger('IMPORT_DELETE',$user); - if ($result < 0) $error++; + if ($result < 0) $error++; // End call triggers + */ } } From acf7b9f130bb1e45ce34d819615afc4224572c97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 12:59:34 +0100 Subject: [PATCH 2/8] Because this is a legal issue (OPCA), i added the hidden constant for 3.7: WORKFLOW_PROPAL_CAN_CLASSIFY_BILLED_WITHOUT_INVOICES => Button "Classified Billed" is visible on proposal even if there is no invoice linked to proposal. Fixed: Also fix get list of invoice that report too many data. --- htdocs/comm/propal.php | 8 +++++--- htdocs/comm/propal/class/propal.class.php | 9 ++++++--- htdocs/core/class/commonobject.class.php | 2 +- htdocs/langs/en_US/workflow.lang | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 0ac5d78aead..0143e20ba77 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2109,12 +2109,14 @@ if ($action == 'create') // Create an invoice and classify billed if ($object->statut == 2) { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { + if (! empty($conf->facture->enabled) && $user->rights->facture->creer) + { print ''; } - $arraypropal = $object->getInvoiceArrayList(); - if (is_array($arraypropal) && count($arraypropal) > 0) { + $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); + if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES)) + { print ''; } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fb9d5257d49..be22043e4b5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1987,16 +1987,19 @@ class Propal extends CommonObject { $linkedInvoices[] = $objectid[$i]; } - // Cas des factures liees via la commande + // Cas des factures liees par un autre objet (ex: commande) else - { + { $this->fetchObjectLinked($objectid[$i],$objecttype); foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) { $numj=count($subobjectid); for ($j=0;$j<$numj;$j++) { - $linkedInvoices[] = $subobjectid[$j]; + if ($subobjecttype == 'facture') + { + $linkedInvoices[] = $subobjectid[$j]; + } } } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1a9195e069d..54c7b9d860d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1851,7 +1851,7 @@ abstract class CommonObject } } else - { + { $sql.= "(fk_source = '".$sourceid."' AND sourcetype = '".$sourcetype."')"; $sql.= " ".$clause." (fk_target = '".$targetid."' AND targettype = '".$targettype."')"; } diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index d4ecf42b997..e08c88a9170 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - admin WorkflowSetup=Workflow module setup -WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can enabled automatic actions that you are interesting in. +WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is opened (you make thing in order you want). You can activate the automatic actions that you are interesting in. ThereIsNoWorkflowToModify=There is no workflow you can modify for module you have activated. descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Create a customer order automatically after a commercial proposal is signed descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Create a customer invoice automatically after a commercial proposal is signed From aa618d481b00b683ede0184fc8f54b31e87921bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 13:07:16 +0100 Subject: [PATCH 3/8] Fixed: [ bug #1690 ] Sorting on salary table triggers SQL errors --- htdocs/compta/charges/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index dd6455a3932..ca03e11bcba 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -102,7 +102,7 @@ if ($conf->salaries->enabled) // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire $sql.= " AND s.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if (preg_match('/^s/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^s\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); $result = $db->query($sql); if ($result) @@ -204,7 +204,7 @@ if ($conf->tax->enabled) $sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')"; $sql .= ")"; } - if (! preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^cs\./',$sortfield) || preg_match('/^c\./',$sortfield) || preg_match('/^pc\./',$sortfield) || preg_match('/^pct\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); //$sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -295,7 +295,7 @@ if ($conf->tax->enabled) // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire $sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder); + if (preg_match('/^pv\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder); $result = $db->query($sql); if ($result) From 2b4edd999670eadc3104d0496ed2973d553b73e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 13:21:40 +0100 Subject: [PATCH 4/8] Fix: [ bug #1687 ] The ref filter searches on ref and rowid in supplier invoices list --- htdocs/fourn/facture/list.php | 2 +- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 357df92a4eb..2a01602eadc 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -150,7 +150,7 @@ if ($filter && $filter != -1) // GETPOST('filtre') may be a string if ($search_ref) { - if (is_numeric($search_ref)) $sql .= natural_search(array('fac.rowid', 'fac.ref'), $search_ref);// For backward compatibility + if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref); else $sql .= natural_search('fac.ref', $search_ref); } if (search_ref_supplier) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index e2c586de47f..2281793929f 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1136,6 +1136,8 @@ ALTER TABLE llx_facture_fourn MODIFY COLUMN ref VARCHAR(255); ALTER TABLE llx_facture_fourn MODIFY COLUMN ref_ext VARCHAR(255); ALTER TABLE llx_facture_fourn MODIFY COLUMN ref_supplier VARCHAR(255); +UPDATE llx_facture_fourn SET ref = rowid WHERE ref IS NULL or ref = ''; + ALTER TABLE llx_facture_rec ADD COLUMN revenuestamp double(24,8) DEFAULT 0; ALTER TABLE llx_facturedet_rec MODIFY COLUMN tva_tx double(6,3); ALTER TABLE llx_facturedet_rec ADD COLUMN fk_contract_line integer NULL; From 034455fc2d0e55724ae6d1ad2e80f35d04e9ac5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 23 Dec 2014 16:37:53 +0100 Subject: [PATCH 5/8] Fix: [ bug #1722 ] Missing link in homepage project's box --- htdocs/core/boxes/box_project.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 62ed89dd65b..57863100999 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Marcos García * 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 @@ -45,7 +46,7 @@ class box_project extends ModeleBoxes $langs->load("boxes"); $langs->load("projects"); - $this->boxlabel="Projet"; + $this->boxlabel="Projects"; } /** @@ -63,13 +64,8 @@ class box_project extends ModeleBoxes $totalMnt = 0; $totalnb = 0; $totalnbTask=0; - include_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); - require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); - $projectstatic=new Project($db); - - - $textHead = $langs->trans("Projet"); + $textHead = $langs->trans("Projects"); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); // list the summary of the orders @@ -91,14 +87,15 @@ class box_project extends ModeleBoxes $i = 0; while ($i < $num) { - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projectpub'); - $objp = $db->fetch_object($result); - $projectstatic->fetch($objp->rowid); + + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', + 'logo' => 'object_project', + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid); $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' =>$projectstatic->getNomUrl(1) - ); + 'text' => $objp->ref, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', 'text' => $objp->title From b7dbb1e9cd1e7f8926d7c8ad5ff525d59f5d148b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Dec 2014 17:46:30 +0100 Subject: [PATCH 6/8] Fixed: Do not show disabled user when creating a new event. --- htdocs/comm/action/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8a2c602a3f0..180dbcddb30 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -678,7 +678,7 @@ if ($action == 'create') $listofuserid=dol_json_decode($_SESSION['assignedtouser'], true); } } - print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'assignedtouser',1); + print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0'); if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': '.$langs->trans("Busy"); print '
'.convertSecondToTime($objp->duree).''.$interventionstatic->LibStatut($objp->fk_statut,5).' 
'.convertSecondToTime($total).'  
'; print "\n"; $db->free($result); From b68276637bd2adfe7192546ffebfcb1688b86c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 24 Dec 2014 14:31:17 +0100 Subject: [PATCH 8/8] Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks Conflicts: htdocs/core/lib/functions2.lib.php --- ChangeLog | 1 + htdocs/core/lib/functions2.lib.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5ec86761300..7b5447aed23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -181,6 +181,7 @@ Dolibarr better: - Fix: Show sender Country on PDF docs when sender Country <> receiver Country - Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS - Fix: [ bug #1749 ] Undefined $mailchimp +- Fix: [ bug #1736 ] Failing supplier Elephant numeration module with some masks ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 246af863d12..219d0074813 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -784,9 +784,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $sql = "SELECT MAX(".$sqlstring.") as val"; $sql.= " FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE ".$field." LIKE '".$maskLike."'"; - $sql.= " AND ".$field." NOT LIKE '%PROV%'"; + $sql.= " AND ".$field." NOT LIKE '(PROV%)'"; if ($bentityon) // only if entity enable $sql.= " AND entity IN (".getEntity($table, 1).")"; + if ($where) $sql.=$where; if ($sqlwhere) $sql.=' AND '.$sqlwhere;