From 0d897a1307273f3fa6937eda017513badbfa5f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 20 Jul 2015 18:30:45 +0200 Subject: [PATCH 01/15] NEW: log hooks loading This will help debugging bad hooks behavior. --- htdocs/core/class/hookmanager.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index d1c5547cccc..a497b3cb7e2 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -95,6 +95,7 @@ class HookManager $pathroot = ''; // Include actions class overwriting hooks + dol_syslog('Loading hook:' . $actionfile, LOG_INFO); $resaction=dol_include_once($path.$actionfile); if ($resaction) { From a21ff677bff299877b91c9d8277f2b2d83d7e79e Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Wed, 29 Jul 2015 00:05:19 +0200 Subject: [PATCH 02/15] Added EvalMath library to COPYRIGHT Added EvalMath library to COPYRIGHT. As requested by @rdoursenaud --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index df0ba8b3e90..40822059ab0 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -26,6 +26,7 @@ php-iban 1.4.6 LGPL-3+ Yes PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests Restler 3.0 LGPL-3+ Yes Library to develop REST Web services TCPDF 6.2.6 LGPL-3+ Yes PDF generation +EvalMath 1.0 BSD Yes Safe math expressions evaluation JS libraries: jQuery 1.11.3 MIT License Yes JS library From 73192b78e93d59be900802cc3e07ce13a9f33bb8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 29 Jul 2015 11:50:31 +0200 Subject: [PATCH 03/15] FIX : better fetchAll method into skeleton_class.class.php --- dev/skeletons/skeleton_class.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 83938b158e7..56108ba7488 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -222,10 +222,11 @@ class Skeleton_Class extends CommonObject * @param int $limit offset limit * @param int $offset offset limit * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array()) + public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array(), $filtermode='AND') { dol_syslog(__METHOD__, LOG_DEBUG); @@ -240,14 +241,19 @@ class Skeleton_Class extends CommonObject $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - $sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; } } if (count($sqlwhere) > 0) { - $sql .= ' WHERE ' . implode(' AND ', $sqlwhere); + $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); + } + + if (!empty($sortfield)) { + $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder; + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit + 1, $offset); } - $sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit($limit + 1, $offset); - $this->lines = array(); $resql = $this->db->query($sql); From e291ca2e23b3603ce68c271b8efbd773437bc42e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 29 Jul 2015 11:52:23 +0200 Subject: [PATCH 04/15] FIX : Better FetchAll method --- dev/skeletons/skeleton_class.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 56108ba7488..854e4a4fb47 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -226,7 +226,7 @@ class Skeleton_Class extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array(), $filtermode='AND') + public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') { dol_syslog(__METHOD__, LOG_DEBUG); From bd46f87ed8e49ba07286bae5cd0b211164cb3fa0 Mon Sep 17 00:00:00 2001 From: fmarcet Date: Wed, 29 Jul 2015 13:04:12 +0200 Subject: [PATCH 05/15] FIX: Missing interventions headers --- htdocs/fichinter/card.php | 2 +- htdocs/fichinter/contact.php | 2 +- htdocs/fichinter/document.php | 3 +-- htdocs/fichinter/info.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 198eb11dddb..3cb613934b9 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -949,7 +949,7 @@ $formfile = new FormFile($db); if ($conf->contrat->enabled) $formcontract = new FormContract($db); -llxHeader('',$langs->trans("Fichinter")); +llxHeader('',$langs->trans("Intervention")); if ($action == 'create') { diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index b0f9ada3af7..854428a5ccf 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -106,7 +106,7 @@ $formcompany = new FormCompany($db); $contactstatic=new Contact($db); $userstatic=new User($db); -llxHeader(); +llxHeader('',$langs->trans("Intervention")); // Mode vue et edition diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index bd6746c98e4..2acf7d39093 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -81,8 +81,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php $form = new Form($db); -llxHeader("","",$langs->trans("InterventionCard")); - +llxHeader('',$langs->trans("Intervention")); if ($object->id) { diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index 21412fa8064..f577913ebe2 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -49,7 +49,7 @@ if ($id > 0) * View */ -llxHeader(); +llxHeader('',$langs->trans("Intervention")); $societe = new Societe($db); $societe->fetch($object->socid); From 2cf9d9f5834f417ba43fde15bc56b343e43f2814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 29 Jul 2015 19:42:41 +0200 Subject: [PATCH 06/15] Fix #3322 Use title for alt if no alt is provided alt has priority over title, so it should be filled if title is filled. Use the title value to fill alt. Unit test updated accordingly. --- htdocs/core/lib/functions.lib.php | 2 +- test/phpunit/FunctionsLibTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 830911fdfb4..7295abfe7df 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1906,7 +1906,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ $tmparray=array(0=>$titlealt); if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; - $alt=empty($tmparray[1])?'':$tmparray[1]; + $alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup } } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index dd3602ff8f7..88496680eec 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -609,11 +609,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $s=img_picto('title','/fullpath/img.png','',1); print __METHOD__." s=".$s."\n"; - $this->assertEquals('',$s,'testImgPicto3'); + $this->assertEquals('title',$s,'testImgPicto3'); $s=img_picto('title','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals('',$s,'testImgPicto4'); + $this->assertEquals('title',$s,'testImgPicto4'); $s=img_picto('title:alt','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; From d6776e115595549dffd2113866432f180da105b0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 3 Aug 2015 11:39:24 +0200 Subject: [PATCH 07/15] FIX : Error management in societe/soc.php --- htdocs/societe/soc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ff5e7918b43..e650a8ea760 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -740,7 +740,7 @@ $formcompany = new FormCompany($db); if ($socid > 0 && empty($object->id)) { - $res=$object->fetch($socid); + $result=$object->fetch($socid); if ($result <= 0) dol_print_error('',$object->error); } From 2a7f5da4a7dc55fecb349a3f1945ac1227264dc9 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 4 Aug 2015 11:49:26 +0200 Subject: [PATCH 08/15] FIX : export SQL instruction on modProduct with extrafields --- htdocs/core/modules/modProduct.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index f5e366bc3ad..d8c967b4f28 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -252,7 +252,7 @@ class modProduct extends DolibarrModules if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); // Add extra fields $import_extrafield_sample=array(); - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' entity IN (0, ".$conf->entity.')'; + $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')'; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { From 62ad7d4d3419dfc3d6c0583d6b6ca86f0cf1981f Mon Sep 17 00:00:00 2001 From: fmarcet Date: Tue, 4 Aug 2015 13:32:44 +0200 Subject: [PATCH 09/15] FIX: Not showing task extrafields when creating from left menu --- ChangeLog | 1 + htdocs/projet/tasks.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5ea84cbb708..e4815781cd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ FIX [ bug 1634 ] Error deleting a project when it had many linked objects FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne FIX: Not showing delivery date on rouget pdf +FIX: Not showing task extrafields when creating from left menu NEW: Created new ContratLigne::insert function diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 6d1fb4d8462..f4d83eaa1f1 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -55,8 +55,8 @@ if ($id > 0 || ! empty($ref)) // fetch optionals attributes and labels $extralabels_projet=$extrafields_project->fetch_name_optionals_label($object->table_element); - $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element); } +$extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element); // Security check $socid=0; From fb25f479f2818205fb15950ab88c6e4b212e6629 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 4 Aug 2015 13:39:01 +0200 Subject: [PATCH 10/15] unit price not used if qty = 1 this line is too long for add unused information --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5287155357f..682abdd66d1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2110,7 +2110,7 @@ class Form $outval.= ' '.$langs->transnoentities("Units"); } - if ($objp->quantity >= 1) + if ($objp->quantity > 1) { $opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding $outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding From 83c4652a1629f84f98af1f8f2e2b773b1cc0f563 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Tue, 4 Aug 2015 15:22:36 +0200 Subject: [PATCH 11/15] don't display ref_fourn if it's same as ref decrease size of the select list --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 682abdd66d1..31f1372b18e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2072,10 +2072,12 @@ class Form if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','$1',$label,1); $opt.=$objp->ref; - if (! empty($objp->idprodfournprice)) $opt.=' ('.$objp->ref_fourn.')'; + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + $opt.=' ('.$objp->ref_fourn.')'; $opt.=' - '; $outval.=$objRef; - if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')'; + if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) + $outval.=' ('.$objRefFourn.')'; $outval.=' - '; $opt.=dol_trunc($label, 72).' - '; $outval.=dol_trunc($label, 72).' - '; From 5177c5f22766e63a1df6984d7b32d2d71c3ecd84 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Aug 2015 09:27:46 +0200 Subject: [PATCH 12/15] fix #3338 broken links on shippment card --- htdocs/expedition/shipment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 42764223f3e..07b7cd70a13 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * * 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 @@ -329,7 +329,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('AvailabilityPeriod'); print ''; if ($action != 'editavailability') - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; print ''; if ($action == 'editavailability') { @@ -345,7 +345,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Source'); print ''; if ($action != 'editdemandreason') - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; print ''; if ($action == 'editdemandreason') { From 9f2b4c503e1bd14fb7235b3e078b447a8307cafa Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Aug 2015 09:57:43 +0200 Subject: [PATCH 13/15] Fix #3236 --- htdocs/langs/en_US/printing.lang | 1 + htdocs/printing/admin/printing.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index b4956e59c01..ce287f91dfe 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -10,6 +10,7 @@ PrintTestDesc=List of Printers. FileWasSentToPrinter=File %s was sent to printer NoActivePrintingModuleFound=No active module to print document PleaseSelectaDriverfromList=Please select a driver from list. +PleaseConfigureDriverfromList=Please configure the selected driver from list. SetupDriver=Driver setup TestDriver=Test TargetedPrinter=Targeted printer diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 36727048fc4..408d7cdfa87 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -229,7 +229,12 @@ if ($mode == 'test' && $user->admin) $langs->load($driver); $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - print $printer->listAvailablePrinters(); + if ($printer->getlist_available_printers) { + print $printer->listAvailablePrinters(); + } + else { + print $langs->trans('PleaseConfigureDriverfromList'); + } } else { print $langs->trans('PleaseSelectaDriverfromList'); From ef6b96b4c7394a6b70991be2ea8a8ad9abcec943 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Aug 2015 10:12:10 +0200 Subject: [PATCH 14/15] Fix #3236 --- htdocs/langs/en_US/printing.lang | 1 + htdocs/printing/admin/printing.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index b4956e59c01..ce287f91dfe 100644 --- a/htdocs/langs/en_US/printing.lang +++ b/htdocs/langs/en_US/printing.lang @@ -10,6 +10,7 @@ PrintTestDesc=List of Printers. FileWasSentToPrinter=File %s was sent to printer NoActivePrintingModuleFound=No active module to print document PleaseSelectaDriverfromList=Please select a driver from list. +PleaseConfigureDriverfromList=Please configure the selected driver from list. SetupDriver=Driver setup TestDriver=Test TargetedPrinter=Targeted printer diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 36727048fc4..d848b0befce 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -229,7 +229,12 @@ if ($mode == 'test' && $user->admin) $langs->load($driver); $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - print $printer->listAvailablePrinters(); + if (count($printer->getlist_available_printers)) { + print $printer->listAvailablePrinters(); + } + else { + print $langs->trans('PleaseConfigureDriverfromList'); + } } else { print $langs->trans('PleaseSelectaDriverfromList'); From 12b83fd3e8ec3ee5b79f6ce52469c5504dec193d Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 7 Aug 2015 12:45:27 +0200 Subject: [PATCH 15/15] Fix #3304 --- htdocs/core/modules/modBarcode.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index c9ba87250bb..13af745e004 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Juanjo Menent * * 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 @@ -99,7 +100,7 @@ class modBarcode extends DolibarrModules 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>200, 'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->barcode->lire_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both $r++; @@ -111,7 +112,7 @@ class modBarcode extends DolibarrModules 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>300, 'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules + 'perms'=>'$user->rights->barcode->creer_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++;