diff --git a/build/debian/copyright b/build/debian/copyright index e3397d82992..8207df4b6d7 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -1,7 +1,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Dolibarr Upstream-Contact: Laurent Destailleur -Source: http://www.dolibarr.org/files/stable/standard/ +Source: https://www.dolibarr.org/files/stable/standard/ Files: * Copyright: 2002-2009, Rodolphe Quiedeville diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 90e96b23a83..ddbc7123d70 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -257,6 +257,7 @@ if (empty($reshook)) } $lastname=$_POST["lastname"]; $firstname=$_POST["firstname"]; + $societe=$_POST["societe"]; $morphy=$_POST["morphy"]; $login=$_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 2724d64f17f..6f01a4c1406 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -268,7 +268,8 @@ class Utils { $i++; // output line number $read = fgets($handlein); - if ($i == 1 && preg_match('/'.preg_quote('Warning: Using a password').'/i', $read)) continue; + // Exclude warning line we don't want + if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue; fwrite($handle,$read); if (preg_match('/'.preg_quote('-- Dump completed').'/i',$read)) $ok=1; elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i',$read)) $ok=1; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 921571a478c..9c7e5f0330b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7,7 +7,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2010-2014 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2014 Cédric GROSS @@ -2500,9 +2500,9 @@ function img_printer($titlealt = "default", $other='') /** * Show help logo with cursor "?" * - * @param string $usehelpcursor Use help cursor - * @param string $usealttitle Text to use as alt title - * @return string Retourne tag img + * @param int $usehelpcursor Use help cursor + * @param int|string $usealttitle Text to use as alt title + * @return string Return tag img */ function img_help($usehelpcursor = 1, $usealttitle = 1) { @@ -3600,7 +3600,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller $vatratecleaned = $vatrate; if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" { - $vatratecleaned = $reg[1]; + $vatratecleaned = trim($reg[1]); $vatratecode = $reg[2]; } @@ -3614,7 +3614,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller { if ($local == 1) { - if (! $mysoc->localtax1_assuj) return 0; + if (! $mysoc->localtax1_assuj || (string) $vatratecleaned == "0") return 0; if ($thirdparty_seller->id == $mysoc->id) { if (! $thirdparty_buyer->localtax1_assuj) return 0; @@ -3627,7 +3627,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller if ($local == 2) { - if (! $mysoc->localtax2_assuj) return 0; + if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; if ($thirdparty_seller->id == $mysoc->id) { if (! $thirdparty_buyer->localtax2_assuj) return 0; @@ -3899,7 +3899,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi * @param int $idprod Id of product or 0 if not a predefined product * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) * @param int $idprodfournprice Id product_fournisseur_price (for "supplier" order/invoice) - * @return int <0 if KO, Vat rate if OK + * @return float Vat rate * @see get_product_localtax_for_country */ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0) @@ -4049,7 +4049,7 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller) * @param Societe $thirdparty_buyer Objet societe acheteuse * @param int $idprod Id product * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) - * @return float Taux de tva a appliquer, -1 si ne peut etre determine + * @return float Vat rate to use, -1 if we can't guess it * @see get_default_npr, get_default_localtax */ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0) @@ -4598,7 +4598,7 @@ function dol_nboflines_bis($text,$maxlinesize=0,$charset='UTF-8') else $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); - $nblines = floor((count($a)+1)/2); + $nblines = (int) floor((count($a)+1)/2); // count possible auto line breaks if($maxlinesize) { diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 91f78522973..00d06e8511a 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -64,24 +64,27 @@ class ExportExcel extends ModeleExports $this->picto='mime/xls'; // Picto $this->version='1.30'; // Driver version - // If driver use an external library, put its name here - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) - { - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; - $this->label_lib='PhpWriteExcel'; - $this->version_lib='unknown'; - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel.php'; - require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; - $this->label_lib='PhpExcel'; - $this->version_lib='1.8.0'; // No way to get info from library - } - $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) + + if (empty($this->disabled)) + { + // If driver use an external library, put its name here + if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) + { + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; + $this->label_lib='PhpWriteExcel'; + $this->version_lib='unknown'; + } + else + { + require_once PHPEXCEL_PATH.'PHPExcel.php'; + require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; + $this->label_lib='PhpExcel'; + $this->version_lib='1.8.0'; // No way to get info from library + } + } $this->row=0; } diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index dcb649e780d..df9fd9d5705 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -64,25 +64,28 @@ class ExportExcel2007 extends ExportExcel $this->picto='mime/xls'; // Picto $this->version='1.30'; // Driver version - // If driver use an external library, put its name here - if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) + $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) + + if (empty($this->disabled)) { - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; - require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; - $this->label_lib='PhpWriteExcel'; - $this->version_lib='unknown'; - } - else - { - require_once PHPEXCEL_PATH.'PHPExcel.php'; - require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; - $this->label_lib='PhpExcel'; - $this->version_lib='1.8.0'; // No way to get info from library + // If driver use an external library, put its name here + if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) + { + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_workbookbig.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'class.writeexcel_worksheet.inc.php'; + require_once PHP_WRITEEXCEL_PATH.'functions.writeexcel_utility.inc.php'; + $this->label_lib='PhpWriteExcel'; + $this->version_lib='unknown'; + } + else + { + require_once PHPEXCEL_PATH.'PHPExcel.php'; + require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php'; + $this->label_lib='PhpExcel'; + $this->version_lib='1.8.0'; // No way to get info from library + } } - $this->disabled = (in_array(constant('PHPEXCEL_PATH'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages) - $this->row=0; } diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index ee1c3b8e96c..8cbb3850c2b 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -65,22 +65,24 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac $moduleid=$reg[1]; // Loading Class - $file = $dir."/export_".$moduleid.".modules.php"; + $file = $dir."export_".$moduleid.".modules.php"; $classname = "Export".ucfirst($moduleid); require_once $file; - $module = new $classname($db); - - // Picto - $this->picto[$module->id]=$module->picto; - // Driver properties - $this->driverlabel[$module->id]=$module->getDriverLabel().(empty($module->disabled)?'':' __(Disabled)__'); // '__(Disabled)__' is a key - $this->driverdesc[$module->id]=$module->getDriverDesc(); - $this->driverversion[$module->id]=$module->getDriverVersion(); - // If use an external lib - $this->liblabel[$module->id]=$module->getLibLabel(); - $this->libversion[$module->id]=$module->getLibVersion(); - + if (class_exists($classname)) + { + $module = new $classname($db); + + // Picto + $this->picto[$module->id]=$module->picto; + // Driver properties + $this->driverlabel[$module->id]=$module->getDriverLabel().(empty($module->disabled)?'':' __(Disabled)__'); // '__(Disabled)__' is a key + $this->driverdesc[$module->id]=$module->getDriverDesc(); + $this->driverversion[$module->id]=$module->getDriverVersion(); + // If use an external lib + $this->liblabel[$module->id]=$module->getLibLabel(); + $this->libversion[$module->id]=$module->getLibVersion(); + } $i++; } } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 8c7f5b987be..f5ce8b0350b 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -72,9 +72,7 @@ $fieldstosearchall = array( 'd.lastname'=>'Lastname', 'd.firstname'=>'Firstname', ); - - - + /* * View */ @@ -115,6 +113,12 @@ if (trim($search_name) != '') if ($search_amount) $sql.= natural_search(array('d.amount'), price2num(trim($search_amount)), 1); $sql.= $db->order($sortfield,$sortorder); +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql.= $db->plimit($limit+1, $offset); $resql = $db->query($sql); @@ -124,18 +128,18 @@ if ($resql) $i = 0; $param = '&statut='.$statut; - if ($page > 0) $param.= '&page='.$page; + //if ($page > 0) $param.= '&page='.$page; if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($statut >= 0) { $donationstatic->statut=$statut; $label=$donationstatic->getLibStatut(0); - print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords); } else { - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,$nbtotalofrecords); } @@ -200,7 +204,7 @@ if ($resql) $var=True; while ($i < min($num,$limit)) { - $objp = $db->fetch_object($result); + $objp = $db->fetch_object($resql); $var=!$var; print ""; $donationstatic->id=$objp->rowid; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 34b6a6e20b9..4a6a50c7926 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1967,6 +1967,7 @@ class Expedition extends CommonObject */ function set_billed() { + global $user; $error=0; $this->db->begin(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 567e2660b94..849e873b96e 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -946,6 +946,7 @@ if ($action == 'create') if ($socid > 0) { + $soc=new Societe($db); $soc->fetch($socid); print '
'; diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index c97d9c74dac..038994568ac 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -48,7 +48,8 @@ */ // include class for decoding filters -require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); +if (defined('TCPDF_PATH')) require_once(constant('TCPDF_PATH').'/include/tcpdf_filters.php'); +else require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php'); if (!defined ('PDF_TYPE_NULL')) define ('PDF_TYPE_NULL', 0); diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 993d800aea3..ec437709487 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -66,7 +66,7 @@ $main_use_alt_dir = ((GETPOST("main_use_alt_dir") && (GETPOST("main_use_alt_dir" // Alternative root directory name $main_alt_dir_name = ((GETPOST("main_alt_dir_name") && GETPOST("main_alt_dir_name") != '') ? GETPOST("main_alt_dir_name") : 'custom'); -session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters) +session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters) // Save a flag to tell to restore input value if we do back $_SESSION['dol_save_pass']=$db_pass; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 3f92cd11b18..e7af303d694 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -211,9 +211,9 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') //print ''; // Generation des graphs + $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if ($object->id > 0) // We are on statistics for a dedicated product { - $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if (! file_exists($dir.'/'.$object->id)) { if (dol_mkdir($dir.'/'.$object->id) < 0) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index b0464da88d0..bb006f23a9d 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -59,6 +59,8 @@ class Task extends CommonObject var $timespent_fk_user; var $timespent_note; + public $oldcopy; + /** * Constructor @@ -317,6 +319,30 @@ class Task extends CommonObject } } + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) + { + // We remove directory + if ($conf->projet->dir_output) + { + $project = new Project($this->db); + $project->fetch($this->fk_project); + + $olddir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->oldcopy->ref); + $newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref); + if (file_exists($olddir)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + $res=dol_move($olddir, $newdir); + if (! $res) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToRenameDir',$olddir,$newdir); + $error++; + } + } + } + } + // Commit or rollback if ($error) { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 9c785e08e6b..cbee3683f73 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -82,6 +82,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) if (! $error) { $object->fetch($id,$ref); + $object->oldcopy = clone $object; $tmparray=explode('_',$_POST['task_parent']); $task_parent=$tmparray[1];