diff --git a/COPYRIGHT b/COPYRIGHT index df0ba8b3e90df8e4db1338a2e736ad513ec72cfa..40822059ab0ca732139c24f39447358b8a85a7cd 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 diff --git a/ChangeLog b/ChangeLog index 9449d16df9332d184c6d0b085247272d800b598a..6aaa5a781a7eb086f4ef9f61bfee20028bbea76e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -235,6 +235,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/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 83938b158e7426f323b4539d6401094234b11603..854e4a4fb4761069ec78d2069177797d1e7c6243 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=0, $offset=0, 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); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index d1c5547cccc8e5d56946ee8fa53dbf64a908c372..a497b3cb7e2c8e674e295d4514ae9d73f2d078f5 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) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5287155357f47b3452dc353f3ae8d6e9ee4ed548..31f1372b18eb8fae1f49d41ecb8c0fc7bc60de22 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','<strong>$1</strong>',$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).' - '; @@ -2110,7 +2112,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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6074f6fe84140abd6b23ba32faa3e3371542938d..b3401fe58e8efc6a6a5269a28bc557cdac385f19 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2015,7 +2015,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 '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup } } diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 4ee6084aaf6e86e1c95936665a38abb3b62a17b3..ff23fd4bffa38091cdef5e19c39e4aa58cd8a7b0 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -1,7 +1,8 @@ <?php -/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> +/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * * 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 @@ -10,7 +11,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 FITNESS 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 @@ -18,11 +19,11 @@ */ /** - * \defgroup barcode Module barcode - * \brief Module pour gerer les codes barres - * \file htdocs/core/modules/modBarcode.class.php - * \ingroup barcode,produit - * \brief Fichier de description et activation du module Barcode + * \defgroup barcode Module barcode + * \brief Module pour gerer les codes barres + * \file htdocs/core/modules/modBarcode.class.php + * \ingroup barcode,produit + * \brief Fichier de description et activation du module Barcode */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -34,9 +35,9 @@ class modBarcode extends DolibarrModules { /** - * Constructor. Define names, constants, directories, boxes, permissions + * Constructor. Define names, constants, directories, boxes, permissions * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ function __construct($db) { @@ -56,7 +57,7 @@ class modBarcode extends DolibarrModules $this->dirs = array("/barcode/temp"); // Dependances - $this->depends = array(); // May be used for product or service or third party module + $this->depends = array(); // May be used for product or service or third party module $this->requiredby = array(); // Config pages @@ -90,43 +91,43 @@ class modBarcode extends DolibarrModules $this->rights[2][3] = 0; // La permission est-elle une permission par defaut $this->rights[2][4] = 'creer_advance'; - // Main menu entries - $r=0; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'mainmenu'=>'tools', - 'leftmenu'=>'barcodeprint', - 'type'=>'left', // This is a Left menu entry - 'titre'=>'BarCodePrintsheet', - 'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint', - '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 - 'target'=>'', - 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + // Main menu entries + $r=0; + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'mainmenu'=>'tools', + 'leftmenu'=>'barcodeprint', + 'type'=>'left', // This is a Left menu entry + 'titre'=>'BarCodePrintsheet', + 'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint', + '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'=>'$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++; - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry + $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry 'titre'=>'MassBarcodeInit', 'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools', - 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + '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 + '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'=>'$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 + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both $r++; } - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories. - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories. + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO */ function init($options='') { diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index f5e366bc3ad0e40547e2eb5f7742fa774245df8f..d8c967b4f281a2ff1aac0509ac0cd7966cea9988 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) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 42764223f3e172390ce26274b74455fd4c79c433..07b7cd70a13facecacc27de8fb477548040cf026 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es> * * 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 '</td>'; if ($action != 'editavailability') - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>'; + print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $commande->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>'; print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editavailability') { @@ -345,7 +345,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Source'); print '</td>'; if ($action != 'editdemandreason') - print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>'; + print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $commande->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>'; print '</tr></table>'; print '</td><td colspan="3">'; if ($action == 'editdemandreason') { diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 198eb11dddbac7568e4e037281150942549cded7..3cb613934b9d6f364efdc65b2f00210857de7b23 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 b0f9ada3af7323293ad402dbcf855e758f5288c1..854428a5ccf99b9e8e538d6ab80e74a44c4f8957 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 bd6746c98e4eb8540a02150073528279cc9c2880..2acf7d3909397ebd73b396eaca706e81044ae4d5 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 21412fa8064ab04e83ab16057bf2551523042baf..f577913ebe2f9a83a32e40f470151f6a39ca6db2 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); diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang index b4956e59c018fd6fcd73ba1b37f8a2e3f14f1ef0..ce287f91dfe0ca353091bec967ade6c924db7909 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 36727048fc40c4bb2879aec0aa374c4d0be00a69..d848b0befcee0b1046481fcce9b80a6f8e7ef960 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 '<pre>'.print_r($printer, true).'</pre>'; - print $printer->listAvailablePrinters(); + if (count($printer->getlist_available_printers)) { + print $printer->listAvailablePrinters(); + } + else { + print $langs->trans('PleaseConfigureDriverfromList'); + } } else { print $langs->trans('PleaseSelectaDriverfromList'); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 8a4c2e53d8921f880250dd26c4e648b7c7490830..018bf862bbac4d27d063ad429275fa35897636bc 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; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index ff5e7918b43c230ccc67f212885ea56533e43e1e..e650a8ea7605d16d170140c7c22856a59ce21345 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); } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 49400c119a5dc0cb4cf838b7462142130d24f6e2..1ca8daefdcdde4683bf6f06643fa316f8a0c45d5 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -639,11 +639,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $s=img_picto('title','/fullpath/img.png','',1); print __METHOD__." s=".$s."\n"; - $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto3'); + $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto3'); $s=img_picto('title','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto4'); + $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto4'); $s=img_picto('title:alt','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n";