From 60022ab80d31c66c825354646da7f7df56afc388 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 12 Mar 2015 17:25:57 +0100 Subject: [PATCH 001/184] NEW : autofocus on product selection dropdown list or search field --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 31fb095e3c8..d2ad5424d71 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1527,7 +1527,7 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print ''; + print ''; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } @@ -1644,7 +1644,7 @@ class Form require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $num = $this->db->num_rows($result); - $out.=''; $out.=''; $i = 0; From 60d334f646c467bb78bd3f449f4ba8b2b4d1b2ca Mon Sep 17 00:00:00 2001 From: AcceTT Soluciones Computacionales Date: Sun, 15 Mar 2015 17:47:51 -0600 Subject: [PATCH 002/184] Update functionsnumtoword.lib.php Now the function convert since -1000000000000 to 1000000000000. Correct some bugs. Change $lang-> default to $langs --- htdocs/core/lib/functionsnumtoword.lib.php | 212 +++++++++++---------- 1 file changed, 115 insertions(+), 97 deletions(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index daab7085c25..c1a21e81916 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -16,117 +16,135 @@ * along with this program. If not, see . * or see http://www.gnu.org/ */ - /** * \file htdocs/core/lib/functionsnumbertoword.lib.php * \brief A set of functions for Dolibarr * This file contains all frequently used functions. */ - /** * Function to return number or amount in text. * * @param float $numero Number to convert * @param Lang $langs Language * @param string $numorcurrency 'number' or 'amount' - * @return string Text of the number + * @return string Text of the number or -1 in case TOO LONG (more than 1000000000000.99) */ function dolNumberToWord($numero, $langs, $numorcurrency='number') { - $entexto=$numero; - - if ($langs->default == 'es_MX' && $numorcurrency == 'currency') - { - $veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); - $unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); - $decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); - $centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); - $number = $numero; - $parte_decimal = $numero - (int) $numero; - $parte_decimal = (int) round($parte_decimal*100); - if ($parte_decimal < 10) - $parte_decimal = "0".$parte_decimal; - $entexto =""; - if ($numero>=1 && $numero<2) { - $entexto .= " UN PESO ".$parte_decimal." / 100 M.N."; - } - elseif ($numero>=0 && $numero<1){ - $entexto .= " CERO PESOS ".$parte_decimal." / 100 M.N."; - } - elseif ($numero>=100 && $numero<101){ - $entexto .= " CIEN PESOS ".$parte_decimal." / 100 M.N."; - } - else { - $cdm = (int) ($numero / 100000); - $numero = $numero - $cdm * 100000; - $ddm = (int) ($numero / 10000); - $numero = $numero - $ddm * 10000; - $udm = (int) ($numero / 1000); - $numero = $numero - $udm * 1000; - $c = (int) ($numero / 100); - $numero = $numero - $c * 100; - $d = (int) ($numero / 10); - $u = (int) $numero - $d * 10; - $completo=FALSE; - if ($cdm==1 && $ddm==0 && $udm==0){ - $entexto .= "CIEN"; - $completo = TRUE; + // If the number is negative convert to positive and return -1 if is too long + if ($numero < 0) $numero *= -1; + if ($numero >= 1000000000001) + return -1; + // Get 2 decimals to cents, another functions round or truncate + $strnumber = number_format ($numero,10); + for ($i=0; $i2){ - $entexto .= " ".$decenas[$ddm-1]; - if ($udm!=0){ - $entexto .= " Y "; - } - } - elseif ($ddm!=0){ - $completo=TRUE; - if ($ddm==1){ - $entexto .= " ".$diecis[$udm]; - } - else{ - $entexto .= " ".$veintis[$udm]; - } - } - if ($udm!=0 && !$completo){ - $entexto .= $unidades[$udm-1]; - } - $completo=FALSE; - if ($number>=1000){ - $entexto .= " MIL "; - } - - if ($c==1 && $d==0 && $u==0){ - $entexto .= "CIEN"; - $completo = TRUE; - } - if ($c!=0 && !$completo){ - $entexto .= $centenas[$c-1]." "; - } - if ($d>2){ - $entexto .= " ".$decenas[$d-1]; - if ($u!=0){ - $entexto .= " Y "; - } - } - elseif ($d!=0){ - $completo=TRUE; - if ($d==1){ - $entexto .= " ".$diecis[$u]; - } - else{ - $entexto .= " ".$veintis[$u]; - } - } - if ($u!=0 && !$completo){ - $entexto .= $unidades[$u-1]; - } - $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; - } } - - return $entexto; + /*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and + in case exist why ask $lang like a parameter?*/ + if ($langs == 'es_MX' && $numorcurrency == 'currency') + { + + if ($numero>=1 && $numero<2) { + return ("UN PESO ".$parte_decimal." / 100 M.N."); + } + elseif ($numero>=0 && $numero<1){ + return ("CERO PESOS ".$parte_decimal." / 100 M.N."); + } + elseif ($numero>=1000000 && $numero<1000001){ + return ("UN MILLÓN DE PESOS ".$parte_decimal." / 100 M.N."); + } + elseif ($numero>=1000000000000 && $numero<1000000000001){ + return ("UN BILLÓN DE PESOS ".$parte_decimal." / 100 M.N."); + } + else { + $entexto =""; + $number = $numero; + if ($number >= 1000000000){ + $CdMMillon = (int) ($numero / 100000000000); + $numero = $numero - $CdMMillon * 100000000000; + $DdMMillon = (int) ($numero / 10000000000); + $numero = $numero - $DdMMillon * 10000000000; + $UdMMillon = (int) ($numero / 1000000000); + $numero = $numero - $UdMMillon * 1000000000; + $entexto .= hundreds2text ($CdMMillon, $DdMMillon, $UdMMillon); + $entexto .= " MIL "; + } + if ($number >= 1000000){ + $CdMILLON = (int) ($numero / 100000000); + $numero = $numero - $CdMILLON * 100000000; + $DdMILLON = (int) ($numero / 10000000); + $numero = $numero - $DdMILLON * 10000000; + $udMILLON = (int) ($numero / 1000000); + $numero = $numero - $udMILLON * 1000000; + $entexto .= hundreds2text ($CdMILLON, $DdMILLON, $udMILLON); + if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1) + $entexto .= " MILLÓN "; + else + $entexto .= " MILLONES "; + } + if ($number >= 1000) { + $cdm = (int) ($numero / 100000); + $numero = $numero - $cdm * 100000; + $ddm = (int) ($numero / 10000); + $numero = $numero - $ddm * 10000; + $udm = (int) ($numero / 1000); + $numero = $numero - $udm * 1000; + $entexto .= hundreds2text ($cdm, $ddm, $udm); + if ($cdm || $ddm || $udm) + $entexto .= " MIL "; + } + $c = (int) ($numero / 100); + $numero = $numero - $c * 100; + $d = (int) ($numero / 10); + $u = (int) $numero - $d * 10; + $entexto .= hundreds2text ($c, $d, $u); + if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000) + $entexto .= " DE"; + $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; + } + return $entexto; + } +} + +function hundreds2text ($hundreds, $tens, $units){ + if ($hundreds==1 && $tens==0 && $units==0){ + return "CIEN"; + } + $centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); + $decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); + $veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); + $diecis = array("DIEZ","ONCE","DOCE","TRECE","CATORCE","QUINCE","DIECISÉIS","DIECISIETE","DIECIOCHO","DIECINUEVE"); + $unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); + $entexto = ""; + if ($hundreds!=0){ + $entexto .= $centenas[$hundreds-1]; + } + if ($tens>2){ + if ($hundreds!=0) $entexto .= " "; + $entexto .= $decenas[$tens-1]; + if ($units!=0){ + $entexto .= " Y "; + $entexto .= $unidades[$units-1]; + } + return $entexto; + } + elseif ($tens==2){ + if ($hundreds!=0) $entexto .= " "; + $entexto .= " ".$veintis[$units]; + return $entexto; + } + elseif ($tens==1){ + if ($hundreds!=0) $entexto .= " "; + $entexto .= $diecis[$units]; + return $entexto; + } + if ($units!=0) { + if ($hundreds!=0 || $tens!=0) $entexto .= " "; + $entexto .= $unidades[$units-1]; + } + return $entexto; } From b5690142aa97c5cfa9894034444cabeb06ed0504 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Mar 2015 16:26:31 +0200 Subject: [PATCH 003/184] Prepare 3.6.3 --- build/debian/changelog | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/build/debian/changelog b/build/debian/changelog index 4a711c9868c..75f4734ea3c 100644 --- a/build/debian/changelog +++ b/build/debian/changelog @@ -1,20 +1,6 @@ -dolibarr (3.6.2-3) unstable; urgency=low +dolibarr (3.6.3-3) UNRELEASED; urgency=low [ Laurent Destailleur (eldy) ] * New upstream release. - -- Laurent Destailleur (eldy) Sat, 27 dec 2014 12:00:00 +0100 - -dolibarr (3.6.1-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 23 Sep 2014 12:00:00 +0100 - -dolibarr (3.6.0-3) unstable; urgency=low - - [ Laurent Destailleur (eldy) ] - * New upstream release. - - -- Laurent Destailleur (eldy) Tue, 15 July 2014 12:00:00 +0100 + -- Laurent Destailleur (eldy) Sun, 21 March 2015 12:00:00 +0100 \ No newline at end of file From fd8d09c8c084a13ec6af0868670038573933d285 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Mar 2015 17:53:05 +0200 Subject: [PATCH 004/184] Fix avoid warning --- htdocs/admin/index.php | 1 + htdocs/core/class/hookmanager.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index bbedab346d1..9e6d316c9ee 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -100,6 +100,7 @@ print '
'; print '
'; // Add hook to add information +$parameters=array(); $reshook=$hookmanager->executeHooks('addHomeSetup',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; if (empty($reshook)) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 906c1e6c4ae..6b50cc68cbd 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -184,7 +184,7 @@ class HookManager }*/ } - if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); + if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; } // Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) From 65ec02bae1da37df751ab0c5c91df9f02962a1b1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 30 Mar 2015 19:13:55 +0200 Subject: [PATCH 005/184] FIX : [ bug #1913 ] [EXPORT] [PGSQL] Bug when filtering export on a specific year --- htdocs/exports/class/export.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fda062952d1..7ab55fd4e53 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -328,7 +328,7 @@ class Export function conditionDate($Field, $Value, $Sens) { // TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN - if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." ".$Value; + if (strlen($Value)==4) $Condition=" date_format(".$Field.",'%Y') ".$Sens." '".$Value."'"; elseif (strlen($Value)==6) $Condition=" date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'"; else $Condition=" date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value; return $Condition; From 6fe803cd86a74b1a06296772d3a8570d7f251649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 3 Apr 2015 05:18:47 +0200 Subject: [PATCH 006/184] Created Propal, FactureFourniseur, and Commande constants for status --- htdocs/comm/propal.php | 34 ++-- htdocs/comm/propal/class/propal.class.php | 168 +++++++++++++----- htdocs/comm/propal/note.php | 2 +- htdocs/commande/class/commande.class.php | 60 ++++--- htdocs/core/class/commoninvoice.class.php | 28 +++ .../class/fournisseur.commande.class.php | 6 +- .../fourn/class/fournisseur.facture.class.php | 23 ++- htdocs/fourn/facture/card.php | 42 ++--- 8 files changed, 247 insertions(+), 116 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index be60d721d6a..1abd3bc4818 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -302,7 +302,7 @@ if (empty($reshook)) $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated $object->note = GETPOST('note'); - $object->statut = 0; + $object->statut = Propal::STATUS_DRAFT; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -549,7 +549,7 @@ if (empty($reshook)) // Reopen proposal else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { // prevent browser refresh from reopening proposal several times - if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) { + if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $object->reopen($user, 1); } } @@ -561,7 +561,7 @@ if (empty($reshook)) $action = 'statut'; } else { // prevent browser refresh from closing proposal several times - if ($object->statut == 1) { + if ($object->statut == Propal::STATUS_VALIDATED) { $object->cloture($user, GETPOST('statut'), GETPOST('note')); } } @@ -575,7 +575,7 @@ if (empty($reshook)) // Reopen proposal else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { // prevent browser refresh from reopening proposal several times - if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) { + if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $object->reopen($user, 1); } } @@ -587,7 +587,7 @@ if (empty($reshook)) $action = 'statut'; } else { // prevent browser refresh from closing proposal several times - if ($object->statut == 1) { + if ($object->statut == Propal::STATUS_VALIDATED) { $object->cloture($user, GETPOST('statut'), GETPOST('note')); } } @@ -1735,7 +1735,7 @@ if ($action == 'create') $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); if ($absolute_discount) { - if ($object->statut > 0) { + if ($object->statut > Propal::STATUS_DRAFT) { print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency)); } else { // Remise dispo de type non avoir @@ -1797,7 +1797,7 @@ if ($action == 'create') } else { if (! empty($object->fin_validite)) { print dol_print_date($object->fin_validite, 'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) + if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { print ' '; @@ -2081,7 +2081,7 @@ if ($action == 'create') '; - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { + if (! empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } @@ -2091,7 +2091,7 @@ if ($action == 'create') $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); // Form to add new line - if ($object->statut == 0 && $user->rights->propal->creer) + if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer) { if ($action != 'editline') { @@ -2154,7 +2154,7 @@ if ($action == 'create') if ($action != 'statut' && $action != 'editline') { // Validate - if ($object->statut == 0 && $object->total_ttc >= 0 && count($object->lines) > 0 && + if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0 && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate))) ) { @@ -2168,18 +2168,18 @@ if ($action == 'create') print '' . $langs->trans("AddAction") . ''; } // Edit - if ($object->statut == 1 && $user->rights->propal->creer) { + if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) { print ''; } // ReOpen - if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) { + if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) { print ''; } // Send - if ($object->statut == 1 || $object->statut == 2) { + if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) { print ''; } else @@ -2187,14 +2187,14 @@ if ($action == 'create') } // Create an order - if (! empty($conf->commande->enabled) && $object->statut == 2) { + if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($user->rights->commande->creer) { print ''; } } // Create contract - if ($conf->contrat->enabled && $object->statut == 2) { + if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) { $langs->load("contracts"); if ($user->rights->contrat->creer) { @@ -2203,7 +2203,7 @@ if ($action == 'create') } // Create an invoice and classify billed - if ($object->statut == 2) { + if ($object->statut == Propal::STATUS_SIGNED) { if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { print ''; @@ -2217,7 +2217,7 @@ if ($action == 'create') } // Close - if ($object->statut == 1 && $user->rights->propal->cloturer) { + if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) { print ''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index ce773b4e953..c1442aa403e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -54,19 +54,56 @@ class Propal extends CommonObject var $id; - var $socid; // Id client - var $client; // Objet societe client (a charger par fetch_client) + /** + * ID of the client + * @var int + */ + var $socid; + /** + * Client (loaded by fetch_client) + * @var Societe + */ + var $client; var $contactid; var $fk_project; var $author; var $ref; var $ref_client; - var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed) - var $datec; // Date of creation - var $datev; // Date of validation - var $date; // Date of proposal - var $datep; // Same than date + + /** + * Status of the quote + * Check the following constants: + * - STATUS_DRAFT + * - STATUS_VALIDATED + * - STATUS_SIGNED + * - STATUS_NOTSIGNED + * - STATUS_BILLED + * @var int + */ + var $statut; + + /** + * Date of creation + * @var + */ + var $datec; + /** + * Date of validation + * @var + */ + var $datev; + /** + * Date of the quote + * @var + */ + var $date; + + /** + * Same than date ¿? + * @var + */ + var $datep; var $date_livraison; var $fin_validite; @@ -79,9 +116,19 @@ class Propal extends CommonObject var $total_localtax1; // Total Local Taxes 1 var $total_localtax2; // Total Local Taxes 2 var $total_ttc; // Total with tax - var $price; // deprecated (for compatibility) - var $tva; // deprecated (for compatibility) - var $total; // deprecated (for compatibility) + + /** + * @deprecated + */ + var $price; + /** + * @deprecated + */ + var $tva; + /** + * @deprecated + */ + var $total; var $cond_reglement_id; var $cond_reglement_code; @@ -91,10 +138,16 @@ class Propal extends CommonObject var $remise; var $remise_percent; var $remise_absolue; - var $note; // deprecated (for compatibility) + /** + * @deprecated + */ + var $note; var $note_private; var $note_public; - var $fk_delivery_address; // deprecated (for compatibility) + /** + * @deprecated + */ + var $fk_delivery_address; var $fk_address; var $address_type; var $address; @@ -126,6 +179,26 @@ class Propal extends CommonObject var $location_incoterms; var $libelle_incoterms; //Used into tooltip + /** + * Draft status + */ + const STATUS_DRAFT = 0; + /** + * Validated status + */ + const STATUS_VALIDATED = 1; + /** + * Signed quote + */ + const STATUS_SIGNED = 2; + /** + * Not signed quote + */ + const STATUS_NOTSIGNED = 3; + /** + * Billed quote + */ + const STATUS_BILLED = 4; /** * Constructor @@ -361,7 +434,7 @@ class Propal extends CommonObject // Check parameters if ($type < 0) return -1; - if ($this->statut == 0) + if ($this->statut == self::STATUS_DRAFT) { $this->db->begin(); @@ -525,7 +598,7 @@ class Propal extends CommonObject if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag - if ($this->statut == 0) + if ($this->statut == self::STATUS_DRAFT) { $this->db->begin(); @@ -650,7 +723,7 @@ class Propal extends CommonObject */ function deleteline($lineid) { - if ($this->statut == 0) + if ($this->statut == self::STATUS_DRAFT) { $line=new PropaleLigne($this->db); @@ -1007,7 +1080,7 @@ class Propal extends CommonObject } $this->id=0; - $this->statut=0; + $this->statut=self::STATUS_DRAFT; if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { @@ -1192,7 +1265,7 @@ class Propal extends CommonObject $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - if ($obj->fk_statut == 0) + if ($obj->fk_statut == self::STATUS_DRAFT) { $this->brouillon = 1; } @@ -1385,8 +1458,8 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; $sql.= " SET ref = '".$num."',"; - $sql.= " fk_statut = 1, date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $sql.= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(get_class($this)."::valid", LOG_DEBUG); $resql=$this->db->query($sql); @@ -1441,7 +1514,7 @@ class Propal extends CommonObject $this->ref=$num; $this->brouillon=0; - $this->statut = 1; + $this->statut = self::STATUS_VALIDATED; $this->user_valid_id=$user->id; $this->datev=$now; @@ -1476,7 +1549,7 @@ class Propal extends CommonObject if (! empty($user->rights->propal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(get_class($this)."::set_date", LOG_DEBUG); if ($this->db->query($sql) ) @@ -1505,7 +1578,7 @@ class Propal extends CommonObject if (! empty($user->rights->propal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null'); - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; if ($this->db->query($sql) ) { $this->fin_validite = $date_fin_validite; @@ -1655,7 +1728,7 @@ class Propal extends CommonObject $remise = price2num($remise); $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; if ($this->db->query($sql) ) { @@ -1689,7 +1762,7 @@ class Propal extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; $sql.= " SET remise_absolue = ".$remise; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; if ($this->db->query($sql) ) { @@ -1797,7 +1870,7 @@ class Propal extends CommonObject $modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf; $trigger_name='PROPAL_CLOSE_REFUSED'; - if ($statut == 2) + if ($statut == self::STATUS_SIGNED) { $trigger_name='PROPAL_CLOSE_SIGNED'; $modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf; @@ -1814,7 +1887,7 @@ class Propal extends CommonObject return -2; } } - if ($statut == 4) + if ($statut == self::STATUS_BILLED) { $trigger_name='PROPAL_CLASSIFY_BILLED'; } @@ -1864,11 +1937,11 @@ class Propal extends CommonObject */ function classifyBilled() { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = 4'; - $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;'; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED; + $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT.' ;'; if ($this->db->query($sql) ) { - $this->statut=4; + $this->statut=self::STATUS_BILLED; return 1; } else @@ -1896,12 +1969,12 @@ class Propal extends CommonObject */ function set_draft($user) { - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = 0"; + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT; $sql.= " WHERE rowid = ".$this->id; if ($this->db->query($sql)) { - $this->statut = 0; + $this->statut = self::STATUS_DRAFT; $this->brouillon = 1; return 1; } @@ -1945,7 +2018,7 @@ class Propal extends CommonObject $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } if ($socid) $sql.= " AND s.rowid = ".$socid; - if ($draft) $sql.= " AND p.fk_statut = 0"; + if ($draft) $sql.= " AND p.fk_statut = ".self::STATUS_DRAFT; if ($notcurrentuser > 0) $sql.= " AND p.fk_user_author <> ".$user->id; $sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->plimit($limit,$offset); @@ -2215,7 +2288,7 @@ class Propal extends CommonObject function availability($availability_id) { dol_syslog('Propale::availability('.$availability_id.')'); - if ($this->statut >= 0) + if ($this->statut >= self::STATUS_DRAFT) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal'; $sql .= ' SET fk_availability = '.$availability_id; @@ -2249,7 +2322,7 @@ class Propal extends CommonObject function demand_reason($demand_reason_id) { dol_syslog('Propale::demand_reason('.$demand_reason_id.')'); - if ($this->statut >= 0) + if ($this->statut >= self::STATUS_DRAFT) { $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal'; $sql .= ' SET fk_input_reason = '.$demand_reason_id; @@ -2356,11 +2429,11 @@ class Propal extends CommonObject global $langs; $langs->load("propal"); - if ($statut==0) $statuttrans='statut0'; - if ($statut==1) $statuttrans='statut1'; - if ($statut==2) $statuttrans='statut3'; - if ($statut==3) $statuttrans='statut5'; - if ($statut==4) $statuttrans='statut6'; + if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; + if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; + if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; + if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; + if ($statut==self::STATUS_BILLED) $statuttrans='statut6'; if ($mode == 0) return $this->labelstatut[$statut]; if ($mode == 1) return $this->labelstatut_short[$statut]; @@ -2393,8 +2466,8 @@ class Propal extends CommonObject $clause = " AND"; } $sql.= $clause." p.entity = ".$conf->entity; - if ($mode == 'opened') $sql.= " AND p.fk_statut = 1"; - if ($mode == 'signed') $sql.= " AND p.fk_statut = 2"; + if ($mode == 'opened') $sql.= " AND p.fk_statut = ".self::STATUS_VALIDATED; + if ($mode == 'signed') $sql.= " AND p.fk_statut = ".self::STATUS_SIGNED; if ($user->societe_id) $sql.= " AND p.fk_soc = ".$user->societe_id; $resql=$this->db->query($sql); @@ -2405,12 +2478,12 @@ class Propal extends CommonObject if ($mode == 'opened') { $delay_warning=$conf->propal->cloture->warning_delay; - $statut = 1; + $statut = self::STATUS_VALIDATED; $label = $langs->trans("PropalsToClose"); } if ($mode == 'signed') { $delay_warning=$conf->propal->facturation->warning_delay; - $statut = 2; + $statut = self::STATUS_SIGNED; $label = $langs->trans("PropalsToBill"); } @@ -2815,7 +2888,14 @@ class PropaleLigne extends CommonObject var $fk_parent_line; var $desc; // Description ligne var $fk_product; // Id produit predefini - var $product_type = 0; // Type 0 = product, 1 = Service + /** + * Product type. + * Use the following constants: + * - Product::TYPE_PRODUCT + * - Product::TYPE_SERVICE + * @var int + */ + var $product_type = Product::TYPE_PRODUCT; var $qty; var $tva_tx; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 9292684d06f..05cd2db3f04 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref)) if ($object->fin_validite) { print dol_print_date($object->fin_validite,'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 259a3bc5d6a..5a7b8261fd7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -51,8 +51,17 @@ class Commande extends CommonOrder var $id; - var $socid; // Id client - var $client; // Objet societe client (a charger par fetch_client) + /** + * Client ID + * @var int + */ + var $socid; + + /** + * Client (loaded by fetch_client) + * @var Societe + */ + var $client; var $ref; var $ref_client; @@ -69,31 +78,13 @@ class Commande extends CommonOrder * - STATUS_CLOSED * @var int */ - var $statut; // -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Delivered=Sent/Received, billed or not) + var $statut; + /** + * @deprecated + */ var $facturee; // deprecated var $billed; // billed or not - /** - * Canceled status - */ - const STATUS_CANCELED = -1; - /** - * Draft status - */ - const STATUS_DRAFT = 0; - /** - * Validated status - */ - const STATUS_VALIDATED = 1; - /** - * Accepted/On process not managed for customer orders - */ - const STATUS_ACCEPTED = 2; - /** - * Closed (Sent/Received, billed or not) - */ - const STATUS_CLOSED = 3; - var $brouillon; var $cond_reglement_id; var $cond_reglement_code; @@ -153,6 +144,27 @@ class Commande extends CommonOrder */ const STOCK_NOT_ENOUGH_FOR_ORDER = -3; + /** + * Canceled status + */ + const STATUS_CANCELED = -1; + /** + * Draft status + */ + const STATUS_DRAFT = 0; + /** + * Validated status + */ + const STATUS_VALIDATED = 1; + /** + * Accepted/On process not managed for customer orders + */ + const STATUS_ACCEPTED = 2; + /** + * Closed (Sent/Received, billed or not) + */ + const STATUS_CLOSED = 3; + /** * Constructor diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 1a7ebfc34c8..2ca7a0bf0fb 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -60,6 +60,34 @@ abstract class CommonInvoice extends CommonObject */ const TYPE_SITUATION = 5; + /** + * Draft + */ + const STATUS_DRAFT = 0; + + /** + * Validated (need to be paid) + */ + const STATUS_VALIDATED = 1; + + /** + * Classified paid. + * If paid partially, $this->close_code can be: + * - CLOSECODE_DISCOUNTVAT + * - CLOSECODE_BADDEBT + * If paid completelly, this->close_code will be null + */ + const STATUS_CLOSED = 2; + + /** + * Classified abandoned and no payment done. + * $this->close_code can be: + * - CLOSECODE_BADDEBT + * - CLOSECODE_ABANDONED + * - CLOSECODE_REPLACED + */ + const STATUS_ABANDONED = 3; + /** * Return amount of payments already done * diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3cd07d7fc53..a05695ffeda 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -52,7 +52,11 @@ class CommandeFournisseur extends CommonOrder var $id; - var $ref; // TODO deprecated + /** + * TODO: Remove + * @deprecated + */ + var $ref; var $product_ref; var $ref_supplier; var $brouillon; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 19cb26cf17b..99e9cca639c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -55,10 +55,15 @@ class FactureFournisseur extends CommonInvoice var $socid; //Check constants for types var $type = self::TYPE_STANDARD; - //! 0=draft, - //! 1=validated - //! 2=classified paid partially (close_code='discount_vat','badcustomer') or completely (close_code=null), - //! Also 2, should be 3=classified abandoned and no payment done (close_code='badcustomer','abandon' ou 'replaced') + + /** + * Check constants for more info: + * - STATUS_DRAFT + * - STATUS_VALIDATED + * - STATUS_PAID + * - STATUS_ABANDONED + * @var int + */ var $statut; //! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant) var $paye; @@ -438,7 +443,7 @@ class FactureFournisseur extends CommonInvoice $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); - if ($this->statut == 0) $this->brouillon = 1; + if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1; $result=$this->fetch_lines(); if ($result < 0) @@ -886,7 +891,7 @@ class FactureFournisseur extends CommonInvoice $error=0; // Protection - if ($this->statut > 0) // This is to avoid to validate twice (avoid errors on logs and stock management) + if ($this->statut > self::STATUS_DRAFT) // This is to avoid to validate twice (avoid errors on logs and stock management) { dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING); return 0; @@ -995,7 +1000,7 @@ class FactureFournisseur extends CommonInvoice if (! $error) { $this->ref = $num; - $this->statut=1; + $this->statut=self::STATUS_VALIDATED; //$this->date_validation=$now; this is stored into log table } @@ -1032,7 +1037,7 @@ class FactureFournisseur extends CommonInvoice $error=0; - if ($this->statut == 0) + if ($this->statut == self::STATUS_DRAFT) { dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING); return 0; @@ -1746,7 +1751,7 @@ class FactureFournisseur extends CommonInvoice // Load source object $object->fetch($fromid); $object->id=0; - $object->statut=0; + $object->statut=self::STATUS_DRAFT; // Clear fields $object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e93d06ad530..28fbe44fc9f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -288,7 +288,7 @@ if (empty($reshook)) elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); - if ($object->statut == 1 && $object->paye == 0) + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) { $paiementfourn = new PaiementFourn($db); $result=$paiementfourn->fetch(GETPOST('paiement_id')); @@ -867,8 +867,8 @@ if (empty($reshook)) elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) { $result = $object->fetch($id); - if ($object->statut == 2 - || ($object->statut == 3 && $object->close_code != 'replaced')) + if ($object->statut == FactureFournisseur::STATUS_CLOSED + || ($object->statut == FactureFournisseur::STATUS_ABANDONED && $object->close_code != 'replaced')) { $result = $object->set_unpaid($user); if ($result > 0) @@ -1739,8 +1739,8 @@ else print "\n"; // Ref supplier - print ''.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)); + print ''.$form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statutrights->fournisseur->facture->creer)).''; + print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,($object->statutrights->fournisseur->facture->creer)); print ''; // Third party @@ -1788,8 +1788,8 @@ else print ''; // Label - print ''.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).''; - print ''.$form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).''; + print ''.$form->editfieldkey("Label",'label',$object->label,$object,($object->statutrights->fournisseur->facture->creer)).''; + print ''.$form->editfieldval("Label",'label',$object->label,$object,($object->statutrights->fournisseur->facture->creer)).''; /* * List of payments @@ -1853,7 +1853,7 @@ else } print ''.price($objp->amount).''; print ''; - if ($object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print 'rowid.'">'; print img_delete(); @@ -1891,15 +1891,17 @@ else print ''; + $form_permission = $object->statutrights->fournisseur->facture->creer && $object->getSommePaiement() <= 0; + // Date - print ''.$form->editfieldkey("Date",'datef',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').''; - print $form->editfieldval("Date",'datef',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker'); + print ''.$form->editfieldkey("Date",'datef',$object->datep,$object,$form_permission,'datepicker').''; + print $form->editfieldval("Date",'datef',$object->datep,$object,$form_permission,'datepicker'); print ''; // Due date - print ''.$form->editfieldkey("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').''; - print $form->editfieldval("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker'); - if ($action != 'editdate_lim_reglement' && $object->statut < 2 && $object->date_echeance && $object->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_warning($langs->trans('Late')); + print ''.$form->editfieldkey("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,$form_permission,'datepicker').''; + print $form->editfieldval("DateMaxPayment",'date_lim_reglement',$object->date_echeance,$object,$form_permission,'datepicker'); + if ($action != 'editdate_lim_reglement' && $object->statut < FactureFournisseur::STATUS_CLOSED && $object->date_echeance && $object->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_warning($langs->trans('Late')); print ''; // Conditions de reglement par defaut @@ -2081,7 +2083,7 @@ else '; - if (! empty($conf->use_javascript_ajax) && $object->statut == 0) { + if (! empty($conf->use_javascript_ajax) && $object->statut == FactureFournisseur::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; } @@ -2279,7 +2281,7 @@ else } */ // Form to add new line - if ($object->statut == 0 && $user->rights->fournisseur->facture->creer) + if ($object->statut == FactureFournisseur::STATUS_DRAFT && $user->rights->fournisseur->facture->creer) { if ($action != 'editline') { @@ -2310,7 +2312,7 @@ else print '
'; // Modify a validated invoice with no payments - if ($object->statut == 1 && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer) + if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer) { print ''.$langs->trans('Modify').''; } @@ -2329,7 +2331,7 @@ else } // Send by mail - if (($object->statut == 1 || $object->statut == 2)) + if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED)) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send) { @@ -2340,13 +2342,13 @@ else // Make payments - if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) + if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('DoPayment').''; // must use facid because id is for payment id not invoice } // Classify paid - if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) + if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('ClassifyPaid').''; @@ -2355,7 +2357,7 @@ else } // Validate - if ($action != 'edit' && $object->statut == 0) + if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT) { if (count($object->lines)) { From d897139f255f397f861f5e04060a7bd13e4223a1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 3 Apr 2015 06:54:08 +0200 Subject: [PATCH 007/184] Module member: move field note in note_private --- htdocs/adherents/class/adherent.class.php | 18 +++++++++--------- htdocs/adherents/note.php | 14 +++++++------- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 3 +++ htdocs/install/mysql/tables/llx_adherent.sql | 2 +- htdocs/public/members/new.php | 10 +++++----- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c8c4f9b9ad4..7a4510119dc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -77,7 +77,7 @@ class Adherent extends CommonObject var $morphy; var $public; - var $note; // Private note + var $note_private; // Private note var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $photo; @@ -310,7 +310,7 @@ class Adherent extends CommonObject $sql.= " VALUES ("; $sql.= " '".$this->db->idate($this->datec)."'"; $sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null"); - $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script + $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script $sql.= ", null, null, '".$this->morphy."'"; $sql.= ", '".$this->typeid."'"; $sql.= ", ".$conf->entity; @@ -445,9 +445,9 @@ class Adherent extends CommonObject $sql.= ", email='".$this->email."'"; $sql.= ", skype='".$this->skype."'"; $sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null"); - $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); + $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); - $sql.= ", note=" .($this->note?"'".$this->db->escape($this->note)."'":"null"); + $sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", public='".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -1053,7 +1053,7 @@ class Adherent extends CommonObject { global $langs; - $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note,"; + $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1134,7 +1134,7 @@ class Adherent extends CommonObject $this->datevalid = $this->db->jdate($obj->datev); $this->birth = $this->db->jdate($obj->birthday); - $this->note = $obj->note; + $this->note_private = $obj->note_private; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; @@ -1801,7 +1801,7 @@ class Adherent extends CommonObject $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; - $this->note='No comment'; + $this->note_private='No comment'; $this->birth=time(); $this->photo=''; $this->public=1; @@ -1874,7 +1874,7 @@ class Adherent extends CommonObject if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; - if ($this->note && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note; + if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 727b3a9bcdc..f0b202677c1 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -19,7 +19,7 @@ /** * \file htdocs/adherents/note.php * \ingroup member - * \brief Tabe for note of a member + * \brief Tab for note of a member */ require '../main.inc.php'; @@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) { $db->begin(); - $res=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); if ($res < 0) { setEventMessage($object->error, 'errors'); @@ -82,7 +82,7 @@ if ($id) dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user'); - print "
"; + print ""; print ''; print ''; @@ -129,7 +129,7 @@ if ($id) // Status print ''; - // Note + // Private note print ''; print '"; @@ -150,7 +150,7 @@ if ($id) { print ''; } diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index b1b4eccbf56..1379d7bc6c4 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -512,3 +512,6 @@ create table llx_c_price_global_variable_updater next_update integer DEFAULT 0, last_status text DEFAULT NULL )ENGINE=innodb; + +ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL; + diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index e7f9c246834..e6ffee2dc5b 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -54,7 +54,7 @@ create table llx_adherent statut smallint NOT NULL DEFAULT 0, public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? datefin datetime, -- date de fin de validite de la cotisation - note text, + note_private text DEFAULT NULL, datevalid datetime, -- date de validation datec datetime, -- date de creation tms timestamp, -- date de modification diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a6ac9ee1906..8fb06cd783e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -25,9 +25,9 @@ * \brief Example of form to add a new member * * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form + * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_NEWFORM_EDITAMOUNT Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest paypemt with paypal of paybox + * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal of paybox * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted * MEMBER_NEWFORM_FORCETYPE Force type of member @@ -40,7 +40,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. // For MultiCompany module. // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php -// TODO This should be useless. Because entity must be retreive from object ref and not from url. +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); if (is_numeric($entity)) define("DOLENTITY", $entity); @@ -138,7 +138,7 @@ function llxFooterVierge() * Actions */ -// Action called when page is submited +// Action called when page is submitted if ($action == 'add') { // test if login already exists @@ -335,7 +335,7 @@ if ($action == 'add') } } -// Action called after a submited was send and member created succesfully +// Action called after a submitted was send and member created successfully // If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url. // backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url. if ($action == 'added') From f38bf5a7d211ff016eaa589c06ecba5656be0e54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Apr 2015 11:00:52 +0200 Subject: [PATCH 008/184] Fix extrafields were not saved when creating a supplier order Fix removed hooks where we must use trigger --- htdocs/commande/class/commande.class.php | 41 ++++++++----------- .../class/fournisseur.commande.class.php | 6 +++ htdocs/fourn/commande/card.php | 14 +++---- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 259a3bc5d6a..edf380b2e36 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -790,7 +790,7 @@ class Commande extends CommonOrder $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, - $this->lines[$i]->array_options + $this->lines[$i]->array_options ); if ($result < 0) { @@ -862,28 +862,25 @@ class Commande extends CommonOrder if (! $error) { - $action='create'; + //$action='create'; // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('orderdao')); + /*$hookmanager->initHooks(array('orderdao')); $parameters=array('socid'=>$this->id); $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { + {*/ $result=$this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + if ($result < 0) $error++; + /* } } - else if ($reshook < 0) $error++; + else if ($reshook < 0) $error++;*/ } - if (! $notrigger) + if (! $error && ! $notrigger) { // Call trigger $result=$this->call_trigger('ORDER_CREATE',$user); @@ -891,29 +888,27 @@ class Commande extends CommonOrder // End call triggers } - if (!$error) { + if (! $error) + { $this->db->commit(); return $this->id; } - - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - + else + { + $this->db->rollback(); + return -1*$error; + } } else - { + { + $this->error=$this->db->lasterror(); $this->db->rollback(); return -1; } } } else - { + { dol_print_error($this->db); $this->db->rollback(); return -1; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3cd07d7fc53..f0abed84cbb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1066,6 +1066,12 @@ class CommandeFournisseur extends CommonOrder } } + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; + } + if (! $error && ! $notrigger) { // Call trigger diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index cbbeaa99499..995c493df51 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -918,22 +918,20 @@ if (empty($reshook)) } $object_id = $object->create($user); - if ($object_id > 0) { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); $srcobject = new $classname($db); - $srcobject->fetch($object->origin_id); - - $object->set_date_livraison($user, $srcobject->date_livraison); - $object->set_id_projet($user, $srcobject->fk_project); 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) { + $object->set_date_livraison($user, $srcobject->date_livraison); + $object->set_id_projet($user, $srcobject->fk_project); + $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject, 'fetch_lines')) { @@ -1010,11 +1008,11 @@ if (empty($reshook)) if ($reshook < 0) $error ++; } else { - setEventMessage($srcobject->error, 'errors'); + setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error ++; } } else { - setEventMessage($object->error, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $error ++; } } @@ -1024,7 +1022,7 @@ if (empty($reshook)) if ($id < 0) { $error++; - setEventMessage($langs->trans($object->error), 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } From b01369a32ea5c89d212149d2551f19caf412b743 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Apr 2015 15:25:24 +0200 Subject: [PATCH 009/184] Error management --- htdocs/core/class/stats.class.php | 45 +++++++++++++++++-------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 8a4ffd29d68..ff9f29f55ff 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -31,7 +31,7 @@ abstract class Stats { protected $db; var $_lastfetchdate=array(); // Dates of cache file read by methods - var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) + var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) /** * Return nb of elements by month for several years @@ -76,7 +76,7 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); } } - + // Load file into $data if ($foundintocache) // Cache file found and is not too old { @@ -203,11 +203,14 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, json_encode($data)); - fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); - + if ($fp) + { + fwrite($fp, json_encode($data)); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); + } + else dol_syslog("Failed to write cache file", LOG_ERR); $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; } @@ -309,21 +312,23 @@ abstract class Stats dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk."); if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp); $fp = fopen($newpathofdestfile, 'w'); - fwrite($fp, json_encode($data)); - fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); - + if ($fp) + { + fwrite($fp, json_encode($data)); + fclose($fp); + if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); + } $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt; } return $data; - } - - + } + + // Here we have low level of shared code called by XxxStats.class.php - + /** * Return nb of elements by year * @@ -532,8 +537,8 @@ abstract class Stats return $data; } - - + + /** * Return number or total of product refs * @@ -544,7 +549,7 @@ abstract class Stats function _getAllByProduct($sql, $limit=10) { global $langs; - + $result=array(); $res=array(); @@ -567,6 +572,6 @@ abstract class Stats else dol_print_error($this->db); return $result; - } + } } From 092dd38851e582580de4f8adf5e7863356183173 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 3 Apr 2015 15:33:41 +0200 Subject: [PATCH 010/184] =?UTF-8?q?FIX=20:=20[=20bug=20#1916=20]=20probl?= =?UTF-8?q?=C3=A8me=20d'icone=20pour=20l'=C3=A9tat=20"clos"=20sur=20les=20?= =?UTF-8?q?projets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/theme/bureau2crea/img/statut4.png | Bin 1640 -> 567 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/htdocs/theme/bureau2crea/img/statut4.png b/htdocs/theme/bureau2crea/img/statut4.png index b12bc0d000ccf86ca62574d00783a7a26d3869f7..75f9155a6d2b2bc97bf73cc16531855d5e773917 100644 GIT binary patch delta 542 zcmV+(0^$AW47UW3B!32COGiWi{{a60|De66lK=n!32;bRa{vGf6951U69E94oEQKA z00(qQO+^Ra1Op8qE{OxTN&o->#7RU!R5;6(lQC-(VHkj)_q+ElX;TDUM8UxffIsICnF2=+Ed-^l!Kdy44a~Z0JxZNb3n!js%6E$$#Z8m+$U#NPhzz%>;9-d_*wr^Iin>)2S7b;5>&iy7E zG4uw#OYaX_*A72^S_^zOM0g?fb?#>wZy&APSYW1rnK{Atl*P&rBP=N3`bkX2S2CC4iFc|r zOJW1Q_XmjJ)EMaYgz!ra_?!!8_z{oublREQGUvs)v3~<#nD)+r%;XtBM3|e2BgQ$B zG_`YW5fReV;v9)FhE^DMu{Our;=i)B1=i+-VHaa)8CABTD5lvwL1fY+Xa6h$&E^SF z6r;+P0=ud-_V+v6olf6Ws~0Jk6@WC0@r>eY8E~YjB@DYnQCz690qn}`Ia^DkDE@uU g#;~XQ>ld7V0v;^A?)HM;RsaA107*qoM6N<$f~-aQLjV8( literal 1640 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+n3Xa^B1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%s|1+P|wiV z#N6CmN5ROz&_Lh7NZ-&%*U;R`*vQJjKmiJrfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8EkR}&8R-I5=oVMzl_XZ^<`pZ$OmImpPAEg{v+u2}(t{7puX=A(aKG z`a!A1`K3k4z=%sz23b{L-^Aq1JP;qO z-q+X4Gq1QLF)umQ)5TT^Xo6m5W(qJg%}vbA91YE#%`FWLUEG`;U5uO^Ei9dkES)V3 zjm=?tUGkGlb5rw5V0u#!dW~@E1to>t0-((}MPV=C8 zQ*gV*0H+)@tD;XG=?s&R5hE&|D znS3`}BwXTH{qr+t-sPCh-=t{PyCiReqk)-XmGY8M{iPvQSG%`~=!@*>_`&|gUZX=| zkH8+m{I{VZqFkXIO(vJ3qI0$Lj?T!Ld{^bS;pUk$=l0JtR#R-Mcre%Ux$XPUbDq!n zUVHS3C;s-?`Ip?E&%c;@?jlPM%!y+`4mW z@$(5zmvT(Y|9*OMao%$Mf3_<<&aG}vYYF<0DNykL$VKIv&qqBs&D1GebMThSFLA9+ zvaA*J*2i#~zq|AF+Fo{zN#}bGIi}g^@%7C6`;EnrZ*4-a!m7Qgc>xQfa)aLd^Ex|S zQg-W)-CGWvS`|Fu)w#*S$;~HxMD?|VH#t?ewVLp3b8gKn=Qn&kH{8srFZ_96REPS`+OJe5~p=-07F1_y9>ecvh z-suN^0hu}%KAh5;|M<mRA;uehcYr{^W5w=!zw)mNSGr9-Y4iM-M5t1sbQ zUej}bp2VBCR=z8Y4E`619hXeWwRM*`B{F&0^s~QbwYe&Y@A&s2dy&eM&&=X4GW<8? zKae;-t!|O%{$obEOMJE+jAltXeKGNQ;Su>WcK_!6dzZLx_O3-8zW;R2Cq3`k&Xp~! zyhLjU?|JUvX)d}|R=+i_=70LVI{M4^cY#;KQ*YM#s7+2@ZBe@BSjL*VBkoHt?b;Q- zr* z>9nl#6`}tnGp}#d;l6AVG_|;x+opcsx@&U;XWzAuZHtkSIdeK`BmZr`Y99Rp!zD^4 zZ@( Date: Fri, 3 Apr 2015 17:17:02 +0200 Subject: [PATCH 011/184] NEW Backup and restore tool is easier to use --- htdocs/admin/tools/dolibarr_export.php | 75 +++++++++++++++++++------- htdocs/admin/tools/dolibarr_import.php | 17 ++++-- htdocs/admin/tools/export.php | 58 +++++++++++++------- htdocs/langs/en_US/admin.lang | 9 ++-- htdocs/theme/eldy/style.css.php | 2 +- 5 files changed, 117 insertions(+), 44 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index aec78f8aaac..c1f44b7c791 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -111,11 +111,6 @@ jQuery(document).ready(function() { print_fiche_titre($langs->trans("Backup"),'','setup'); print $langs->trans("BackupDesc",DOL_DATA_ROOT).'

'; -print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'
'; -print $langs->trans("BackupDescX").'

'; -print $langs->trans("BackupDesc3",DOL_DATA_ROOT).'
'; -print $langs->trans("BackupDescY").'

'; - ?> @@ -124,9 +119,29 @@ print $langs->trans("BackupDescY").'

'; name="token" value="" /> -
-'.$langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.''; ?> -
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("Note").''; if ($action == 'edit' && $user->rights->adherent->creer) @@ -137,12 +137,12 @@ if ($id) print ""; print "id."\">"; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); + $doleditor=new DolEditor('note_private',$object->note_private,'',280,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); $doleditor->Create(); } else { - print nl2br($object->note); + print dol_htmlentitiesbr($object->note_private); } print "
'; print ''; - print '   '; + print '     '; print ''; print '
+
1 + +trans("BackupDesc3",$dolibarr_main_db_name).'
'; +//print $langs->trans("BackupDescY").'
'; +print '
'; +?> + +
+ +trans("BackupDumpWizard")); + +print '
'; +print ''; +print ''; +print ''; +print '
'; +print $langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.'
'; +print '
'; +?> +
@@ -182,7 +197,7 @@ print $langs->trans("BackupDescY").'

'; $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; } ?>
-
@@ -317,7 +332,7 @@ print $langs->trans("BackupDescY").'

'; $fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; } ?>
- @@ -357,12 +372,12 @@ print $langs->trans("BackupDescY").'

';
- -
-trans("Destination"); ?> -: - +trans("Destination"); ?> --> +
+
+
+?> +
+
'; +?> -
+
+
+
admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,$langs->trans("NoBackupFileAvailable"),0,$langs->trans("PreviousDumpFiles")); print '
'; +?> +
+
+ + + +
+ +
2 +trans("BackupDesc2",DOL_DATA_ROOT).'
'; +print $langs->trans("BackupDescX").'

'; +?> +
+ + + + +trans("Restore"),'','setup'); print $langs->trans("RestoreDesc",DOL_DATA_ROOT).'

'; +?> +
+1 +trans("RestoreDesc2",DOL_DATA_ROOT).'

'; -print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'

'; +?> +
+
+ +
+2 +trans("RestoreDesc3",$dolibarr_main_db_name).'

'; ?> -
-'.$langs->trans("DatabaseName").' : '.$dolibarr_main_db_name.''; ?> +trans("DatabaseName").' : '.$dolibarr_main_db_name.''; ?>

+ '; - print ''; + print ''; print ''; print ''; print ''; From 5fa21f37f042d725331c6c415551110eca909236 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Apr 2015 17:13:24 +0200 Subject: [PATCH 023/184] Fix trim label --- 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 34e86acee60..c661a3d7bda 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2871,7 +2871,7 @@ class Form { print ''; $i++; From 03b1db138e9e8f706073c5464e5c8f80178e204d Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 6 Apr 2015 08:20:23 +0200 Subject: [PATCH 024/184] Debug --- htdocs/adherents/note.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index f0b202677c1..3a938e74034 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -54,7 +54,7 @@ if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) { $db->begin(); - $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES)); + $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private'); if ($res < 0) { setEventMessage($object->error, 'errors'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d240c13110b..ac87f1e693d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1611,7 +1611,7 @@ abstract class CommonObject } if (! in_array($suffix,array('','_public','_private'))) { - dol_syslog(get_class($this)."::upate_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); + dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); return -2; } From f40bb3e6aaf31820489d1a43173ab05ff38ea9ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 11:05:16 +0200 Subject: [PATCH 025/184] fix phpcs --- test/bootstrap.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/bootstrap.php b/test/bootstrap.php index 6e80411dca6..27a5be97508 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -1,3 +1,26 @@ + * + * 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 + * (at your option) any later version. + * + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file test/bootstrap.php + * \ingroup test + * \brief PHPUnit test + * \remarks To make test with phpunit + */ + set_time_limit(0); -?> From 8fb14b122ac58f6f8c3f59ac68e38c76166e8cbe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 11:28:06 +0200 Subject: [PATCH 026/184] Fix phpcs --- htdocs/core/db/Database.interface.php | 306 +++++++++++++------------- htdocs/core/db/DoliDB.class.php | 4 +- 2 files changed, 155 insertions(+), 155 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 0fbf22b0745..f27c4e75189 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -26,95 +26,95 @@ interface Database { /** - * Format a SQL IF + * Format a SQL IF * - * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') - * @param string $resok resultat si test egal - * @param string $resko resultat si test non egal - * @return string SQL string + * @param string $test Test string (example: 'cd.statut=0', 'field IS NULL') + * @param string $resok resultat si test egal + * @param string $resko resultat si test non egal + * @return string SQL string */ function ifsql($test, $resok, $resko); /** - * Return datas as an array + * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param resource $resultset Resultset of request + * @return array Array */ function fetch_row($resultset); /** - * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. - * Function to use to build INSERT, UPDATE or WHERE predica + * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. + * Function to use to build INSERT, UPDATE or WHERE predica * - * @param string $param Date TMS to convert - * @return string Date in a string YYYYMMDDHHMMSS + * @param int $param Date TMS to convert + * @return string Date in a string YYYYMMDDHHMMSS */ function idate($param); /** - * Return last error code + * Return last error code * - * @return string lasterrno + * @return string lasterrno */ function lasterrno(); /** * Start transaction * - * @return int 1 if transaction successfuly opened or already opened, 0 if error + * @return int 1 if transaction successfuly opened or already opened, 0 if error */ function begin(); /** - * Create a new database - * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated - * We force to create database with charset this->forcecharset and collate this->forcecollate + * Create a new database + * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated + * We force to create database with charset this->forcecharset and collate this->forcecollate * - * @param string $database Database name to create - * @param string $charset Charset used to store data - * @param string $collation Charset used to sort data - * @param string $owner Username of database owner - * @return resource resource defined if OK, null if KO + * @param string $database Database name to create + * @param string $charset Charset used to store data + * @param string $collation Charset used to sort data + * @param string $owner Username of database owner + * @return resource resource defined if OK, null if KO */ function DDLCreateDb($database, $charset = '', $collation = '', $owner = ''); /** - * Return version of database server into an array + * Return version of database server into an array * - * @return array Version array + * @return array Version array */ function getVersionArray(); /** * Convert a SQL request in Mysql syntax to native syntax * - * @param string $line SQL request line to convert - * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return string SQL request line converted + * @param string $line SQL request line to convert + * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) + * @return string SQL request line converted */ static function convertSQLFromMysql($line, $type = 'ddl'); /** - * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE + * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * - * @param resource $resultset Curseur de la requete voulue - * @return int Nombre de lignes - * @see num_rows + * @param resource $resultset Curseur de la requete voulue + * @return int Nombre de lignes + * @see num_rows */ function affected_rows($resultset); /** - * Return description of last error + * Return description of last error * - * @return string Error text + * @return string Error text */ function error(); /** * Return label of manager * - * @return string Label + * @return string Label */ function getLabel(); @@ -128,58 +128,58 @@ interface Database function DDLListTables($database, $table = ''); /** - * Return last request executed with query() + * Return last request executed with query() * - * @return string Last query + * @return string Last query */ function lastquery(); /** * Define sort criteria of request * - * @param string $sortfield List of sort fields - * @param string $sortorder Sort order - * @return string String to provide syntax of a sort sql string + * @param string $sortfield List of sort fields + * @param string $sortorder Sort order + * @return string String to provide syntax of a sort sql string */ function order($sortfield = 0, $sortorder = 0); /** - * Decrypt sensitive data in database + * Decrypt sensitive data in database * * @param string $value Value to decrypt - * @return string Decrypted value if used + * @return string Decrypted value if used */ function decrypt($value); /** * Return datas as an array * - * @param resource $resultset Resultset of request - * @return array Array + * @param resource $resultset Resultset of request + * @return array Array */ function fetch_array($resultset); /** - * Return last error label + * Return last error label * - * @return string lasterror + * @return string lasterror */ function lasterror(); /** - * Escape a string to insert data + * Escape a string to insert data * - * @param string $stringtoencode String to escape - * @return string String escaped + * @param string $stringtoencode String to escape + * @return string String escaped */ function escape($stringtoencode); /** * Get last ID after an insert INSERT * - * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql - * @param string $fieldid Field name - * @return int Id of row + * @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql + * @param string $fieldid Field name + * @return int Id of row */ function last_insert_id($tab, $fieldid = 'rowid'); @@ -193,186 +193,186 @@ interface Database /** * Annulation d'une transaction et retour aux anciennes valeurs * - * @param string $log Add more log to default log line - * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur + * @param string $log Add more log to default log line + * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur */ function rollback($log = ''); /** * Execute a SQL request and return the resultset * - * @param string $query SQL query string - * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). + * @param string $query SQL query string + * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) - * @return resource Resultset of answer + * @return resource Resultset of answer */ function query($query, $usesavepoint = 0, $type = 'auto'); /** * Connexion to server * - * @param string $host database server host - * @param string $login login - * @param string $passwd password - * @param string $name name of database (not used for mysql, used for pgsql) - * @param string $port Port of database server - * @return resource Database access handler - * @see close + * @param string $host database server host + * @param string $login login + * @param string $passwd password + * @param string $name name of database (not used for mysql, used for pgsql) + * @param string $port Port of database server + * @return resource Database access handler + * @see close */ function connect($host, $login, $passwd, $name, $port = 0); /** * Define limits and offset of request * - * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) - * @param int $offset Numero of line from where starting fetch - * @return string String with SQL syntax to add a limit and offset + * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit) + * @param int $offset Numero of line from where starting fetch + * @return string String with SQL syntax to add a limit and offset */ function plimit($limit = 0, $offset = 0); /** * Return value of server parameters * - * @param string $filter Filter list on a particular value - * @return array Array of key-values (key=>value) + * @param string $filter Filter list on a particular value + * @return array Array of key-values (key=>value) */ function getServerParametersValues($filter = ''); /** - * Return value of server status + * Return value of server status * - * @param string $filter Filter list on a particular value - * @return array Array of key-values (key=>value) + * @param string $filter Filter list on a particular value + * @return array Array of key-values (key=>value) */ function getServerStatusValues($filter = ''); /** - * Return collation used in database + * Return collation used in database * - * @return string Collation value + * @return string Collation value */ function getDefaultCollationDatabase(); /** - * Return number of lines for result of a SELECT + * Return number of lines for result of a SELECT * - * @param resource $resultset Resulset of requests - * @return int Nb of lines - * @see affected_rows + * @param resource $resultset Resulset of requests + * @return int Nb of lines + * @see affected_rows */ function num_rows($resultset); /** - * Return full path of dump program + * Return full path of dump program * * @return string Full path of dump program */ function getPathOfDump(); /** - * Return version of database client driver + * Return version of database client driver * * @return string Version string */ function getDriverInfo(); /** - * Return generic error code of last operation. + * Return generic error code of last operation. * * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) */ function errno(); /** - * Create a table into database + * Create a table into database * - * @param string $table Nom de la table - * @param array $fields Tableau associatif [nom champ][tableau des descriptions] - * @param string $primary_key Nom du champ qui sera la clef primaire - * @param string $type Type de la table - * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur - * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext - * @param string $keys Tableau des champs cles noms => valeur - * @return int <0 if KO, >=0 if OK + * @param string $table Nom de la table + * @param array $fields Tableau associatif [nom champ][tableau des descriptions] + * @param string $primary_key Nom du champ qui sera la clef primaire + * @param string $type Type de la table + * @param array $unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur + * @param array $fulltext_keys Tableau des Nom de champs qui seront indexes en fulltext + * @param string $keys Tableau des champs cles noms => valeur + * @return int <0 if KO, >=0 if OK */ function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = "", $fulltext_keys = "", $keys = ""); /** - * Return list of available charset that can be used to store data in database + * Return list of available charset that can be used to store data in database * * @return array List of Charset */ function getListOfCharacterSet(); /** - * Create a new field into table + * Create a new field into table * - * @param string $table Name of table - * @param string $field_name Name of field to add - * @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre] - * @param string $field_position Optionnel ex.: "after champtruc" - * @return int <0 if KO, >0 if OK + * @param string $table Name of table + * @param string $field_name Name of field to add + * @param string $field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre] + * @param string $field_position Optionnel ex.: "after champtruc" + * @return int <0 if KO, >0 if OK */ function DDLAddField($table, $field_name, $field_desc, $field_position = ""); /** - * Drop a field from table + * Drop a field from table * - * @param string $table Name of table - * @param string $field_name Name of field to drop - * @return int <0 if KO, >0 if OK + * @param string $table Name of table + * @param string $field_name Name of field to drop + * @return int <0 if KO, >0 if OK */ function DDLDropField($table, $field_name); /** - * Update format of a field into a table + * Update format of a field into a table * - * @param string $table Name of table - * @param string $field_name Name of field to modify - * @param string $field_desc Array with description of field format - * @return int <0 if KO, >0 if OK + * @param string $table Name of table + * @param string $field_name Name of field to modify + * @param string $field_desc Array with description of field format + * @return int <0 if KO, >0 if OK */ function DDLUpdateField($table, $field_name, $field_desc); /** - * Return list of available collation that can be used for database + * Return list of available collation that can be used for database * - * @return array List of Collation + * @return array List of Collation */ function getListOfCollation(); /** - * Return a pointer of line with description of a table or field + * Return a pointer of line with description of a table or field * - * @param string $table Name of table - * @param string $field Optionnel : Name of field if we want description of field - * @return resource Resource + * @param string $table Name of table + * @param string $field Optionnel : Name of field if we want description of field + * @return resource Resource */ function DDLDescTable($table, $field = ""); /** - * Return version of database server + * Return version of database server * - * @return string Version string + * @return string Version string */ function getVersion(); /** - * Return charset used to store data in database + * Return charset used to store data in database * - * @return string Charset + * @return string Charset */ function getDefaultCharacterSetDatabase(); /** - * Create a user and privileges to connect to database (even if database does not exists yet) + * Create a user and privileges to connect to database (even if database does not exists yet) * - * @param string $dolibarr_main_db_host Ip serveur - * @param string $dolibarr_main_db_user Nom user a creer - * @param string $dolibarr_main_db_pass Mot de passe user a creer - * @param string $dolibarr_main_db_name Database name where user must be granted - * @return int <0 if KO, >=0 if OK + * @param string $dolibarr_main_db_host Ip serveur + * @param string $dolibarr_main_db_user Nom user a creer + * @param string $dolibarr_main_db_pass Mot de passe user a creer + * @param string $dolibarr_main_db_name Database name where user must be granted + * @return int <0 if KO, >=0 if OK */ function DDLCreateUser( $dolibarr_main_db_host, @@ -382,85 +382,85 @@ interface Database ); /** - * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 19700101020000 -> 3600 with TZ+1 and gmt=0 + * 19700101020000 -> 7200 whaterver is TZ if gmt=1 * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return timestamp|string Date TMS + * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) + * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return int|string Date TMS or '' */ function jdate($string, $gm=false); /** - * Encrypt sensitive data in database - * Warning: This function includes the escape, so it must use direct value + * Encrypt sensitive data in database + * Warning: This function includes the escape, so it must use direct value * - * @param string $fieldorvalue Field name or value to encrypt - * @param int $withQuotes Return string with quotes - * @return string XXX(field) or XXX('value') or field or 'value' + * @param string $fieldorvalue Field name or value to encrypt + * @param int $withQuotes Return string with quotes + * @return string XXX(field) or XXX('value') or field or 'value' */ function encrypt($fieldorvalue, $withQuotes = 0); /** * Validate a database transaction * - * @param string $log Add more log to default log line - * @return int 1 if validation is OK or transaction level no started, 0 if ERROR + * @param string $log Add more log to default log line + * @return int 1 if validation is OK or transaction level no started, 0 if ERROR */ function commit($log = ''); /** - * List information of columns into a table. + * List information of columns into a table. * - * @param string $table Name of table - * @return array Tableau des informations des champs de la table + * @param string $table Name of table + * @return array Array with inforation on table */ function DDLInfoTable($table); /** - * Free last resultset used. + * Free last resultset used. * - * @param resource $resultset Curseur de la requete voulue - * @return void + * @param resource $resultset Fre cursor + * @return void */ function free($resultset = 0); /** - * Close database connexion + * Close database connexion * - * @return boolean True if disconnect successfull, false otherwise - * @see connect + * @return boolean True if disconnect successfull, false otherwise + * @see connect */ function close(); /** - * Return last query in error + * Return last query in error * - * @return string lastqueryerror + * @return string lastqueryerror */ function lastqueryerror(); /** * Return connexion ID * - * @return string Id connexion + * @return string Id connexion */ function DDLGetConnectId(); /** - * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * Renvoie la ligne courante (comme un objet) pour le curseur resultset * - * @param resource $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param resource $resultset Curseur de la requete voulue + * @return Object Object result line or false if KO or end of cursor */ function fetch_object($resultset); /** - * Select a database + * Select a database * - * @param string $database Name of database - * @return boolean true if OK, false if KO + * @param string $database Name of database + * @return boolean true if OK, false if KO */ function select_db($database); diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index c7177475a34..0aae168be79 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -82,7 +82,7 @@ abstract class DoliDB implements Database * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Function to use to build INSERT, UPDATE or WHERE predica * - * @param string $param Date TMS to convert + * @param int $param Date TMS to convert * @return string Date in a string YYYYMMDDHHMMSS */ function idate($param) @@ -271,7 +271,7 @@ abstract class DoliDB implements Database * * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ - * @return int|string Date TMS + * @return int|string Date TMS or '' */ function jdate($string, $gm=false) { From 2627662f5c52c3e8da959b6121c586e238cf804d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 11:36:31 +0200 Subject: [PATCH 027/184] fix value ust be a string --- htdocs/comm/action/class/ical.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index e7bddb8bd7e..54f97fa2117 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -220,8 +220,8 @@ class ICal } if (($key == "DTSTAMP") or ($key == "LAST-MODIFIED") or ($key == "CREATED")) $value = $this->ical_date_to_unix($value); - if ($key == "RRULE" ) $value = $this->ical_rrule($value); - + //if ($key == "RRULE" ) $value = $this->ical_rrule($value); + if (stristr($key,"DTSTART") or stristr($key,"DTEND") or stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE")) { if (stristr($key,"DTSTART;VALUE=DATE") or stristr($key,"DTEND;VALUE=DATE")) From a5c74a7d959cdb3ad3824450a6ddab51e0584696 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 11:59:58 +0200 Subject: [PATCH 028/184] Clean code --- htdocs/core/class/dolprintipp.class.php | 95 +------------------------ htdocs/printing/index.php | 4 +- 2 files changed, 3 insertions(+), 96 deletions(-) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 252b742cc9d..4b934b331f3 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -18,7 +18,7 @@ /** * \file htdocs/core/class/dolprintipp.class.php - * \brief A set of functions for using printIPP + * \brief List jobs printed with driver printipp */ /** @@ -57,78 +57,6 @@ class dolprintIPP } - /** - * Return list of available printers - * - * @return array list of printers - */ - function getlist_available_printers() - { - global $conf,$db; - include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; - $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose - $ipp->setHost($this->host); - $ipp->setPort($this->port); - $ipp->setUserName($this->userid); - if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); - $ipp->getPrinters(); - return $ipp->available_printers; - } - - /** - * Print selected file - * - * @param string $file file - * @param string $module module - * - * @return string '' if OK, Error message if KO - */ - function print_file($file, $module) - { - global $conf,$db; - - include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; - - $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose - $ipp->setHost($this->host); - $ipp->setPort($this->port); - $ipp->setJobName($file,true); - $ipp->setUserName($this->userid); - if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); - - // select printer uri for module order, propal,... - $sql = 'SELECT rowid,printer_uri,copy FROM '.MAIN_DB_PREFIX.'printer_ipp WHERE module="'.$module.'"'; - $result = $this->db->query($sql); - if ($result) - { - $obj = $this->db->fetch_object($result); - if ($obj) - { - $ipp->setPrinterURI($obj->printer_uri); - } - else - { - if (! empty($conf->global->PRINTIPP_URI_DEFAULT)) - { - $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); - } - else - { - return 'NoDefaultPrinterDefined'; - } - } - } - - // Set number of copy - $ipp->setCopies($obj->copy); - $ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file); - $ipp->printJob(); - - return ''; - } - /** * List jobs print * @@ -191,25 +119,4 @@ class dolprintIPP print "
use_javascript_ajax) { ?> diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 1668e4f4c67..ba3da7b443c 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -88,10 +88,10 @@ if (!empty($MemoryLimit)) $form=new Form($db); $formfile = new FormFile($db); -$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; -llxHeader('','',$help_url); +//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; +//llxHeader('','',$help_url); -print_fiche_titre($langs->trans("Backup"),'','setup'); +//print_fiche_titre($langs->trans("Backup"),'','setup'); // Start with empty buffer @@ -165,13 +165,18 @@ if ($what == 'mysql') $paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"'; } + $_SESSION["commandbackuplastdone"]=$command." ".$paramcrypted; + $_SESSION["commandbackuptorun"]=""; + /* print ''.$langs->trans("RunCommandSummary").':
'."\n"; print '
'."\n"; print '
'; + //print $paramclear; // Now run command and show result print ''.$langs->trans("BackupResult").': '; + */ $errormsg=''; @@ -264,6 +269,9 @@ if ($what == 'mysqlnobin') { backup_tables($outputfile); } + + $_SESSION["commandbackuplastdone"]=""; + $_SESSION["commandbackuptorun"]=""; } // POSTGRESQL @@ -320,7 +328,9 @@ if ($what == 'postgresql') $paramcrypted.=" -w ".$dolibarr_main_db_name; $paramclear.=" -w ".$dolibarr_main_db_name; - print $langs->trans("RunCommandSummaryToLaunch").':
'."\n"; + $_SESSION["commandbackuplastdone"]=""; + $_SESSION["commandbackuptorun"]=$command." ".$paramcrypted; + /*print $langs->trans("RunCommandSummaryToLaunch").':
'."\n"; print '
'."\n"; print '
'; @@ -330,7 +340,7 @@ if ($what == 'postgresql') print $langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user); print '
'; - print '
'; + print '
';*/ $what=''; } @@ -339,34 +349,46 @@ if ($what == 'postgresql') // Si on a demande une generation -if ($what) -{ +//if ($what) +//{ if ($errormsg) { + setEventMessage($langs->trans("Error")." : ".$errormsg, 'errors'); + /* print '
'.$langs->trans("Error")." : ".$errormsg.'
'; - // print ''.$langs->trans("DownloadErrorFile").'
'; - print '
'; print '
'; + print '
';*/ } else - { - print '
'; - print $langs->trans("BackupFileSuccessfullyCreated").'.
'; - print $langs->trans("YouCanDownloadBackupFile"); - print '
'; - print '
'; + { + if ($what) + { + setEventMessage($langs->trans("BackupFileSuccessfullyCreated").'.
'.$langs->trans("YouCanDownloadBackupFile")); + /*print '
'; + print $langs->trans("BackupFileSuccessfullyCreated").'.
'; + print $langs->trans("YouCanDownloadBackupFile"); + print '
'; + print '
';*/ + } + else + { + setEventMessage($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user)); + } } -} +//} +/* $filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'
'.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles")); print '
'; +*/ + +// Redirect t backup page +header("Location: dolibarr_export.php"); $time_end = time(); -llxFooter(); - $db->close(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3d767ba8524..b24e108c80f 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1018,14 +1018,14 @@ NoEventOrNoAuditSetup=No security event has been recorded yet. This can be norma NoEventFoundWithCriteria=No security event has been found for such search criterias. SeeLocalSendMailSetup=See your local sendmail setup BackupDesc=To make a complete backup of Dolibarr, you must: -BackupDesc2=* Save content of documents directory (%s) that contains all uploaded and generated files (you can make a zip for example). -BackupDesc3=* Save content of your database into a dump file. For this, you can use following assistant. +BackupDesc2=Save content of documents directory (%s) that contains all uploaded and generated files (you can make a zip for example). +BackupDesc3=Save content of your database (%s) into a dump file. For this, you can use following assistant. BackupDescX=Archived directory should be stored in a secure place. BackupDescY=The generated dump file should be stored in a secure place. BackupPHPWarning=Backup can't be guaranted with this method. Prefer previous one RestoreDesc=To restore a Dolibarr backup, you must: -RestoreDesc2=* Restore archive file (zip file for example) of documents directory to extract tree of files in documents directory of a new Dolibarr installation or into this current documents directoy (%s). -RestoreDesc3=* Restore the data, from a backup dump file, into the database of the new Dolibarr installation or into the database of this current installation. Warning, once restore is finished, you must use a login/password, that existed when backup was made, to connect again. To restore a backup database into this current installation, you can follow this assistant. +RestoreDesc2=Restore archive file (zip file for example) of documents directory to extract tree of files in documents directory of a new Dolibarr installation or into this current documents directoy (%s). +RestoreDesc3=Restore the data, from a backup dump file, into the database of the new Dolibarr installation or into the database of this current installation (%s). Warning, once restore is finished, you must use a login/password, that existed when backup was made, to connect again. To restore a backup database into this current installation, you can follow this assistant. RestoreMySQL=MySQL import ForcedToByAModule= This rule is forced to %s by an activated module PreviousDumpFiles=Available database backup dump files @@ -1616,3 +1616,4 @@ ListOfNotificationsPerContact=List of notifications per contact* ListOfFixedNotifications=List of fixed notifications GoOntoContactCardToAddMore=Go on the tab "Notifications" of a thirdparty contact to add or remove notifications for contacts/addresses Threshold=Threshold +BackupDumpWizard=Wizard to build database backup dump file diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0537d13b80d..b356f570cba 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -269,7 +269,7 @@ input, textarea, select { border-bottom:solid 1px rgba(0,0,0,.2); /* box-shadow: 1px 1px 1px rgba(0,0,0,.2) inset;*/ padding:4px; - margin-left:1px; + margin-left:0px; margin-bottom:1px; margin-top:1px; } From afecab3f39fb7cffc9e80b445c804dbde175a546 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Apr 2015 18:42:07 +0200 Subject: [PATCH 012/184] Better error management for dol_uncompress --- htdocs/core/lib/files.lib.php | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 8cf4bb3473e..bb8d9c9adfd 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1261,19 +1261,40 @@ function dol_compress_file($inputfile, $outputfile, $mode="gz") */ function dol_uncompress($inputfile,$outputdir) { - global $conf; + global $conf, $langs; if (defined('ODTPHP_PATHTOPCLZIP')) { + dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".constant('ODTPHP_PATHTOPCLZIP').", so we use Pclzip to unzip into ".$outputdir); include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; $archive = new PclZip($inputfile); - if ($archive->extract(PCLZIP_OPT_PATH, $outputdir) == 0) return array('error'=>$archive->errorInfo(true)); - else return array(); + $result=$archive->extract(PCLZIP_OPT_PATH, $outputdir); + //var_dump($result); + if (! is_array($result) && $result <= 0) return array('error'=>$archive->errorInfo(true)); + else + { + $ok=1; $errmsg=''; + // Loop on each file to check result for unzipping file + foreach($result as $key => $val) + { + if ($val['status'] == 'path_creation_fail') + { + $langs->load("errors"); + $ok=0; + $errmsg=$langs->trans("ErrorFailToCreateDir", $val['filename']); + break; + } + } + + if ($ok) return array(); + else return array('error'=>$errmsg); + } } if (class_exists('ZipArchive')) { - $zip = new ZipArchive; + dol_syslog("Class ZipArchive is set so we unzip using ZipArchive to unzip into ".$outputdir); + $zip = new ZipArchive; $res = $zip->open($inputfile); if ($res === TRUE) { From 106a39305496e80fcd46e533842863c03a3a2a9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Apr 2015 23:42:56 +0200 Subject: [PATCH 013/184] NEW Add function dolCopyDir to copy directory with recursive content. --- htdocs/core/lib/files.lib.php | 75 +++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bb8d9c9adfd..d9bae4b5ecb 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -477,15 +477,19 @@ function dol_filemtime($pathoffile) * * @param string $srcfile Source file (can't be a directory) * @param string $destfile Destination file (can't be a directory) - * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) + * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666' * @param int $overwriteifexists Overwrite file if exists (1 by default) * @return int <0 if error, 0 if nothing done (dest file already exists and overwriteifexists=0), >0 if OK + * @see dolCopyr */ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1) { global $conf; dol_syslog("files.lib.php::dol_copy srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists); + + if (empty($srcfile) || empty($destfile)) return -1; + $destexists=dol_is_file($destfile); if (! $overwriteifexists && $destexists) return 0; @@ -523,12 +527,77 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1) return 1; } +/** + * Copy a dir to another dir. + * + * @param string $srcfile Source file (a directory) + * @param string $destfile Destination file (a directory) + * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0666' + * @param int $overwriteifexists Overwrite file if exists (1 by default) + * @return int <0 if error, 0 if nothing done (dest dir already exists and overwriteifexists=0), >0 if OK + * @see dol_copy + */ +function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists) +{ + global $conf; + + $result=0; + + dol_syslog("files.lib.php::dolCopyr srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists); + + if (empty($srcfile) || empty($destfile)) return -1; + + $destexists=dol_is_dir($destfile); + if (! $overwriteifexists && $destexists) return 0; + + $srcfile=dol_osencode($srcfile); + $destfile=dol_osencode($destfile); + + // recursive function to copy + // all subdirectories and contents: + if (is_dir($srcfile)) + { + $dir_handle=opendir($srcfile); + while ($file=readdir($dir_handle)) + { + if ($file!="." && $file!="..") + { + if (is_dir($srcfile."/".$file)) + { + if (!is_dir($destfile."/".$file)) + { + umask(0); + $dirmaskdec=octdec($newmask); + if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK); + $dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files + dol_mkdir($destfile."/".$file, '', decoct($dirmaskdec)); + } + $result=dolCopyDir($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists); + } + else + { + $result=dol_copy($srcfile."/".$file, $destfile."/".$file, $newmask, $overwriteifexists); + } + if ($result < 0) break; + } + } + closedir($dir_handle); + } + else + { + $result=dol_copy($srcfile, $destfile, $newmask, $overwriteifexists); + } + + return $result; +} + + /** * Move a file into another name. * This function differs from dol_move_uploaded_file, because it can be called in any context. * - * @param string $srcfile Source file (can't be a directory) - * @param string $destfile Destination file (can't be a directory) + * @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory) + * @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory) * @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) * @param int $overwriteifexists Overwrite file if exists (1 by default) * @return boolean True if OK, false if KO From 2ec5595277eb0e3c5a4a3e042b5ffac04fa4d065 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2015 00:19:03 +0200 Subject: [PATCH 014/184] NEW Can install an external module from admin pages, if web server has permission for and if setup is ok for. --- htdocs/admin/tools/update.php | 164 +++++++++++++++--- htdocs/core/lib/functions.lib.php | 7 +- .../modules/syslog/mod_syslog_chromephp.php | 2 +- htdocs/langs/en_US/admin.lang | 7 +- 4 files changed, 150 insertions(+), 30 deletions(-) diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 7c85f820eab..27799ff1e93 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -29,6 +29,8 @@ include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php'; $langs->load("admin"); $langs->load("other"); +$action=GETPOST('action','alpha'); + if (! $user->admin) accessforbidden(); if (GETPOST('msg','alpha')) { @@ -43,14 +45,18 @@ $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT); $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot); $dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT); +$dirins=DOL_DOCUMENT_ROOT.'/custom'; + + /* * Actions */ -if (GETPOST('action','alpha')=='install') +if ($action=='install') { $error=0; + // $original_file should match format module_modulename-x.y[.z].zip $original_file=basename($_FILES["fileinstall"]["name"]); $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; @@ -72,33 +78,87 @@ if (GETPOST('action','alpha')=='install') if (! $error) { - @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); - dol_mkdir($conf->admin->dir_temp.'/'.$original_file); + if ($original_file) + { + @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); + dol_mkdir($conf->admin->dir_temp.'/'.$original_file); + } + + $tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir'; + if ($tmpdir) + { + @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir); + dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir); + } $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']); if ($result > 0) { - $documentrootalt=DOL_DOCUMENT_ROOT.'/extensions'; - $result=dol_uncompress($newfile,$documentrootalt); + $result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir); + if (! empty($result['error'])) { $langs->load("errors"); setEventMessage($langs->trans($result['error'],$original_file), 'errors'); + $error++; } else { - setEventMessage($langs->trans("SetupIsReadyForUse")); + // Now we move the dir of the module + $modulename=preg_replace('/module_/', '', $original_file); + $modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename); + // Search dir $modulename + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; + //var_dump($modulenamedir); + if (! dol_is_dir($modulenamedir)) + { + $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; + //var_dump($modulenamedir); + if (! dol_is_dir($modulenamedir)) + { + setEventMessage($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), 'errors'); + $error++; + } + } + + if (! $error) + { + //var_dump($dirins); + @dol_delete_dir_recursive($dirins.'/'.$modulename); + $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1); + if ($result <= 0) + { + setEventMessage($langs->trans("ErrorFailedToCopy"), 'errors'); + $error++; + } + } } } + else + { + $error++; + } + } + + if (! $error) + { + setEventMessage($langs->trans("SetupIsReadyForUse")); } } + /* * View */ -$dirins=DOL_DOCUMENT_ROOT.'/extensions'; -$dirins_ok=(is_dir($dirins)); + + +// Set dir where external modules are installed +if (! dol_is_dir($dirins)) +{ + dol_mkdir($dirins); +} +$dirins_ok=(dol_is_dir($dirins)); $wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización'; llxHeader('',$langs->trans("Upgrade"),$wikihelp); @@ -143,6 +203,8 @@ else } print '
'; + +// Upgrade print $langs->trans("Upgrade").'
'; print '
'; print $langs->trans("ThisIsProcessToFollow").'
'; @@ -162,20 +224,76 @@ print $langs->trans("RestoreLock",$dolibarrdataroot.'/install.lock').'
'; print '
'; print '
'; + +// Install external module + +$allowonlineinstall=true; +$allowfromweb=1; +if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false; + $fullurl=''.$urldolibarrmodules.''; +$message=''; +if (! empty($allowonlineinstall)) +{ + if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt))) + { + $message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); + $allowfromweb=-1; + } + else + { + if ($dirins_ok) + { + if (! is_writable(dol_osencode($dirins))) + { + $langs->load("errors"); + $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); + $allowfromweb=0; + } + } + else + { + + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); + $allowfromweb=0; + } + } +} +else +{ + $message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock')); + $allowfromweb=0; +} + + + + + print $langs->trans("AddExtensionThemeModuleOrOther").'
'; print '
'; -print $langs->trans("ThisIsProcessToFollow").'
'; -print ''.$langs->trans("StepNb",1).': '; -print $langs->trans("FindPackageFromWebSite",$fullurl).'
'; -print ''.$langs->trans("StepNb",2).': '; -print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
'; -print ''.$langs->trans("StepNb",3).': '; -print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'
'; -if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) + +if ($allowfromweb < 1) { - if ($dirins_ok) + print $langs->trans("SomethingMakeInstallFromWebNotPossible"); + print $message; + //print $langs->trans("SomethingMakeInstallFromWebNotPossible2"); + print '
'; +} + + +if ($allowfromweb >= 0) +{ + if ($allowfromweb == 1) print $langs->trans("ThisIsProcessToFollow").'
'; + else print $langs->trans("ThisIsAlternativeProcessToFollow").'
'; + print ''.$langs->trans("StepNb",1).': '; + print $langs->trans("FindPackageFromWebSite",$fullurl).'
'; + print ''.$langs->trans("StepNb",2).': '; + print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
'; + print ''.$langs->trans("StepNb",3).': '; + + if ($allowfromweb == 1) { + print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'
'; print '
'; print ''; print $langs->trans("YouCanSubmitFile").' '; @@ -184,16 +302,12 @@ if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE)) } else { - $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); - setEventMessage($message, 'warnings'); + print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'
'; + print ''.$langs->trans("StepNb",4).': '; + print $langs->trans("SetupIsReadyForUse").'
'; } } -else -{ - print ''.$langs->trans("StepNb",4).': '; - print $langs->trans("SetupIsReadyForUse").'
'; -} -print '
'; + if (! empty($result['return'])) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f687d79bcd1..d2465afff22 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3728,9 +3728,10 @@ function get_exdir($num,$level=3,$alpha=0,$withoutslash=0) * * @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir') * @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used) + * @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK). Example: '0444' * @return int < 0 if KO, 0 = already exists, > 0 if OK */ -function dol_mkdir($dir, $dataroot='') +function dol_mkdir($dir, $dataroot='', $newmask=0) { global $conf; @@ -3767,8 +3768,8 @@ function dol_mkdir($dir, $dataroot='') dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.",LOG_DEBUG); umask(0); - $dirmaskdec=octdec('0755'); - if (! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK); + $dirmaskdec=octdec($newmask); + if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK); $dirmaskdec |= octdec('0111'); // Set x bit required for directories if (! @mkdir($ccdir_osencoded, $dirmaskdec)) { diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index 3e24901f5af..9ea39caaf50 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -55,7 +55,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); //print 'rrrrr'.get_include_path(); - $res = include_once('ChromePhp.php'); + $res = @include_once('ChromePhp.php'); if (! $res) $res=@include_once('ChromePhp.class.php'); restore_include_path(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b24e108c80f..984b9717dab 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -297,10 +297,11 @@ MenuHandlers=Menu handlers MenuAdmin=Menu editor DoNotUseInProduction=Do not use in production ThisIsProcessToFollow=This is setup to process: +ThisIsAlternativeProcessToFollow=This is an alternative setup to process: StepNb=Step %s FindPackageFromWebSite=Find a package that provides feature you want (for example on official web site %s). DownloadPackageFromWebSite=Download package %s. -UnpackPackageInDolibarrRoot=Unpack package file into Dolibarr's root directory %s +UnpackPackageInDolibarrRoot=Unpack package file into directory dedicated to external modules: %s SetupIsReadyForUse=Install is finished and Dolibarr is ready to use with this new component. NotExistsDirect=The alternative root directory is not defined.
InfDirAlt=Since version 3 it is possible to define an alternative root directory.This allows you to store, same place, plug-ins and custom templates.
Just create a directory at the root of Dolibarr (eg: custom).
@@ -1617,3 +1618,7 @@ ListOfFixedNotifications=List of fixed notifications GoOntoContactCardToAddMore=Go on the tab "Notifications" of a thirdparty contact to add or remove notifications for contacts/addresses Threshold=Threshold BackupDumpWizard=Wizard to build database backup dump file +SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: +SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do. +InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file %s to allow this feature. +ConfFileMuseContainCustom=Installing an external module from application save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to have option
- $dolibarr_main_url_root_alt enabled to value $dolibarr_main_url_root_alt="/custom"
- $dolibarr_main_document_root_alt enabled to value "%s/custom" \ No newline at end of file From 9f5ba746a1695718a42ff1f9d6b7b7e76a38fd4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2015 00:51:00 +0200 Subject: [PATCH 015/184] Update phpunit tests --- test/phpunit/BuildDocTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index 99098c432ea..c21c482ab5e 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -109,7 +109,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase if (! $conf->projet->enabled) { print __METHOD__." project module not enabled\n"; die(); } if (! $conf->expedition->enabled) { print __METHOD__." shipment module not enabled\n"; die(); } if (! $conf->ficheinter->enabled) { print __METHOD__." intervention module not enabled\n"; die(); } - if (! $conf->deplacement->enabled) { print __METHOD__." trip module not enabled\n"; die(); } + if (! $conf->expensereport->enabled) { print __METHOD__." expensereport module not enabled\n"; die(); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. From 747c780f67be76ef39862404a1a62c9e1fc50058 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2015 02:44:42 +0200 Subject: [PATCH 016/184] Enhance phpunit tests --- test/README | 14 ++++++++------ test/bootstrap.php | 3 +++ test/phpunit/phpunittest.xml | 6 ++++-- 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 test/bootstrap.php diff --git a/test/README b/test/README index 4a54bfaf099..44061d7c9da 100644 --- a/test/README +++ b/test/README @@ -31,21 +31,23 @@ If not using Eclipse, to install PHPUnit manually: > phpunit MyFileTest.php If using Eclipse, select the test and click on menu "Run external tools and choose PHPUnit". -* Generate a report of Unit tests code coverage among tested classes only: +* Generate a report of Unit tests code coverage done by one tested class: > cd test -> phpunit -d memory_limit=-1 -d max_input_time=600 -d max_execution_time=600 --configuration ./phpunit/phpunittest.xml --coverage-html ./report --coverage-clover ./report/logs/phpunit.coverage.xml --log-junit ./report/logs/phpunit.xml phpunit/MyClassTest.php +> phpunit -d memory_limit=-1 -d max_input_time=1800 -d max_execution_time=1800 --configuration ./phpunit/phpunittest.xml --coverage-html ./report ./report/logs/phpunit.xml phpunit/MyClassTest.php Note that xdebug must be installed for this feature to work. -* Generate a report of Unit tests code coverage among all Dolibarr classes: -Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. Note: Version 3.5 need 1.5G +* Generate a report of Unit tests code coverage done by all Dolibarr unit test classes: +Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. You can check setup with "php -i | grep memory". Note: Version 3.5 need 1.5G > cd test -> phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report --coverage-clover ./report/logs/phpunit.coverage.xml --log-junit ./report/logs/phpunit.xml phpunit/AllTests.php +> phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report ./report/logs/phpunit.xml phpunit/AllTests.php If there is a timeout before end, try this: > cd test > php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report phpunit/AllTests.php -puis renice -10 du process php +puis +> sudo renice -10 idprocessphp +> php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-php ./report/codecoverage.php ./report phpunit/AllTests.php PHP-CODESNIFFER diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 00000000000..6e80411dca6 --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,3 @@ + diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml index ac4e29df3b5..d648edb6814 100644 --- a/test/phpunit/phpunittest.xml +++ b/test/phpunit/phpunittest.xml @@ -11,8 +11,8 @@ stopOnFailure="true" syntaxCheck="true"> - - + + @@ -25,6 +25,7 @@ ../../documents/ ../../htdocs/custom/ ../../htdocs/documents/custom/ + ../../htdocs/nltechno/ ../../htdocs/products/canvas/ ../../htdocs/contact/canvas/ ../../htdocs/societe/canvas/ @@ -48,6 +49,7 @@ ../../documents/ ../../htdocs/custom/ ../../htdocs/documents/custom/ + ../../htdocs/nltechno/ ../../htdocs/products/canvas/ ../../htdocs/contact/canvas/ ../../htdocs/societe/canvas/ From 678e55f9dab302fb7a10d44580fbea453019b03a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2015 04:11:54 +0200 Subject: [PATCH 017/184] We must add a viewport meta to have font visible on mobile --- htdocs/main.inc.php | 3 ++- test/README | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index da0296e4b00..e4fe0c06e8e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -975,7 +975,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print "\n"; if (GETPOST('dol_basehref')) print ''."\n"; // Displays meta - print ''."\n"; // Evite indexation par robots + print ''."\n"; // Do not index + print ''; // Scale for mobile device print ''."\n"; if (! empty($conf->global->MAIN_ACTIVATE_HTML5)) print ''."\n"; // Needed for Responsive Web Design $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1); diff --git a/test/README b/test/README index 44061d7c9da..c2cff847c0f 100644 --- a/test/README +++ b/test/README @@ -39,15 +39,16 @@ Note that xdebug must be installed for this feature to work. * Generate a report of Unit tests code coverage done by all Dolibarr unit test classes: Increase your PHP memory (memory_limit and suhosin.memory_limit in php.ini) to 4G. You can check setup with "php -i | grep memory". Note: Version 3.5 need 1.5G > cd test -> phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report ./report/logs/phpunit.xml phpunit/AllTests.php +> phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report phpunit/AllTests.php If there is a timeout before end, try this: > cd test > php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-html ./report phpunit/AllTests.php +ou +> php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-php ./report/codecoverage.php phpunit/AllTests.php puis > sudo renice -10 idprocessphp -> php -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 /usr/bin/phpunit -d suhosin.memory_limit=4G -d memory_limit=-1 -d max_input_time=0 -d max_execution_time=0 --configuration ./phpunit/phpunittest.xml --coverage-php ./report/codecoverage.php ./report phpunit/AllTests.php PHP-CODESNIFFER From 4d6b7b4baec96bf52993652f3b767ba9ecd4c869 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Apr 2015 04:17:07 +0200 Subject: [PATCH 018/184] Clean code --- htdocs/admin/ihm.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index cbbcad66daa..88932c0de44 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -323,8 +323,6 @@ else // Show $var=true; // Language - print_fiche_titre($langs->trans("Language"),'',''); - print '
'; print ''; print ''; From 40860a84d17b2e54f18d68a66ca2461a3a687cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:28:24 +0200 Subject: [PATCH 019/184] Closes #2543: Untranslated "Contract" origin string when creating an invoice from a contract --- ChangeLog | 1 + htdocs/commande/fiche.php | 22 ++++++++++++++++++---- htdocs/compta/facture.php | 24 +++++++++++++++++------- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..9982226def4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 02e6c74c13c..9a844b0a5d5 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -7,7 +7,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -1599,9 +1599,23 @@ if ($action == 'create' && $user->rights->commande->creer) { print ''; print ''; - $newclassname = $classname; - if ($newclassname == 'Propal') - $newclassname = 'CommercialProposal'; + switch ($classname) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + print ''; print ''; print '"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a3403e0d9dd..d5c11cf5b63 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -10,6 +10,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 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 @@ -2294,13 +2295,22 @@ if ($action == 'create') print ''; print ''; - $newclassname = $classname; - if ($newclassname == 'Propal') - $newclassname = 'CommercialProposal'; - elseif ($newclassname == 'Commande') - $newclassname = 'Order'; - elseif ($newclassname == 'Expedition') - $newclassname = 'Sending'; + switch ($classname) { + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } print ''; print ''; From 611406b75e049623ca4640f7545dc3ec66aa6acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:34:06 +0200 Subject: [PATCH 020/184] Closes #2540 Bug: Incorrect HTML in "Bank account" tab of a Thirdparty --- htdocs/societe/rib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index ea64135bd43..d57a6e75443 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -4,6 +4,7 @@ * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine + * Copyright (C) 2015 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 @@ -382,7 +383,7 @@ if ($socid && $action != 'edit' && $action != "create") } if (count($rib_list) == 0) { - print ''; + print ''; } print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . "
' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . '
' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . '
'.$langs->trans("NoBANRecord").'
'.$langs->trans("NoBANRecord").'
'; From 50091dfe8bbada8fde2e5bc318e6570eaa13b15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:44:52 +0200 Subject: [PATCH 021/184] Closes #2534 SQL error when editing a supplier invoice line --- ChangeLog | 1 + htdocs/fourn/facture/fiche.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..66ee1ebe57a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index e06ebfa73ca..54299b0beb8 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -7,6 +7,7 @@ * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry + * Copyright (C) 2015 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 @@ -521,6 +522,10 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); + if (empty($remise_percent)) { + $remise_percent = 0; + } + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { From 5c8e92d52a8269de43753c60c080f29a797a53db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sat, 4 Apr 2015 17:52:05 +0200 Subject: [PATCH 022/184] Closes #2535 Bug: Untranslated string in "Linked objects" page of a project --- ChangeLog | 1 + htdocs/projet/element.php | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2bcf02febf8..5b4440b8567 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,6 +31,7 @@ English Dolibarr ChangeLog - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 5a499007fae..80a12964792 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 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 @@ -415,8 +416,31 @@ foreach ($listofreferent as $key => $value) } } + switch ($classname) { + case 'FactureFournisseur': + $newclassname = 'SupplierInvoice'; + break; + case 'Facture': + $newclassname = 'Bill'; + break; + case 'Propal': + $newclassname = 'CommercialProposal'; + break; + case 'Commande': + $newclassname = 'Order'; + break; + case 'Expedition': + $newclassname = 'Sending'; + break; + case 'Contrat': + $newclassname = 'Contract'; + break; + default: + $newclassname = $classname; + } + print '
'.$classname.''.$langs->trans($newclassname).''.$i.''.price($total_ht).''.price($total_ttc).'
"; } - /** - * Get printer detail - * - * @param string $uri URI - * @return array List of attributes - */ - function get_printer_detail($uri) - { - global $conf,$db; - - include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; - $ipp = new CupsPrintIPP(); - $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose - $ipp->setHost($this->host); - $ipp->setPort($this->port); - $ipp->setUserName($this->userid); - if (! empty($this->user)) $ipp->setAuthentication($this->user,$this->password); - $ipp->setPrinterURI($uri); - $ipp->getPrinterAttributes(); - return $ipp->printer_attributes; - } } diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index e8669f44585..48795fbab4c 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -30,8 +30,8 @@ llxHeader("",$langs->trans("Printing")); print_fiche_titre($langs->trans("Printing")); // List Jobs from printing modules -//$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD); -//$printer->list_jobs('commande'); +$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD); +$printer->list_jobs('commande'); llxFooter(); From 828dc2c9f411df8f9797762a51a3d212cd0d2176 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 12:22:52 +0200 Subject: [PATCH 029/184] Fix code standard --- .../core/modules/mailings/contacts1.modules.php | 2 +- .../core/modules/mailings/contacts2.modules.php | 2 +- .../core/modules/mailings/contacts3.modules.php | 2 +- .../core/modules/mailings/contacts4.modules.php | 2 +- htdocs/core/modules/mailings/example.modules.php | 4 ++-- htdocs/core/modules/mailings/fraise.modules.php | 4 ++-- .../core/modules/mailings/framboise.modules.php | 4 ++-- .../core/modules/mailings/modules_mailings.php | 6 +++--- .../modules/mailings/thirdparties.modules.php | 2 +- .../core/modules/mailings/xinputfile.modules.php | 4 ++-- .../core/modules/mailings/xinputuser.modules.php | 4 ++-- htdocs/main.inc.php | 16 ++++++++-------- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 3f8df87cd7a..5d218376983 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -85,7 +85,7 @@ class mailing_contacts1 extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts2.modules.php b/htdocs/core/modules/mailings/contacts2.modules.php index fe49ce56b35..b1e22110f5e 100644 --- a/htdocs/core/modules/mailings/contacts2.modules.php +++ b/htdocs/core/modules/mailings/contacts2.modules.php @@ -152,7 +152,7 @@ class mailing_contacts2 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts3.modules.php b/htdocs/core/modules/mailings/contacts3.modules.php index 92640291088..feeb0a2cb55 100644 --- a/htdocs/core/modules/mailings/contacts3.modules.php +++ b/htdocs/core/modules/mailings/contacts3.modules.php @@ -157,7 +157,7 @@ class mailing_contacts3 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int Number of recipients */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/contacts4.modules.php b/htdocs/core/modules/mailings/contacts4.modules.php index 59355b372fe..c0a1c59c01c 100644 --- a/htdocs/core/modules/mailings/contacts4.modules.php +++ b/htdocs/core/modules/mailings/contacts4.modules.php @@ -158,7 +158,7 @@ class mailing_contacts4 extends MailingTargets /** * Return here number of distinct emails returned by your selector. * - * @param string $sql Requete sql de comptage + * @param string $sql Requete sql de comptage * @return int Number of recipients */ function getNbOfRecipients($sql='') diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index a7eb1b0b839..428285fb20b 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -100,8 +100,8 @@ class mailing_example extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int + * @param string $sql Requete sql de comptage + * @return int|string Number of recipient or '?' */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index dd6e18dfa91..69b018080b8 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -86,8 +86,8 @@ class mailing_fraise extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @param string $sql Requete sql de comptage + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/framboise.modules.php b/htdocs/core/modules/mailings/framboise.modules.php index c647466e796..e25ffad5f1b 100644 --- a/htdocs/core/modules/mailings/framboise.modules.php +++ b/htdocs/core/modules/mailings/framboise.modules.php @@ -150,8 +150,8 @@ class mailing_framboise extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @param string $sql Requete sql de comptage + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 5561526a7ff..2508440c147 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -72,8 +72,8 @@ class MailingTargets // This can't be abstract as it is used for some method /** * Retourne nombre de destinataires * - * @param string $sql Requete sql de comptage - * @return int Nb de destinataires si ok, < 0 si erreur + * @param string $sql Sql request to count + * @return int Nb of recipient, or <0 if error */ function getNbOfRecipients($sql) { @@ -85,7 +85,7 @@ class MailingTargets // This can't be abstract as it is used for some method } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -1; } } diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index df8ec79f988..222711cdf65 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -157,7 +157,7 @@ class mailing_thirdparties extends MailingTargets * emails from a text file, this function must return 500. * * @param string $sql Requete sql de comptage - * @return int Nb of recipients + * @return int Nb of recipients */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 777621fa432..7b6f8361d24 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -73,8 +73,8 @@ class mailing_xinputfile extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int '' means NA + * @param string $sql Sql request to count + * @return string '' means NA */ function getNbOfRecipients($sql='') { diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 0d01aa53912..7832d1f6a93 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -73,8 +73,8 @@ class mailing_xinputuser extends MailingTargets * For example if this selector is used to extract 500 different * emails from a text file, this function must return 500. * - * @param string $sql Requete sql de comptage - * @return int '' means NA + * @param string $sql Sql request to count + * @return string '' means NA */ function getNbOfRecipients($sql='') { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e4fe0c06e8e..d0b80db1190 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -111,17 +111,17 @@ function test_sql_and_script_inject($val, $type) /** * Security: Return true if OK, false otherwise. * - * @param string $var Variable name - * @param string $type 1=GET, 0=POST, 2=PHP_SELF - * @return boolean true if there is an injection + * @param string $var Variable name + * @param string $type 1=GET, 0=POST, 2=PHP_SELF + * @return boolean||null true if there is an injection. Stop code if injection found. */ -function analyse_sql_and_script(&$var, $type) +function analyseVarsForSqlAndScriptsInjection(&$var, $type) { if (is_array($var)) { foreach ($var as $key => $value) { - if (analyse_sql_and_script($value,$type)) + if (analyseVarsForSqlAndScriptsInjection($value,$type)) { $var[$key] = $value; } @@ -147,16 +147,16 @@ if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIRE if (! empty($_SERVER["PHP_SELF"])) { $morevaltochecklikepost=array($_SERVER["PHP_SELF"]); - analyse_sql_and_script($morevaltochecklikepost,2); + analyseVarsForSqlAndScriptsInjection($morevaltochecklikepost,2); } // Sanity check on GET parameters if (! empty($_SERVER["QUERY_STRING"])) { $morevaltochecklikeget=array($_SERVER["QUERY_STRING"]); - analyse_sql_and_script($morevaltochecklikeget,1); + analyseVarsForSqlAndScriptsInjection($morevaltochecklikeget,1); } // Sanity check on POST -analyse_sql_and_script($_POST,0); +analyseVarsForSqlAndScriptsInjection($_POST,0); // This is to make Dolibarr working with Plesk if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); From 4da737424e8ab119e1690375c3aa7ef9e58f4f51 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Mon, 6 Apr 2015 10:25:30 +0000 Subject: [PATCH 030/184] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- .../prelevement/class/ligneprelevement.class.php | 2 +- htdocs/core/class/CMailFile.class.php | 8 ++++++-- htdocs/core/class/commoninvoice.class.php | 6 +++--- htdocs/core/class/dolgraph.class.php | 10 +++++----- htdocs/core/class/infobox.class.php | 2 +- htdocs/core/class/ldap.class.php | 6 +++--- htdocs/core/db/sqlite.class.php | 8 ++++---- htdocs/core/lib/barcode.lib.php | 6 +++--- htdocs/core/lib/files.lib.php | 8 ++++---- htdocs/core/modules/livraison/modules_livraison.php | 4 ++-- htdocs/core/modules/printing/modules_printing.php | 2 +- htdocs/core/modules/printing/printgcp.modules.php | 6 +++--- .../supplier_invoice/pdf/pdf_canelle.modules.php | 6 +++--- .../supplier_order/modules_commandefournisseur.php | 4 ++-- htdocs/loan/class/loan.class.php | 6 +++--- .../canvas/service/actions_card_service.class.php | 2 +- htdocs/product/class/productbatch.class.php | 2 +- htdocs/societe/canvas/actions_card_common.class.php | 2 +- .../canvas/company/actions_card_company.class.php | 2 +- .../individual/actions_card_individual.class.php | 2 +- htdocs/societe/class/societe.class.php | 4 ++-- 21 files changed, 51 insertions(+), 47 deletions(-) diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 2b71c5c8004..16960b53c46 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -61,7 +61,7 @@ class LignePrelevement * Recupere l'objet prelevement * * @param int $rowid id de la facture a recuperer - * @return void|int + * @return integer */ function fetch($rowid) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 61ea308df39..82d675019d1 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -516,6 +516,10 @@ class CMailFile // Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word + + /** + * @param string $stringtoencode + */ function encodetorfc2822($stringtoencode) { global $conf; @@ -639,7 +643,7 @@ class CMailFile /** * Create SMTP headers (mode = 'mail') * - * @return smtp headers + * @return string headers */ function write_smtpheaders() { @@ -690,7 +694,7 @@ class CMailFile * * @param array $filename_list Array of filenames * @param array $mimefilename_list Array of mime types - * @return array mime headers + * @return string mime headers */ function write_mimeheaders($filename_list, $mimefilename_list) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 1a7ebfc34c8..9e8544bc0e9 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -188,7 +188,7 @@ abstract class CommonInvoice extends CommonObject * Return label of object status * * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto - * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) + * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ function getLibStatut($mode=0,$alreadypaid=-1) @@ -202,7 +202,7 @@ abstract class CommonInvoice extends CommonObject * @param int $paye Status field paye * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto - * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) + * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @param int $type Type facture * @return string Libelle du statut */ @@ -326,7 +326,7 @@ abstract class CommonInvoice extends CommonObject * Renvoi une date limite de reglement de facture en fonction des * conditions de reglements de la facture et date de facturation * - * @param string $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. + * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko */ function calculate_date_lim_reglement($cond_reglement=0) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 15a0535598d..b65c5c8ede4 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -115,7 +115,7 @@ class DolGraph * Set Y precision * * @param float $which_prec Precision - * @return string + * @return boolean */ function SetPrecisionY($which_prec) { @@ -187,7 +187,7 @@ class DolGraph * Set y label * * @param string $label Y label - * @return boolean True + * @return boolean|null True */ function SetYLabel($label) { @@ -198,7 +198,7 @@ class DolGraph * Set width * * @param int $w Width - * @return boolean True + * @return boolean|null True */ function SetWidth($w) { @@ -554,7 +554,7 @@ class DolGraph /** * Return min value of all data * - * @return int Max value of all data + * @return double Max value of all data */ function GetFloorMinValue() { @@ -578,7 +578,7 @@ class DolGraph * * @param string $file Image file name to use to save onto disk (also used as javascript unique id) * @param string $fileurl Url path to show image if saved onto disk - * @return void + * @return integer|null */ function draw($file,$fileurl='') { diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 14d1bec0841..755e304abfd 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -30,7 +30,7 @@ class InfoBox /** * Name of positions 0=Home, 1=... * - * @return array Array with list of zones + * @return string[] Array with list of zones */ static function getListOfPagesForBoxes() { diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 2783c55ee03..98250ab0db1 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -349,7 +349,7 @@ class Ldap /** * Change ldap protocol version to use. * - * @return string version + * @return boolean version */ function setVersion() { // LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17 @@ -360,7 +360,7 @@ class Ldap /** * changement du referrals. * - * @return string referrals + * @return boolean referrals */ function setReferrals() { // LDAP_OPT_REFERRALS est une constante qui vaut ? @@ -1314,7 +1314,7 @@ class Ldap * Convertit le temps ActiveDirectory en Unix timestamp * * @param string $value AD time to convert - * @return string Unix timestamp + * @return integer Unix timestamp */ function convert_time($value) { diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 88efde86394..d09ce11ca43 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -296,7 +296,7 @@ class DoliDBSqlite extends DoliDB * @param string $login login * @param string $passwd password * @param string $name name of database (not used for mysql, used for pgsql) - * @param string $port Port of database server + * @param integer $port Port of database server * @return resource Database access handler * @see close */ @@ -459,7 +459,7 @@ class DoliDBSqlite extends DoliDB /** * Return datas as an array * - * @param Resultset $resultset Resultset of request + * @param resource $resultset Resultset of request * @return array Array */ function fetch_row($resultset) @@ -511,7 +511,7 @@ class DoliDBSqlite extends DoliDB /** * Free last resultset used. * - * @param resultset $resultset Curseur de la requete voulue + * @param integer $resultset Curseur de la requete voulue * @return void */ function free($resultset=0) @@ -629,7 +629,7 @@ class DoliDBSqlite extends DoliDB * * @param string $fieldorvalue Field name or value to encrypt * @param int $withQuotes Return string with quotes - * @return return XXX(field) or XXX('value') or field or 'value' + * @return string XXX(field) or XXX('value') or field or 'value' */ function encrypt($fieldorvalue, $withQuotes=0) { diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 243b862ff88..778723c5f3b 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -61,7 +61,7 @@ else $genbarcode_loc = $conf->global->GENBARCODE_LOCATION; * * @param string $code Code * @param string $encoding Encoding - * @param string $scale Scale + * @param integer $scale Scale * @param string $mode 'png' or 'jpg' ... * * @@ -159,7 +159,7 @@ function barcode_encode($code,$encoding) * Calculate EAN sum * * @param string $ean EAN to encode - * @return string Sum + * @return integer Sum */ function barcode_gen_ean_sum($ean) { @@ -299,7 +299,7 @@ function barcode_encode_genbarcode($code,$encoding) * @param string $mode png,gif,jpg (default='png') * @param int $total_y the total height of the image ( default: scale * 60 ) * @param array $space default: $space[top] = 2 * $scale; $space[bottom]= 2 * $scale; $space[left] = 2 * $scale; $space[right] = 2 * $scale; - * @return void + * @return string|null */ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, $space = '') { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d9bae4b5ecb..0af5e917cc5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -452,7 +452,7 @@ function dol_count_nb_of_line($file) * Return size of a file * * @param string $pathoffile Path of file - * @return string File size + * @return integer File size */ function dol_filesize($pathoffile) { @@ -598,7 +598,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists) * * @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory) * @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory) - * @param string $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) + * @param integer $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK) * @param int $overwriteifexists Overwrite file if exists (1 by default) * @return boolean True if OK, false if KO */ @@ -657,7 +657,7 @@ function dol_unescapefile($filename) * @param string $dest_file Target full path filename ($_FILES['field']['name']) * @param int $allowoverwrite 1=Overwrite target file if it already exists * @param int $disablevirusscan 1=Disable virus scan - * @param string $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) + * @param integer $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) * @param int $nohook Disable all hooks * @param string $varfiles _FILES var name * @return int >0 if OK, <0 or string if KO @@ -989,7 +989,7 @@ function dol_delete_preview($object) * This should allow "grep" search. * This feature is enabled only if option MAIN_DOC_CREATE_METAFILE is set. * - * @param Object $object Object + * @param CommonObject $object Object * @return int 0 if we did nothing, >0 success, <0 error */ function dol_meta_create($object) diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index 22c25bcfd5f..0a439ed8fe7 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -42,7 +42,7 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator * Return list of active generation modules * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ static function liste_modeles($db,$maxfilenamelength=0) @@ -151,7 +151,7 @@ abstract class ModeleNumRefDeliveryOrder * Create object on disk * * @param DoliDB $db objet base de donnee - * @param Object $object object delivery + * @param Livraison $object object delivery * @param string $modele force le modele a utiliser ('' to not force) * @param Translate $outputlangs objet lang a utiliser pour traduction * @return int 0 if KO, 1 if OK diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index 3b53711f58c..7bb9ac98f58 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -49,7 +49,7 @@ class PrintingDriver * Return list of printing driver * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of drivers */ static function listDrivers($db,$maxfilenamelength=0) diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 302adaeb965..a0e0d37d074 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -254,7 +254,7 @@ class printing_printgcp extends PrintingDriver /** * Login into Google Account * - * @return string true or false + * @return boolean true or false */ function GoogleLogin() { @@ -324,8 +324,8 @@ class printing_printgcp extends PrintingDriver * * @param string $url url to hit * @param array $postfields array of post fields - * @param array $headers array of http headers - * @return array response from curl + * @param string[] $headers array of http headers + * @return string response from curl */ private function makeCurl($url,$postfields=array(),$headers=array()) { diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 78d7f42fab2..0880cbc58ac 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -819,7 +819,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Show payments table * * @param PDF $pdf Object PDF - * @param Object $object Object invoice + * @param FactureFournisseur $object Object invoice * @param int $posy Position y in PDF * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK @@ -903,7 +903,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Show top header of page. * * @param PDF $pdf Object PDF - * @param Object $object Object to show + * @param FactureFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -1090,7 +1090,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * Show footer of page. Need this->emetteur object * * @param PDF $pdf PDF - * @param Object $object Object to show + * @param FactureFournisseur $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return int Return height of bottom margin including footer text diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index bc544363b39..a968955ea73 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -44,7 +44,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator * Return list of active generation models * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ static function liste_modeles($db,$maxfilenamelength=0) @@ -143,7 +143,7 @@ abstract class ModeleNumRefSuppliersOrders * Create a document onto disk according to template model. * * @param DoliDB $db Database handler - * @param Object $object Object supplier order + * @param CommandeFournisseur $object Object supplier order * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs Object lang to use for traduction * @param int $hidedetails Hide details of lines diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index c2c0bba6381..85d0694b725 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -321,7 +321,7 @@ class Loan extends CommonObject * Return label of loan status (unpaid, paid) * * @param int $mode 0=label, 1=short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label - * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) + * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ function getLibStatut($mode=0,$alreadypaid=-1) @@ -334,7 +334,7 @@ class Loan extends CommonObject * * @param int $statut Id statut * @param int $mode 0=Label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Label, 5=Short label + Picto - * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) + * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ function LibStatut($statut,$mode=0,$alreadypaid=-1) @@ -447,7 +447,7 @@ class Loan extends CommonObject * Information on record * * @param int $id Id of record - * @return void + * @return integer|null */ function info($id) { diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index b36e7b317c6..5926beab083 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -67,7 +67,7 @@ class ActionsCardService * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action - * @param string $id Id of object + * @param integer $id Id of object * @param string $ref Ref of object * @return void */ diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index d6d848b8ef1..ee49302407d 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -462,7 +462,7 @@ class Productbatch extends CommonObject /** * Return all batch detail records for given product and warehouse * - * @param obj $db database object + * @param DoliDB $db database object * @param int $fk_product_stock id product_stock for objet * @param int $with_qty doesn't return line with 0 quantity * @return int <0 if KO, >0 if OK diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index b94262bbb52..c5389c73452 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -355,7 +355,7 @@ abstract class ActionsCardCommon * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action - * @param string $id Id of object + * @param integer $id Id of object * @param string $ref Ref of object * @return void */ diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index d54af2b8bba..b2c0f82f1e0 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -92,7 +92,7 @@ class ActionsCardCompany extends ActionsCardCommon * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action - * @param string $id Id of object + * @param integer $id Id of object * @param string $ref Ref of object * @return void */ diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 2f00cd4bc27..19921b69d81 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -92,7 +92,7 @@ class ActionsCardIndividual extends ActionsCardCommon * Assign custom values for canvas (for example into this->tpl to be used by templates) * * @param string $action Type of action - * @param string $id Id of object + * @param integer $id Id of object * @param string $ref Ref of object * @return void */ diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 2df9ba0776f..7e2bdeef3a6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1578,7 +1578,7 @@ class Societe extends CommonObject * * @param User $user Filtre sur un user auteur des remises * @param string $filter Filtre autre - * @param string $maxvalue Filter on max value for discount + * @param integer $maxvalue Filter on max value for discount * @return int <0 if KO, Credit note amount otherwise */ function getAvailableDiscounts($user='',$filter='',$maxvalue=0) @@ -1728,7 +1728,7 @@ class Societe extends CommonObject * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') * @param int $maxlen Max length of text - * @param string $notooltip 1=Disable tooltip + * @param integer $notooltip 1=Disable tooltip * @return string String with URL */ function getNomUrl($withpicto=0,$option='',$maxlen=0,$notooltip=0) From aca025c9eb25e9930b58472a642aaf1315a4f0e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 13:11:33 +0200 Subject: [PATCH 031/184] Update doc --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7fefd5100b5..6e779b97463 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,11 +44,11 @@ Use clear commit messages with the following structure:
 FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
 or
-CLOSE|Close #456 Short description (where #456 is number feature request, if it exists. In upper case to appear into ChangeLog)
+CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
 or
-NEW|New Short description (In upper case to appear into ChangeLog)
+NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
 or
-Short description (when the commit is not introducing feature or closing a bug)
+Short description (when the commit is not introducing feature nor closing a bug)
 
 Long description (Can span accross multiple lines).
 
From fa162cb32729e16706b52b22d3d381b926850957 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 14:11:28 +0200 Subject: [PATCH 032/184] Missing field --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 57cb8745502..5f8fed7fd14 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -64,6 +64,7 @@ create table llx_payment_loan fk_user_modif integer )ENGINE=innodb; +ALTER TABLE llx_extrafields ADD COLUMN fieldrequired integer DEFAULT 0; ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired; ALTER TABLE llx_extrafields ADD COLUMN list integer DEFAULT 0 after perms; From b49705d5d0af8da8422c8e6222eb0ab174314daf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 16:13:23 +0200 Subject: [PATCH 033/184] Status and amount of object should always be visible. --- htdocs/core/lib/functions.lib.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 10 +++---- htdocs/fourn/facture/card.php | 15 ++++++----- htdocs/fourn/facture/contact.php | 26 ++++++++++++++++++- htdocs/fourn/facture/document.php | 24 +++++++++++++++++ htdocs/fourn/facture/info.php | 20 +++++++------- htdocs/fourn/facture/note.php | 24 +++++++++++++++++ 7 files changed, 97 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2465afff22..b76db5a6d47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3004,7 +3004,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou $cursymbolafter.=($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); } } - $output=$cursymbolbefore.$output.$end.$cursymbolafter; + $output=$cursymbolbefore.$output.$end.($cursymbolafter?' ':'').$cursymbolafter; return $output; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 99e9cca639c..ceb9a56b946 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -105,7 +105,7 @@ class FactureFournisseur extends CommonInvoice var $fk_incoterms; var $location_incoterms; var $libelle_incoterms; //Used into tooltip - + var $extraparams=array(); /** @@ -428,9 +428,9 @@ class FactureFournisseur extends CommonInvoice //Incoterms $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; + $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->socid = $obj->socid; @@ -1408,7 +1408,7 @@ class FactureFournisseur extends CommonInvoice */ function info($id) { - $sql = 'SELECT c.rowid, datec, tms as datem,'; + $sql = 'SELECT c.rowid, datec, tms as datem, '; $sql.= ' fk_user_author, fk_user_valid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c'; $sql.= ' WHERE c.rowid = '.$id; @@ -1434,7 +1434,7 @@ class FactureFournisseur extends CommonInvoice } $this->date_creation = $obj->datec; $this->date_modification = $obj->datem; - //$this->date_validation = $obj->datev; Should be stored in log table + //$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders) } $this->db->free($result); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 28fbe44fc9f..135592b9c7c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1964,8 +1964,9 @@ else $alreadypaid=$object->getSommePaiement(); print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; - print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).' '; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); if ($calculationrule == 'totalofround') $calculationrulenum=1; @@ -1982,16 +1983,16 @@ else if ($societe->localtax1_assuj=="1") //Localtax1 { print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; } if ($societe->localtax2_assuj=="1") //Localtax2 { print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; - print ' '; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; } - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).' '; + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; // Project if (! empty($conf->projet->enabled)) diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index aaee42e9add..7348f3b7590 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2014 Laurent Destailleur + * Copyright (C) 2005-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -200,6 +200,30 @@ if ($id > 0 || ! empty($ref)) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print ""; dol_fiche_end(); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index c7219c6e415..e6fed653421 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -168,6 +168,30 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print '
'; print ''; diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index e45833c53f1..7033d555c0e 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -31,11 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; $langs->load('bills'); -$facid = isset($_GET["facid"])?$_GET["facid"]:''; +$id = GETPOST("facid",'int'); // Security check if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture'); +$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); @@ -45,22 +45,22 @@ $result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture llxHeader(); -$fac = new FactureFournisseur($db); -$fac->fetch($_GET["facid"]); -$fac->info($_GET["facid"]); +$object = new FactureFournisseur($db); +$object->fetch($id); +$object->info($id); $soc = new Societe($db); -$soc->fetch($fac->socid); +$soc->fetch($object->socid); -$head = facturefourn_prepare_head($fac); +$head = facturefourn_prepare_head($object); $titre=$langs->trans('SupplierInvoice'); dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill'); print '
'; -dol_print_object_info($fac); +dol_print_object_info($object); print '
'; print ''; -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 7d68a3c5a95..3a4528d827e 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -139,6 +139,30 @@ if ($object->id > 0) print $form->editfieldval("Label",'label',$object->label,$object,0); print ''; + // Status + $alreadypaid=$object->getSommePaiement(); + print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; + + // Amount + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).''; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + + // Amount Local Taxes + //TODO: Place into a function to control showing by country or study better option + if ($societe->localtax1_assuj=="1") //Localtax1 + { + print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + if ($societe->localtax2_assuj=="1") //Localtax2 + { + print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ''; + } + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).''; + print ""; print '
'; From 3d161deb17053e9e7f16cee4c400501d87bd2e36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 16:50:26 +0200 Subject: [PATCH 034/184] Fix more robust function --- htdocs/core/lib/functions.lib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b76db5a6d47..e8d0cc3f254 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3010,8 +3010,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou } /** - * Function that return a number with universal decimal format (decimal separator is '.') from - * an amount typed by a user. + * Function that return a number with universal decimal format (decimal separator is '.') from an amount typed by a user. * Function to use on each input amount before any numeric test or database insert * * @param float $amount Amount to convert/clean @@ -4992,7 +4991,15 @@ function natural_search($fields, $value, $numeric=0) } if ($newcrit != '') { - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' '.$operator.' '.price2num($newcrit); + $numnewcrit = price2num($newcrit); + if (is_numeric($numnewcrit)) + { + $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' '.$operator.' '.$numnewcrit; + } + else + { + $newres .= ($i2 > 0 ? ' OR ' : '') . '1 = 2'; // force false + } $i2++; // a criteria was added to string } } From 19b55cb4c14251885e49124aec9ebe5fca9487c6 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Mon, 6 Apr 2015 18:58:36 +0200 Subject: [PATCH 035/184] Add public note to members --- htdocs/adherents/class/adherent.class.php | 9 ++- htdocs/adherents/note.php | 65 +++---------------- htdocs/admin/ldap_members.php | 11 +++- .../install/mysql/migration/3.7.0-3.8.0.sql | 1 + htdocs/install/mysql/tables/llx_adherent.sql | 1 + htdocs/langs/en_US/admin.lang | 2 + 6 files changed, 32 insertions(+), 57 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7a4510119dc..58593935a5f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Frederic France * * 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 @@ -78,6 +79,7 @@ class Adherent extends CommonObject var $morphy; var $public; var $note_private; // Private note + var $note_public; // Public note var $statut; // -1:brouillon, 0:resilie, >=1:valide,paye var $photo; @@ -448,6 +450,7 @@ class Adherent extends CommonObject $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); $sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); + $sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", public='".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -1054,6 +1057,7 @@ class Adherent extends CommonObject global $langs; $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; + $sql.= " d.note_public,"; $sql.= " d.email, d.skype, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; @@ -1135,6 +1139,7 @@ class Adherent extends CommonObject $this->birth = $this->db->jdate($obj->birthday); $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; @@ -1561,7 +1566,8 @@ class Adherent extends CommonObject $result=''; $label = '' . $langs->trans("ShowMember") . ''; - $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref)) + $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->firstname) || ! empty($this->lastname)) $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; @@ -1875,6 +1881,7 @@ class Adherent extends CommonObject if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; + if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 3a938e74034..79b7db086e6 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -1,6 +1,7 @@ - * Copyright (C) 2004-2014 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2015 Frederic France * * 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 @@ -45,26 +46,13 @@ if ($result > 0) $result=$adht->fetch($object->typeid); } +$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php /* * Actions */ -if ($action == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"]) -{ - $db->begin(); - - $res=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES), '_private'); - if ($res < 0) - { - setEventMessage($object->error, 'errors'); - $db->rollback(); - } - else - { - $db->commit(); - } -} +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -129,49 +117,16 @@ if ($id) // Status print ''.$langs->trans("Status").''.$object->getLibStatut(4).''; - // Private note - print ''.$langs->trans("Note").''; - print ''; - if ($action == 'edit' && $user->rights->adherent->creer) - { - print ""; - print "id."\">"; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note_private',$object->note_private,'',280,'dolibarr_notes','',true,false,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80); - $doleditor->Create(); - } - else - { - print dol_htmlentitiesbr($object->note_private); - } - print ""; - - if ($action == 'edit') - { - print ''; - print ''; - print '     '; - print ''; - print ''; - } - print ""; - print "\n"; + print '
'; - /* - * Actions - */ - print ''; - print '
'; + $colwidth='20'; + $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - if ($user->rights->adherent->creer && $action != 'edit') - { - print '"; - } - - print "
"; + dol_fiche_end(); } diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index bddf16f8670..8bac5068143 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -65,13 +65,14 @@ if ($action == 'setvalue' && $user->admin) if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE',GETPOST("fieldphone"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_PHONE_PERSO',GETPOST("fieldphoneperso"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_MOBILE',GETPOST("fieldmobile"),'chaine',0,'',$conf->entity)) $error++; - if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++; + if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_SKYPE',GETPOST("fieldskype"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_FAX',GETPOST("fieldfax"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ADDRESS',GETPOST("fieldaddress"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_ZIP',GETPOST("fieldzip"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_TOWN',GETPOST("fieldtown"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_COUNTRY',GETPOST("fieldcountry"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_DESCRIPTION',GETPOST("fielddescription"),'chaine',0,'',$conf->entity)) $error++; + if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_NOTE_PUBLIC',GETPOST("fieldnotepublic"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_MEMBER_FIELD_BIRTHDATE',GETPOST("fieldbirthdate"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_STATUS',GETPOST("fieldstatus"),'chaine',0,'',$conf->entity)) $error++; if (! dolibarr_set_const($db, 'LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION', GETPOST("fieldendlastsubscription"),'chaine',0,'',$conf->entity)) $error++; @@ -312,6 +313,14 @@ print ''.$langs->trans("LDAPFieldDescriptionExample").''; print ' '; print ''; +// Public Note +$var=!$var; +print ''.$langs->trans("LDAPFieldNotePublic").''; +print ''; +print ''.$langs->trans("LDAPFieldNotePublicExample").''; +print ' '; +print ''; + // Birthday $var=!$var; print ''.$langs->trans("LDAPFieldBirthdate").''; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 85757f85f15..d8f47651153 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -515,4 +515,5 @@ create table llx_c_price_global_variable_updater )ENGINE=innodb; ALTER TABLE llx_adherent CHANGE COLUMN note note_private text DEFAULT NULL; +ALTER TABLE llx_adherent ADD COLUMN note_public text DEFAULT NULL after note_private; diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index e6ffee2dc5b..493d5b1124d 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -55,6 +55,7 @@ create table llx_adherent public smallint NOT NULL DEFAULT 0, -- certain champ de la fiche sont ils public ou pas ? datefin datetime, -- date de fin de validite de la cotisation note_private text DEFAULT NULL, + note_public text DEFAULT NULL, datevalid datetime, -- date de validation datec datetime, -- date de creation tms timestamp, -- date de modification diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 984b9717dab..753ebc4073c 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1338,6 +1338,8 @@ LDAPFieldCountry=Country LDAPFieldCountryExample=Example : c LDAPFieldDescription=Description LDAPFieldDescriptionExample=Example : description +LDAPFieldNotePublic=Public Note +LDAPFieldNotePublicExample=Example : publicnote LDAPFieldGroupMembers= Group members LDAPFieldGroupMembersExample= Example : uniqueMember LDAPFieldBirthdate=Birthdate From 02e8879d3b3780d762bdfc6789bc147985d1569b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 19:11:31 +0200 Subject: [PATCH 036/184] NEW Feature to build a merged pdf with all unpaid invoice can work for paid invoices. --- .../{impayees.php => mergepdftool.php} | 109 +++++++++++++----- htdocs/core/menus/init_menu_auguria.sql | 9 +- htdocs/core/menus/standard/eldy.lib.php | 21 ++-- htdocs/fourn/facture/list.php | 8 +- htdocs/langs/en_US/bills.lang | 1 + 5 files changed, 107 insertions(+), 41 deletions(-) rename htdocs/compta/facture/{impayees.php => mergepdftool.php} (88%) diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/mergepdftool.php similarity index 88% rename from htdocs/compta/facture/impayees.php rename to htdocs/compta/facture/mergepdftool.php index d91b52b2166..74017da1f17 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud @@ -24,17 +24,19 @@ */ /** - * \file htdocs/compta/facture/impayees.php + * \file htdocs/compta/facture/mergepdftool.php * \ingroup facture - * \brief Page to list and build liste of unpaid invoices + * \brief Page to list and build doc of selected invoices */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("mails"); $langs->load("bills"); @@ -44,6 +46,18 @@ $action = GETPOST('action','alpha'); $option = GETPOST('option'); $mode=GETPOST('mode'); $builddoc_generatebutton=GETPOST('builddoc_generatebutton'); +$month = GETPOST("month","int"); +$year = GETPOST("year","int"); +$filter = GETPOST("filtre"); + +if (GETPOST('button_search')) +{ + $filter=GETPOST('filtre',2); + if ($filter != 'payed:0') $option=''; +} +if ($option == 'late') $filter = 'paye:0'; +if ($option == 'unpaidall') $filter = 'paye:0'; +if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0'; // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -54,6 +68,20 @@ if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/' $resultmasssend=''; +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers +{ + $search_ref=""; + $search_ref_supplier=""; + $search_label=""; + $search_company=""; + $search_amount_no_tax=""; + $search_amount_all_tax=""; + $year=""; + $month=""; + $filter=""; +} + + /* * Action @@ -297,8 +325,14 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s dol_mkdir($diroutputpdf); // Save merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities("Invoices"))); + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; if ($pagecount) { $now=dol_now(); @@ -306,6 +340,9 @@ if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_s $pdf->Output($file,'F'); if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $langs->load("exports"); + setEventMessage($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog'))); } else { @@ -340,9 +377,9 @@ if ($action == 'remove_file') $form = new Form($db); $formfile = new FormFile($db); +$formother = new FormOther($db); -$title=$langs->trans("BillsCustomersUnpaid"); -if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid"); +$title=$langs->trans("MergingPDFTool"); llxHeader('',$title); @@ -410,14 +447,15 @@ $sql.= ",".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; -$sql.= " AND f.type IN (0,1,3,5) AND f.fk_statut = 1"; -$sql.= " AND f.paye = 0"; +$sql.= " AND f.type IN (0,1,3,5)"; +//$sql.= " AND f.fk_statut = 1"; +//$sql.= " AND f.paye = 0"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (! empty($socid)) $sql .= " AND s.rowid = ".$socid; -if (GETPOST('filtre')) +if ($filter && $filter != -1) // GETPOST('filtre') may be a string { - $filtrearr = explode(",", GETPOST('filtre')); + $filtrearr = explode(",", $filter); foreach ($filtrearr as $fil) { $filt = explode(":", $fil); @@ -427,10 +465,21 @@ if (GETPOST('filtre')) if ($search_ref) $sql .= " AND f.facnumber LIKE '%".$db->escape($search_ref)."%'"; if ($search_refcustomer) $sql .= " AND f.ref_client LIKE '%".$db->escape($search_refcustomer)."%'"; if ($search_societe) $sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'"; -if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; +if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; +if ($month > 0) +{ + if ($year > 0) + $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else + $sql.= " AND date_format(f.datef, '%m') = '$month'"; +} +else if ($year > 0) +{ + $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} $sql.= " GROUP BY s.nom, s.rowid, s.email, f.rowid, f.facnumber, f.ref_client, f.increment, f.total, f.tva, f.total_ttc, f.localtax1, f.localtax2, f.revenuestamp,"; $sql.= " f.datef, f.date_lim_reglement, f.paye, f.fk_statut, f.type, fk_mode_reglement"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; @@ -438,7 +487,7 @@ $sql.= " ORDER BY "; $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.=$listfield[$key]." ".$sortorder.","; $sql.= " f.facnumber DESC"; - +//print $sql; //$sql .= $db->plimit($limit+1,$offset); $resql = $db->query($sql); @@ -454,25 +503,28 @@ if ($resql) $param=""; $param.=(! empty($socid)?"&socid=".$socid:""); - $param.=(! empty($option)?"&option=".$option:""); if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer); + if ($search_refcustomer) $param.='&search_ref='.urlencode($search_refcustomer); if ($search_societe) $param.='&search_societe='.urlencode($search_societe); if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode); if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($late) $param.='&late='.urlencode($late); - + if ($mode) $param.='&mode='.urlencode($mode); $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource.=str_replace('&','&',$param); - $titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid")); + //$titre=(! empty($socid)?$langs->trans("BillsCustomersUnpaidForCompany",$soc->name):$langs->trans("BillsCustomersUnpaid")); + $titre=(! empty($socid)?$langs->trans("BillsCustomersForCompany",$soc->name):$langs->trans("BillsCustomers")); if ($option == 'late') $titre.=' ('.$langs->trans("Late").')'; - else $titre.=' ('.$langs->trans("All").')'; + //else $titre.=' ('.$langs->trans("All").')'; $link=''; - if (empty($option)) $link=''.$langs->trans("ShowUnpaidLateOnly").''; - elseif ($option == 'late') $link=''.$langs->trans("ShowUnpaidAll").''; + if (empty($option) || $option == 'late') $link.=($link?' - ':'').''.$langs->trans("ShowUnpaidAll").''; + if (empty($option) || $option == 'unpaidall') $link.=($link?' - ':'').''.$langs->trans("ShowUnpaidLateOnly").''; + + $param.=(! empty($option)?"&option=".$option:""); + print_fiche_titre($titre,$link); //print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page @@ -574,7 +626,11 @@ if ($resql) print ''; print ''; print ''; - print ' '; + print ''; + print ''; + $syear = $year; + $formother->select_year($syear?$syear:-1,'year',1, 20, 5); + print ''; print ' '; print ''; print ''; @@ -586,21 +642,22 @@ if ($resql) print ' '; print ' '; print ''; + $liststatus=array('paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); + print $form->selectarray('filtre', $liststatus, $filter, 1); + print ''; + print ''; print ''; print ''; - print ''; + print '
'; if (empty($mode)) { - print ''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; - print ''; } else { - print ''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; - print ''; } + print ''; print "\n"; if ($num > 0) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index f481abdcf0c..37d074b9f16 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -165,9 +165,16 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'Repeatable', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/impayees.php?action=facturer&leftmenu=customers_bills', 'Unpaid', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); + +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1720__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=0', 'BillShortStatusDraft', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1721__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=1', 'BillShortStatusNotPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1722__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=2', 'BillShortStatusPaid', 2, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1723__+MAX_llx_menu__, 'accountancy', '', 1705__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills&search_status=3', 'BillShortStatusCanceled', 2, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/mergepdftool.php?action=facturer&leftmenu=customers_bills', 'MergingPDFTool', 1, 'bills', '$user->rights->facture->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Accountancy - Orders to bill insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d6ee928b121..069d672609c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -741,27 +741,30 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->facture->enabled)) { $langs->load("bills"); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); - $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); - $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); + $newmenu->add("/compta/facture.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer); + $newmenu->add("/compta/facture/fiche-rec.php",$langs->trans("Repeatables"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire); - if (empty($leftmenu) || ($leftmenu == 'customers_bills')) { + if (empty($leftmenu) || ($leftmenu == 'customers_bills')) + { $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills&search_status=0",$langs->trans("BillShortStatusDraft"),2,$user->rights->facture->lire); - $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills&search_status=1",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills&search_status=2",$langs->trans("BillShortStatusPaid"),2,$user->rights->facture->lire); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills&search_status=3",$langs->trans("BillShortStatusCanceled"),2,$user->rights->facture->lire); } - $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payments",$langs->trans("Payments"),1,$user->rights->facture->lire); + $newmenu->add("/compta/paiement/list.php",$langs->trans("Payments"),1,$user->rights->facture->lire); if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - $newmenu->add("/compta/paiement/avalider.php?leftmenu=customers_bills_payments",$langs->trans("MenuToValid"),2,$user->rights->facture->lire); + $newmenu->add("/compta/paiement/avalider.php",$langs->trans("MenuToValid"),2,$user->rights->facture->lire); } - $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payments",$langs->trans("Reportings"),2,$user->rights->facture->lire); + $newmenu->add("/compta/paiement/rapport.php",$langs->trans("Reportings"),2,$user->rights->facture->lire); - $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills", $langs->trans("Statistics"),1,$user->rights->facture->lire); + $newmenu->add("/compta/facture/mergepdftool.php",$langs->trans("MergingPDFTool"),1,$user->rights->facture->lire); + + $newmenu->add("/compta/facture/stats/index.php", $langs->trans("Statistics"),1,$user->rights->facture->lire); } // Suppliers diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3c1b0f06cb6..836d214e19a 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -120,7 +120,7 @@ if ($mode == 'search') $now=dol_now(); $form=new Form($db); -$htmlother=new FormOther($db); +$formother=new FormOther($db); $formfile = new FormFile($db); llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); @@ -245,7 +245,7 @@ if ($resql) print ' '; print "\n"; - // Lignes des champs de filtre + // Line for filters print ''; print ''; @@ -259,10 +259,8 @@ if ($resql) } print ''; print ''; - //print ' '.$langs->trans('Year').': '; $syear = $year; - //if ($syear == '') $syear = date("Y"); - $htmlother->select_year($syear?$syear:-1,'year',1, 20, 5); + $formother->select_year($syear?$syear:-1,'year',1, 20, 5); print ''; print ' '; print ''; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ac8e6da082b..ec455843cb7 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -298,6 +298,7 @@ RelatedCustomerInvoices=Related customer invoices RelatedSupplierInvoices=Related supplier invoices LatestRelatedBill=Latest related invoice WarningBillExist=Warning, one or more invoice already exist +MergingPDFTool=Merging PDF tool # PaymentConditions PaymentConditionShortRECEP=Immediate From 877e60c76f167828a98c135057ae077ef10f8c82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 19:20:11 +0200 Subject: [PATCH 037/184] Set default filter --- htdocs/compta/facture/mergepdftool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index 74017da1f17..8022001fe2a 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -49,7 +49,6 @@ $builddoc_generatebutton=GETPOST('builddoc_generatebutton'); $month = GETPOST("month","int"); $year = GETPOST("year","int"); $filter = GETPOST("filtre"); - if (GETPOST('button_search')) { $filter=GETPOST('filtre',2); @@ -58,6 +57,7 @@ if (GETPOST('button_search')) if ($option == 'late') $filter = 'paye:0'; if ($option == 'unpaidall') $filter = 'paye:0'; if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0'; +if ($filter == '') $filter = 'paye:0'; // Security check if ($user->societe_id) $socid=$user->societe_id; From 2550c6b0afe821dc6d88dfef69053db981e0d790 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 19:22:58 +0200 Subject: [PATCH 038/184] Must exclude draft and abandon into default filter. --- htdocs/compta/facture/mergepdftool.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index 8022001fe2a..dfa1207e423 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -448,7 +448,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_fac $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.type IN (0,1,3,5)"; -//$sql.= " AND f.fk_statut = 1"; +if ($filter == 'paye:0') $sql.= " AND f.fk_statut = 1"; //$sql.= " AND f.paye = 0"; if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; From c148f82452139ced15104efbeeb784ad98830a74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 19:31:25 +0200 Subject: [PATCH 039/184] Fix warning --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e8d0cc3f254..5efbc507db9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -724,7 +724,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p // Show tabs $bactive=false; // if =0 we don't use the feature - $limittoshow=($conf->global->MAIN_MAXTABS_IN_CARD?$conf->global->MAIN_MAXTABS_IN_CARD:99); + $limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD); $displaytab=0; for ($i = 0 ; $i <= $maxkey ; $i++) From 493392d89fd30e591e0762af0181bac7975a3e38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 6 Apr 2015 19:46:10 +0200 Subject: [PATCH 040/184] Remove warnings --- htdocs/core/class/extrafields.class.php | 8 ++++---- htdocs/core/lib/functions.lib.php | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 16e6af25cc7..a9a44fc27d1 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -568,11 +568,11 @@ class ExtraFields global $conf; if ( empty($elementtype) ) return array(); - + if ($elementtype == 'thirdparty') $elementtype='societe'; $array_name_label=array(); - + // For avoid conflicts with external modules if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; @@ -602,7 +602,7 @@ class ExtraFields $this->attribute_elementtype[$tab->name]=$tab->elementtype; $this->attribute_unique[$tab->name]=$tab->fieldunique; $this->attribute_required[$tab->name]=$tab->fieldrequired; - $this->attribute_param[$tab->name]=unserialize($tab->param); + $this->attribute_param[$tab->name]=($tab->param ? unserialize($tab->param) : ''); $this->attribute_pos[$tab->name]=$tab->pos; $this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable; $this->attribute_perms[$tab->name]=$tab->perms; @@ -1056,7 +1056,7 @@ class ExtraFields elseif ($type == 'link') { $out=''; - + $param_list=array_keys($param['options']); // 0 : ObjectName // 1 : classPath diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5efbc507db9..a32f52abc1b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -729,8 +729,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p for ($i = 0 ; $i <= $maxkey ; $i++) { - - if ((is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2])) + if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) { $isactive=true; $bactive=true; @@ -742,7 +741,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p if ($i <=$limittoshow || $isactive ) { - $out.='
'; + $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') { if (!empty($links[$i][0])) From 85d8d06ca45c2bc2c6433760189c267f3d3a5331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 6 Apr 2015 20:02:29 +0200 Subject: [PATCH 041/184] Travis fix CMailFile.class.php --- htdocs/core/class/CMailFile.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 82d675019d1..967b764dc65 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -514,11 +514,11 @@ class CMailFile return $res; } - - // Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word - /** - * @param string $stringtoencode + * Encode subject according to RFC 2822 - http://en.wikipedia.org/wiki/MIME#Encoded-Word + * + * @param string $stringtoencode String to encode + * @return string string encoded */ function encodetorfc2822($stringtoencode) { From 1d6a8a46f1729586af52954e21575f42df3d879c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Apr 2015 02:44:30 +0200 Subject: [PATCH 042/184] To clean an int we must use (int) and not trim() --- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/expedition/class/expedition.class.php | 6 +++--- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index cbf5b428cc0..ee15a261820 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -73,7 +73,7 @@ class AdherentType extends CommonObject { global $conf; - $this->statut=trim($this->statut); + $this->statut=(int) $this->statut; $sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type ("; $sql.= "libelle"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index dcabc4e0b52..6797daa46ab 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1131,7 +1131,7 @@ class Contrat extends CommonObject if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext); if (isset($this->entity)) $this->entity=trim($this->entity); - if (isset($this->statut)) $this->statut=trim($this->statut); + if (isset($this->statut)) $this->statut=(int) $this->statut; if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc); if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet); if (isset($this->fk_commercial_signature)) $this->fk_commercial_signature=trim($this->fk_commercial_signature); @@ -2417,7 +2417,7 @@ class ContratLigne extends CommonObject // Clean parameters $this->fk_contrat=trim($this->fk_contrat); $this->fk_product=trim($this->fk_product); - $this->statut=trim($this->statut); + $this->statut=(int) $this->statut; $this->label=trim($this->label); $this->description=trim($this->description); $this->tva_tx=trim($this->tva_tx); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f357d03eb36..6e8c81450ce 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -492,9 +492,9 @@ class Expedition extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; + $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - + $this->db->free($result); if ($this->statut == 0) $this->brouillon = 1; @@ -878,7 +878,7 @@ class Expedition extends CommonObject if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address); if (isset($this->shipping_method_id)) $this->shipping_method_id=trim($this->shipping_method_id); if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number); - if (isset($this->statut)) $this->statut=trim($this->statut); + if (isset($this->statut)) $this->statut=(int) $this->statut; if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth); if (isset($this->trueWidth)) $this->trueWidth=trim($this->trueWidth); if (isset($this->trueHeight)) $this->trueHeight=trim($this->trueHeight); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ceb9a56b946..a76f55567a8 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -577,7 +577,7 @@ class FactureFournisseur extends CommonInvoice // if (isset($this->total_localtax1)) $this->total_localtax1=trim($this->total_localtax1); // if (isset($this->total_localtax2)) $this->total_localtax2=trim($this->total_localtax2); if (isset($this->total_ttc)) $this->total_ttc=trim($this->total_ttc); - if (isset($this->statut)) $this->statut=trim($this->statut); + if (isset($this->statut)) $this->statut=(int) $this->statut; if (isset($this->author)) $this->author=trim($this->author); if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid); if (isset($this->fk_facture_source)) $this->fk_facture_source=trim($this->fk_facture_source); From 918ed34364feef1039f989af6c1ce725f09ee2e8 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 7 Apr 2015 00:45:30 +0000 Subject: [PATCH 043/184] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/core/filemanagerdol/connectors/php/commands.php | 6 ++++++ .../core/modules/contract/doc/pdf_strato.modules.php | 6 +++--- htdocs/core/modules/import/modules_import.php | 2 +- htdocs/core/modules/mailings/contacts1.modules.php | 2 +- htdocs/core/modules/mailings/fraise.modules.php | 2 +- htdocs/core/modules/product/modules_product.class.php | 2 +- .../project/doc/doc_generic_project_odt.modules.php | 2 +- htdocs/core/modules/propale/modules_propale.php | 4 ++-- htdocs/core/modules/societe/modules_societe.class.php | 4 ++-- .../supplier_invoice/modules_facturefournisseur.php | 2 +- htdocs/paypal/lib/paypal.lib.php | 10 ++++++++++ htdocs/projet/class/task.class.php | 4 ++-- 12 files changed, 31 insertions(+), 15 deletions(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 18b54c1c6b8..0dc17d7313c 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -22,6 +22,9 @@ * This is the File Manager Connector for PHP. */ +/** + * @param string $currentFolder + */ function GetFolders( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. @@ -178,6 +181,9 @@ function CreateFolder( $resourceType, $currentFolder ) // DOL_CHANGE //function FileUpload( $resourceType, $currentFolder, $sCommand ) +/** + * @param string $currentFolder + */ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') { if (!isset($_FILES)) { diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 46364b23d0d..9b5b80ceeaf 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -452,7 +452,7 @@ class pdf_strato extends ModelePDFContract * Show top header of page. * * @param PDF $pdf Object PDF - * @param Object $object Object to show + * @param CommonObject $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @return void @@ -631,10 +631,10 @@ class pdf_strato extends ModelePDFContract * Show footer of page. Need this->emetteur object * * @param PDF $pdf PDF - * @param Object $object Object to show + * @param CommonObject $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text - * @return void + * @return integer */ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) { diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 49fb7decd69..4fa5052a90a 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -63,7 +63,7 @@ class ModeleImports * Charge en memoire et renvoie la liste des modeles actifs * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ function liste_modeles($db,$maxfilenamelength=0) diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 5d218376983..558b83ed53f 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -60,7 +60,7 @@ class mailing_contacts1 extends MailingTargets * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ function getSqlArrayForStats() { diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 69b018080b8..963e8ef0c28 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -63,7 +63,7 @@ class mailing_fraise extends MailingTargets * array of SQL request that returns two field: * One called "label", One called "nb". * - * @return array Array with SQL requests + * @return string[] Array with SQL requests */ function getSqlArrayForStats() { diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 0bfd3f8f03e..e08ea074bbd 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -105,7 +105,7 @@ abstract class ModeleProductCode * Renvoi la liste des modeles de numérotation * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ static function liste_modeles($db,$maxfilenamelength=0) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index f19d8a0e3a0..6e2601797f8 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -105,7 +105,7 @@ class doc_generic_project_odt extends ModelePDFProjects /** * Define array with couple substitution key => substitution value * - * @param Object $object Main object to use as data source + * @param Project $object Main object to use as data source * @param Translate $outputlangs Lang object to use for output * @return array Array of substitution */ diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 9b0cc1d82a2..9ad90e9e3b5 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -43,7 +43,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator * Return list of active generation modules * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ static function liste_modeles($db,$maxfilenamelength=0) @@ -149,7 +149,7 @@ abstract class ModeleNumRefPropales * Create a document onto disk according to template module. * * @param DoliDB $db Database handler - * @param object $object Object proposal + * @param Propal $object Object proposal * @param string $modele Force model to use ('' to not force) * @param Translate $outputlangs Object langs to use for output * @param int $hidedetails Hide details of lines diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index f1fc05d29db..72090a581ea 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -39,7 +39,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator * Return list of active generation modules * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ static function liste_modeles($db,$maxfilenamelength=0) @@ -142,7 +142,7 @@ abstract class ModeleThirdPartyCode * Renvoi la liste des modeles de numéroation * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ static function liste_modeles($db,$maxfilenamelength=0) diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 51eb675057e..03dc42280cb 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -41,7 +41,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator * Return list of active generation models * * @param DoliDB $db Database handler - * @param string $maxfilenamelength Max length of value to show + * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ static function liste_modeles($db,$maxfilenamelength=0) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 2e8ab4bf0b8..76ea5ab4834 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -436,6 +436,16 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re ' desc: Product description '-------------------------------------------------------------------------------------------------------------------------------------------- */ +/** + * @param double $paymentAmount + * @param string $currencyCodeType + * @param string $paymentType + * @param string $returnURL + * @param string $cancelURL + * @param string $tag + * @param string $solutionType + * @param string $landingPage + */ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum, $email='', $desc='') { //------------------------------------------------------------------------------------------------------------------------------------ diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 5e02efe6463..3fb2586625e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1331,7 +1331,7 @@ class Task extends CommonObject /** * Return status label of object * - * @param string $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ function getLibStatut($mode=0) @@ -1343,7 +1343,7 @@ class Task extends CommonObject * Return status label for an object * * @param int $statut Id statut - * @param string $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param integer $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ function LibStatut($statut,$mode=0) From ad50810c7ab71cc8557e55e4bf75c0117d9b6ca7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Apr 2015 02:48:19 +0200 Subject: [PATCH 044/184] Fix deprecated code --- htdocs/core/lib/bank.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index df9a25ae7c8..0ed32bec16c 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -84,7 +84,7 @@ function bank_prepare_head(Account $object) } /** * Prepare array with list of tabs - * + * * @param Object $object Object related to tabs * @return array Array of tabs to shoc */ @@ -99,13 +99,13 @@ function bank_admin_prepare_head($object) $head[$h][2] = 'general'; $h++; - + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank_admin'); - + $head[$h][0] = DOL_URL_ROOT.'/admin/bank_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; @@ -120,12 +120,12 @@ function bank_admin_prepare_head($object) * Check SWIFT informations for a bank account * * @param Account $account A bank account - * @return boolean True if informations are valid, false otherwise + * @return boolean True if informations are valid, false otherwise */ function checkSwiftForAccount($account) { $swift = $account->bic; - if (eregi("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift)) { + if (preg_march("/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) { return true; } else { return false; From 6fa0234409683beb49a2aa14668b90e45ccf5148 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Apr 2015 03:00:11 +0200 Subject: [PATCH 045/184] Uniformize code --- htdocs/admin/askpricesupplier.php | 1 - htdocs/categories/categorie.php | 2 +- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/sociales/document.php | 4 +- htdocs/contact/card.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/core/lib/contact.lib.php | 2 +- htdocs/core/lib/product.lib.php | 5 +- htdocs/core/lib/tax.lib.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/loan/document.php | 4 +- htdocs/margin/tabs/productMargins.php | 2 +- .../product/actions_card_product.class.php | 2 +- .../service/actions_card_service.class.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/composition/card.php | 2 +- htdocs/product/document.php | 2 +- htdocs/product/fournisseurs.php | 12 ++--- htdocs/product/photos.php | 2 +- htdocs/product/price.php | 2 +- htdocs/product/stats/card.php | 2 +- htdocs/product/stats/commande.php | 2 +- htdocs/product/stats/commande_fournisseur.php | 2 +- htdocs/product/stats/contrat.php | 2 +- htdocs/product/stats/facture.php | 16 +++--- htdocs/product/stats/facture_fournisseur.php | 50 ++++++++--------- htdocs/product/stats/propal.php | 54 +++++++++---------- htdocs/product/stock/product.php | 2 +- htdocs/product/traduction.php | 4 +- htdocs/societe/admin/societe.php | 2 +- htdocs/societe/admin/societe_extrafields.php | 2 +- 31 files changed, 96 insertions(+), 98 deletions(-) diff --git a/htdocs/admin/askpricesupplier.php b/htdocs/admin/askpricesupplier.php index 6307e81042c..d2072a0c79c 100644 --- a/htdocs/admin/askpricesupplier.php +++ b/htdocs/admin/askpricesupplier.php @@ -319,7 +319,6 @@ foreach ($dirmodels as $reldir) // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $askpricesupplier->type=0; $nextval=$module->getNextValue($mysoc,$askpricesupplier); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip.=''.$langs->trans("NextValue").': '; diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 76af3708c8b..1cd605ea9ca 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -341,7 +341,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("CardProduct".$product->type)); - $head=product_prepare_head($product, $user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'category', $titre,0,$picto); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 900a970d949..b6215165d35 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -781,8 +781,8 @@ class Account extends CommonObject $result=$this->deleteExtraFields(); if ($result < 0) { - return -1; dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); + return -1; } } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index ad5af8f84c2..f87791dfed9 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -88,8 +88,8 @@ llxHeader("",$langs->trans("SocialContribution"),$help_url); if ($object->id) { $alreadypayed=$object->getSommePaiement(); - - $head=tax_prepare_head($object, $user); + + $head=tax_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("SocialContribution"), 0, 'bill'); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f8ebe12cd9b..5936e596fb7 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -255,7 +255,7 @@ if (empty($reshook)) } else { - setEventMessage($object->error,$object->errors,'errors'); + setEventMessages($object->error,$object->errors,'errors'); } } diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 970f3543c45..2241a1e67f1 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -79,7 +79,7 @@ llxHeader("",$langs->trans("Contact"), $helpurl); if ($object->id) { - $head = contact_prepare_head($object, $user); + $head = contact_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Contact"), 0, 'contact'); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index ba2d8ad5772..278402679f8 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -94,7 +94,7 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'category'; $tab++; } - + // Info $head[$tab][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; $head[$tab][1] = $langs->trans("Info"); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a02747bb8aa..a35ab95a24a 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -28,12 +28,11 @@ * Prepare array with list of tabs * * @param Product $object Object related to tabs - * @param User $user Object user * @return array Array of tabs to show */ -function product_prepare_head($object, $user) +function product_prepare_head($object) { - global $langs, $conf; + global $langs, $conf, $user; $langs->load("products"); $h = 0; diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index bee6999d183..f6623362dcc 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -36,7 +36,7 @@ */ function tax_prepare_head(ChargeSociales $object) { - global $langs, $conf; + global $langs, $conf, $user; $h = 0; $head = array(); diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index fd039efff24..bd6746c98e4 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -88,7 +88,7 @@ if ($object->id) { $object->fetch_thirdparty(); - $head=fichinter_prepare_head($object, $user); + $head=fichinter_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("InterventionCard"), 0, 'intervention'); diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 788048a215b..3831f73a7ea 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -81,8 +81,8 @@ llxHeader("",$langs->trans("Loan"),$help_url); if ($object->id) { $alreadypayed=$object->getSumPayment(); - - $head = loan_prepare_head($object, $user); + + $head = loan_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans("Loan"), 0, 'bill'); diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 2123f683c21..eb3ac32c424 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -77,7 +77,7 @@ if ($id > 0 || ! empty($ref)) */ if ($result > 0) { - $head=product_prepare_head($object, $user); + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'margin', $titre, 0, $picto); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 84140ee3f6a..260c8996fc4 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -138,7 +138,7 @@ class ActionsCardProduct if ($action == 'view') { - $head = product_prepare_head($this->object,$user); + $head = product_prepare_head($this->object); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref'); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 5926beab083..f7de783cd99 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -137,7 +137,7 @@ class ActionsCardService if ($action == 'view') { - $head = product_prepare_head($this->object,$user); + $head = product_prepare_head($this->object); $this->tpl['showrefnav'] = $form->showrefnav($this->object,'ref','',1,'ref'); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index eecec0705f7..1803c35629b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1306,7 +1306,7 @@ else // Fiche en mode visu else { - $head=product_prepare_head($object, $user); + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'card', $titre, 0, $picto); diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 96f2a589429..fc3a41a8861 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -174,7 +174,7 @@ if ($action == 'search') llxHeader("","",$langs->trans("CardProduct".$object->type)); -$head=product_prepare_head($object, $user); +$head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'subproduct', $titre, 0, $picto); diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 9a71eac4f55..810a131be60 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -100,7 +100,7 @@ llxHeader("","",$langs->trans("CardProduct".$object->type)); if ($object->id) { - $head=product_prepare_head($object, $user); + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'documents', $titre, 0, $picto); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c2196aba00b..f35e6628ad6 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -143,7 +143,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $_POST["price"] = 0; } } - + $product = new ProductFournisseur($db); $result=$product->fetch($id); if ($result <= 0) @@ -191,7 +191,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) } else { - if ($price_expression !== '') + if ($price_expression !== '') { //Check the expression validity by parsing it $priceparser = new PriceParser($db); @@ -257,7 +257,7 @@ if ($id || $ref) * En mode visu */ - $head=product_prepare_head($product, $user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'suppliers', $titre, 0, $picto); @@ -323,7 +323,7 @@ if ($id || $ref) $supplier->fetch($socid); print $supplier->getNomUrl(1); print ''; - print ''; + print ''; print ''; } else @@ -380,7 +380,7 @@ if ($id || $ref) { print ''; } - print ''; + print ''; // Vat rate $default_vat=''; @@ -450,7 +450,7 @@ if ($id || $ref) print ''; print ''; - + // Delai livraison jours print ''; print ''.$langs->trans('NbDaysToDelivery').''; diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 8a6e2ddbd6b..c6245cf203c 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -100,7 +100,7 @@ if ($object->id) /* * En mode visu */ - $head=product_prepare_head($object, $user); + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'photos', $titre, 0, $picto); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3e7ba24d3dd..2c9ab9a7794 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -353,7 +353,7 @@ if (! empty($id) || ! empty($ref)) llxHeader("", "", $langs->trans("CardProduct" . $object->type)); -$head = product_prepare_head($object, $user); +$head = product_prepare_head($object); $titre = $langs->trans("CardProduct" . $object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'price', $titre, 0, $picto); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 788068ea5ec..ce161a1af60 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -67,7 +67,7 @@ if (! empty($id) || ! empty($ref)) if ($result) { - $head=product_prepare_head($object, $user); + $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 81b251d795b..7dcf6139534 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -89,7 +89,7 @@ if ($id > 0 || ! empty($ref)) if ($result > 0) { - $head=product_prepare_head($product, $user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index f0444356bcc..e6ced5ad905 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -96,7 +96,7 @@ if ($id > 0 || ! empty($ref)) { llxHeader("", "", $langs->trans("CardProduct" . $product->type)); if ($result > 0) { - $head = product_prepare_head($product, $user); + $head = product_prepare_head($product); $titre = $langs->trans("CardProduct" . $product->type); $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index aa535f02575..d098ca3399b 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -79,7 +79,7 @@ if ($id > 0 || ! empty($ref)) if ($result > 0) { - $head=product_prepare_head($product,$user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index c0fa1481269..1f4e9b985e5 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -90,7 +90,7 @@ if ($id > 0 || ! empty($ref)) if ($result > 0) { - $head=product_prepare_head($product, $user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); @@ -148,7 +148,7 @@ if ($id > 0 || ! empty($ref)) if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " ORDER BY $sortfield $sortorder "; - + //Calcul total qty and amount for global if full scan list $total_ht=0; $total_qty=0; @@ -163,21 +163,21 @@ if ($id > 0 || ! empty($ref)) } } } - + $sql.= $db->plimit($conf->liste_limit +1, $offset); $result = $db->query($sql); - if ($result) + if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) $option .= '&id='.$product->id; if (! empty($search_month)) $option .= '&search_month='.$search_month; if (! empty($search_year)) $option .= '&search_year='.$search_year; - + print '
' . "\n"; if (! empty($sortfield)) print ''; @@ -187,7 +187,7 @@ if ($id > 0 || ! empty($ref)) print ''; $option .= '&page=' . $page; } - + print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,''); print '
'; print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - '; @@ -235,7 +235,7 @@ if ($id > 0 || ! empty($ref)) print ''.$invoicestatic->LibStatut($objp->paye,$objp->statut,5).''; print "\n"; $i++; - + if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $total_ht+=$objp->total_ht; $total_qty+=$objp->qty; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 275a2ff8604..debb0698c44 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -82,52 +82,52 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); - + if ($result > 0) { - $head = product_prepare_head($product, $user); + $head = product_prepare_head($product); $titre = $langs->trans("CardProduct" . $product->type); $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print ''; - + // Reference print ''; print ''; print ''; - + // Libelle print ''; print ''; - + // Status (to sell) print ''; - + // Status (to buy) print ''; - + show_stats_for_company($product, $socid); - + print "
' . $langs->trans("Ref") . ''; print $form->showrefnav($product, 'ref', '', 1, 'ref'); print '
' . $langs->trans("Label") . '' . $product->libelle . '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; print $product->getLibStatut(2, 0); print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; print $product->getLibStatut(2, 1); print '
"; - + print '
'; - + if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT distinct s.nom as name, s.rowid as socid, s.code_client, f.ref, d.total_ht as total_ht,"; @@ -142,14 +142,14 @@ if ($id > 0 || ! empty($ref)) $sql .= " AND f.entity = " . $conf->entity; $sql .= " AND d.fk_facture_fourn = f.rowid"; $sql .= " AND d.fk_product =" . $product->id; - if (! empty($search_month)) + if (! empty($search_month)) $sql .= ' AND MONTH(f.datef) IN (' . $search_month . ')'; - if (! empty($search_year)) + if (! empty($search_year)) $sql .= ' AND YEAR(f.datef) IN (' . $search_year . ')'; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id; if ($socid) $sql .= " AND f.fk_soc = " . $socid; $sql .= " ORDER BY $sortfield $sortorder "; - + // Calcul total qty and amount for global if full scan list $total_ht = 0; $total_qty = 0; @@ -164,21 +164,21 @@ if ($id > 0 || ! empty($ref)) } } } - + $sql .= $db->plimit($conf->liste_limit + 1, $offset); - + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) $option .= '&id=' . $product->id; if (! empty($search_month)) $option .= '&search_month=' . $search_month; if (! empty($search_year)) $option .= '&search_year=' . $search_year; - + print '' . "\n"; if (! empty($sortfield)) print ''; @@ -199,7 +199,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; print '
'; - + $i = 0; print ''; print ''; @@ -211,7 +211,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; - + if ($num > 0) { $var = True; @@ -219,7 +219,7 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($result); $var = ! $var; - + print ''; print ''; print "\n"; $i ++; - + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $total_ht += $objp->total_ht; $total_qty += $objp->qty; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 4eae4c238e1..1776ba571e0 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -80,52 +80,52 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $result = $product->fetch($id, $ref); - + $parameters = array ('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + llxHeader("", "", $langs->trans("CardProduct" . $product->type)); - + if ($result > 0) { - $head = product_prepare_head($product, $user); + $head = product_prepare_head($product); $titre = $langs->trans("CardProduct" . $product->type); $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'referers', $titre, 0, $picto); - + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print '
'; $supplierinvoicestatic->id = $objp->facid; @@ -236,7 +236,7 @@ if ($id > 0 || ! empty($ref)) print '' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '
'; - + // Reference print ''; print ''; print ''; - + // Libelle print ''; print ''; - + // Status (to sell) print ''; - + // Status (to buy) print ''; - + show_stats_for_company($product, $socid); - + print "
' . $langs->trans("Ref") . ''; print $form->showrefnav($product, 'ref', '', 1, 'ref'); print '
' . $langs->trans("Label") . '' . $product->libelle . '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; print $product->getLibStatut(2, 0); print '
' . $langs->trans("Status") . ' (' . $langs->trans("Buy") . ')'; print $product->getLibStatut(2, 1); print '
"; - + print ''; - + if ($user->rights->propale->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; @@ -150,7 +150,7 @@ if ($id > 0 || ! empty($ref)) if ($socid) $sql .= " AND p.fk_soc = " . $socid; $sql .= " ORDER BY $sortfield $sortorder "; - + // Calcul total qty and amount for global if full scan list $total_ht = 0; $total_qty = 0; @@ -165,21 +165,21 @@ if ($id > 0 || ! empty($ref)) } } } - + $sql .= $db->plimit($conf->liste_limit + 1, $offset); - + $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + if (! empty($id)) $option .= '&id=' . $product->id; if (! empty($search_month)) $option .= '&search_month=' . $search_month; if (! empty($search_year)) $option .= '&search_year=' . $search_year; - + print '' . "\n"; if (! empty($sortfield)) print ''; @@ -189,7 +189,7 @@ if ($id > 0 || ! empty($ref)) print ''; $option .= '&page=' . $page; } - + print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, ''); print '
'; print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - '; @@ -200,7 +200,7 @@ if ($id > 0 || ! empty($ref)) print ''; print '
'; print ''; - + $i = 0; print ''; print ''; @@ -211,7 +211,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; - + if ($num > 0) { $var = True; @@ -219,7 +219,7 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($result); $var = ! $var; - + print ''; print ''; print "\n"; $i ++; - + if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $total_ht += $objp->total_ht; $total_qty += $objp->qty; } } - } + } print ''; print ''; print ''; @@ -251,12 +251,12 @@ if ($id > 0 || ! empty($ref)) print ''; print "
'; $propalstatic->id=$objp->propalid; @@ -236,13 +236,13 @@ if ($id > 0 || ! empty($ref)) print '' . $propalstatic->LibStatut($objp->statut, 5) . '
' . $langs->trans('Total') . '
"; print ''; - print '
'; + print '
'; } else { dol_print_error($db); } $db->free($result); - } + } } } else { dol_print_error(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d4a190a482a..c6942e8c8e2 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -384,7 +384,7 @@ if ($id > 0 || $ref) if ($result > 0) { - $head=product_prepare_head($product, $user); + $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'stock', $titre, 0, $picto); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 480f739285d..413cb589dff 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -143,7 +143,7 @@ $cancel != $langs->trans("Cancel") && $product->fetch($id); $langtodelete=GETPOST('langdel','alpha'); - + if ( $product->delMultiLangs($langtodelete) > 0 ) { $action = ''; @@ -168,7 +168,7 @@ llxHeader("","",$langs->trans("Translation")); $form = new Form($db); $formadmin=new FormAdmin($db); -$head=product_prepare_head($product, $user); +$head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'translation', $titre, 0, $picto); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 881946cb1cd..3dd00e8d860 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -291,7 +291,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); -$head = societe_admin_prepare_head(null); +$head = societe_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), 0, 'company'); diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 928cac01f7c..a680703e811 100644 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -69,7 +69,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup'); -$head = societe_admin_prepare_head(null); +$head = societe_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("ThirdParties"), 0, 'company'); From 7a2942684cffef8e02bc8994cec776b108c5d655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Apr 2015 12:45:25 +0200 Subject: [PATCH 046/184] Fix #2559 Bug: Untranslated "Total" in Bank module --- htdocs/compta/bank/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index c9b70e94257..c74c5509139 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -130,7 +130,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ''; From 0dc7bc0ddbc4310a1eced84c0f8cc543d6749901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Apr 2015 12:54:10 +0200 Subject: [PATCH 047/184] Add badge --- htdocs/core/lib/loan.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index be04beb1d9a..1dcd2fea7f9 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -62,7 +62,7 @@ function loan_prepare_head($object) $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id; $head[$tab][1] = $langs->trans("Documents"); - if($nbFiles > 0) $head[$tab][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$tab][1].= ' '.$nbFiles.''; $head[$tab][2] = 'documents'; $tab++; @@ -74,4 +74,4 @@ function loan_prepare_head($object) complete_head_from_modules($conf,$langs,$object,$head,$tab,'loan','remove'); return $head; -} \ No newline at end of file +} From 547b7d5f91f6f79cb620322fa62255be5ced3a3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Apr 2015 18:14:20 +0200 Subject: [PATCH 048/184] Fix #2539 --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 5 +++-- htdocs/install/mysql/tables/llx_commande.sql | 4 +++- htdocs/install/mysql/tables/llx_commande_fournisseur.sql | 2 ++ htdocs/install/mysql/tables/llx_expedition.sql | 4 +++- htdocs/install/mysql/tables/llx_facture.sql | 3 +++ htdocs/install/mysql/tables/llx_facture_fourn.sql | 8 +++++--- htdocs/install/mysql/tables/llx_livraison.sql | 4 +++- htdocs/install/mysql/tables/llx_propal.sql | 2 ++ htdocs/install/mysql/tables/llx_societe.sql | 2 ++ 9 files changed, 26 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index d8f47651153..6af1a0fe647 100644 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -378,6 +378,9 @@ CREATE TABLE llx_askpricesupplierdet_extrafields ( -- End Module AskPriceSupplier -- +ALTER TABLE llx_commande_fournisseur ADD COLUMN date_approve2 datetime after date_approve; +ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_approve2 integer after fk_user_approve; + ALTER TABLE llx_societe ADD COLUMN fk_incoterms integer; ALTER TABLE llx_societe ADD COLUMN location_incoterms varchar(255); ALTER TABLE llx_propal ADD COLUMN fk_incoterms integer; @@ -386,8 +389,6 @@ ALTER TABLE llx_commande ADD COLUMN fk_incoterms integer; ALTER TABLE llx_commande ADD COLUMN location_incoterms varchar(255); ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_incoterms integer; ALTER TABLE llx_commande_fournisseur ADD COLUMN location_incoterms varchar(255); -ALTER TABLE llx_commande_fournisseur ADD COLUMN date_approve2 datetime after date_approve; -ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_approve2 integer after fk_user_approve; ALTER TABLE llx_facture ADD COLUMN fk_incoterms integer; ALTER TABLE llx_facture ADD COLUMN location_incoterms varchar(255); ALTER TABLE llx_facture_fourn ADD COLUMN fk_incoterms integer; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 7bf22df1a1d..3511aa7ec78 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -62,10 +62,12 @@ create table llx_commande fk_mode_reglement integer, -- mode de reglement date_livraison date default NULL, - fk_shipping_method integer, -- shipping method id + fk_shipping_method integer, -- shipping method id fk_availability integer NULL, fk_input_reason integer, -- id coming from c_input_reason, '0' if no defined fk_delivery_address integer, -- delivery address (deprecated) + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index 247c8e8d6af..33588d8bf66 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -62,6 +62,8 @@ create table llx_commande_fournisseur fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement fk_input_method integer default 0, -- id coming from c_input_reason, '0' if no defined + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index 0a152b13069..d142a5cc628 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -50,6 +50,8 @@ create table llx_expedition weight float, -- weight note_private text, note_public text, - model_pdf varchar(255) + model_pdf varchar(255), + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255) -- for incoterms )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index eada5b46c2e..93a376c599c 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -75,6 +75,9 @@ create table llx_facture note_private text, note_public text, model_pdf varchar(255), + + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms import_key varchar(14), extraparams varchar(255), -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 33773b7a9cb..703b86841f9 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -60,12 +60,14 @@ create table llx_facture_fourn fk_projet integer, -- projet auquel est associee la facture fk_account integer, -- bank account - fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) - fk_mode_reglement integer, -- mode de reglement (CHQ, VIR, ...) - date_lim_reglement date, -- date limite de reglement + fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) + fk_mode_reglement integer, -- mode de reglement (CHQ, VIR, ...) + date_lim_reglement date, -- date limite de reglement note_private text, note_public text, + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms model_pdf varchar(255), import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_livraison.sql index 486212158aa..ed97eb33f94 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_livraison.sql @@ -39,6 +39,8 @@ create table llx_livraison total_ht double(24,8) DEFAULT 0, note_private text, note_public text, - model_pdf varchar(255) + model_pdf varchar(255), + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255) -- for incoterms )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 90996073021..8090b1fcb4d 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -65,6 +65,8 @@ create table llx_propal fk_shipping_method integer, -- shipping method id fk_availability integer NULL, fk_input_reason integer, + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms import_key varchar(14), extraparams varchar(255), -- for stock other parameters with json format fk_delivery_address integer -- delivery address (deprecated) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index e28cf062224..b3464f9fc1f 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -70,6 +70,8 @@ create table llx_societe fournisseur tinyint DEFAULT 0, -- fournisseur 0/1 supplier_account varchar(32), -- compte client chez un fournisseur fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel) + fk_incoterms integer, -- for incoterms + location_incoterms varchar(255), -- for incoterms customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1 customer_rate real DEFAULT 0, -- taux fiabilite client (0 a 1) supplier_rate real DEFAULT 0, -- taux fiabilite fournisseur (0 a 1) From 06c749942a8ec344bb6c66483d19ebcb1e04b081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 7 Apr 2015 18:40:19 +0200 Subject: [PATCH 049/184] Update index.php --- htdocs/compta/bank/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index c74c5509139..553979f51c3 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -179,7 +179,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ''; @@ -238,7 +238,7 @@ if (! $found) print ''.$langs->trans("None").' // Total foreach ($total as $key=>$solde) { - print ''.$langs->trans("Total ").$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; + print ''.$langs->trans("Total").' '.$key.''.price($solde, 0, $langs, 0, 0, -1, $key).''; } print ""; From 345b609ff05bb0edf8a943fdebdb479fc35418fe Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 18:41:40 +0200 Subject: [PATCH 050/184] Closes #2545 Bug: Missing object_margin.png in Amarok theme --- ChangeLog | 1 + htdocs/theme/amarok/img/object_margin.png | Bin 0 -> 579 bytes 2 files changed, 1 insertion(+) create mode 100644 htdocs/theme/amarok/img/object_margin.png diff --git a/ChangeLog b/ChangeLog index 34c26a04e18..bc57dfce49b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -34,6 +34,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project +- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/theme/amarok/img/object_margin.png b/htdocs/theme/amarok/img/object_margin.png new file mode 100644 index 0000000000000000000000000000000000000000..13e4b92c9ce2e0a3698d31fcfc2b82704653f7a0 GIT binary patch literal 579 zcmV-J0=)f+P)AcnU72+nI~k7O&wbPhKp(25S7yLez;ORgKES18>^qZMxkS#t4;4mP!Tkxe+YuKR~p# z$@oMS%NT}+&HxFcfQVpOE|z7b`l*-e*o5sSUdH9q`!{4z zY}=+hGKO=k6tl2Go9vMSK*{xkcH6fG93;^_SAQs`< z{(cHnFI|}=th_KaaqN?Qc zCjh-}k1uO$6!RW|XLIq=Wef@DrfbBaWOD(c3Aube1@!k|XJ_aB{QRpKpjs>h)nXxF zV!T4J5a9bh)6?g%EknKjAqAw@>R4{yeRvJ19-WzA_asS(wl*I>ee~caz)y}P@RPTh R<>vqZ002ovPDHLkV1h?{2Q~lz literal 0 HcmV?d00001 From 2dfaf08f6188400038fb6ee32f7d6f67eeba545c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 18:54:38 +0200 Subject: [PATCH 051/184] Closes #2545 Bug: Missing object_margin.png in Amarok theme Conflicts: ChangeLog --- ChangeLog | 4 ++++ htdocs/theme/amarok/img/object_margin.png | Bin 0 -> 579 bytes 2 files changed, 4 insertions(+) create mode 100644 htdocs/theme/amarok/img/object_margin.png diff --git a/ChangeLog b/ChangeLog index 456f58e3d60..22a6f55fda4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -209,6 +209,10 @@ Dolibarr better: - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract +- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line +- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project +- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/theme/amarok/img/object_margin.png b/htdocs/theme/amarok/img/object_margin.png new file mode 100644 index 0000000000000000000000000000000000000000..13e4b92c9ce2e0a3698d31fcfc2b82704653f7a0 GIT binary patch literal 579 zcmV-J0=)f+P)AcnU72+nI~k7O&wbPhKp(25S7yLez;ORgKES18>^qZMxkS#t4;4mP!Tkxe+YuKR~p# z$@oMS%NT}+&HxFcfQVpOE|z7b`l*-e*o5sSUdH9q`!{4z zY}=+hGKO=k6tl2Go9vMSK*{xkcH6fG93;^_SAQs`< z{(cHnFI|}=th_KaaqN?Qc zCjh-}k1uO$6!RW|XLIq=Wef@DrfbBaWOD(c3Aube1@!k|XJ_aB{QRpKpjs>h)nXxF zV!T4J5a9bh)6?g%EknKjAqAw@>R4{yeRvJ19-WzA_asS(wl*I>ee~caz)y}P@RPTh R<>vqZ002ovPDHLkV1h?{2Q~lz literal 0 HcmV?d00001 From a0de33912ef1274bde7f751a465dfc22795b0c2e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 18:54:38 +0200 Subject: [PATCH 052/184] Closes #2545 Bug: Missing object_margin.png in Amarok theme Conflicts: ChangeLog --- ChangeLog | 4 ++++ htdocs/theme/amarok/img/object_margin.png | Bin 0 -> 579 bytes 2 files changed, 4 insertions(+) create mode 100644 htdocs/theme/amarok/img/object_margin.png diff --git a/ChangeLog b/ChangeLog index 6ed93c77235..6617e8af742 100644 --- a/ChangeLog +++ b/ChangeLog @@ -243,6 +243,10 @@ Dolibarr better: - Fix: Bad SEPA xml file creation - Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment - Fix: Showing system error if not enough stock of product into orders creation with lines +- Fix: [ bug #2543 ] Untranslated "Contract" origin string when creating an invoice from a contract +- Fix: [ bug #2534 ] SQL error when editing a supplier invoice line +- Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project +- Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/theme/amarok/img/object_margin.png b/htdocs/theme/amarok/img/object_margin.png new file mode 100644 index 0000000000000000000000000000000000000000..13e4b92c9ce2e0a3698d31fcfc2b82704653f7a0 GIT binary patch literal 579 zcmV-J0=)f+P)AcnU72+nI~k7O&wbPhKp(25S7yLez;ORgKES18>^qZMxkS#t4;4mP!Tkxe+YuKR~p# z$@oMS%NT}+&HxFcfQVpOE|z7b`l*-e*o5sSUdH9q`!{4z zY}=+hGKO=k6tl2Go9vMSK*{xkcH6fG93;^_SAQs`< z{(cHnFI|}=th_KaaqN?Qc zCjh-}k1uO$6!RW|XLIq=Wef@DrfbBaWOD(c3Aube1@!k|XJ_aB{QRpKpjs>h)nXxF zV!T4J5a9bh)6?g%EknKjAqAw@>R4{yeRvJ19-WzA_asS(wl*I>ee~caz)y}P@RPTh R<>vqZ002ovPDHLkV1h?{2Q~lz literal 0 HcmV?d00001 From 35a6ed90a04ff841aad672e47b8bd303cecedbbd Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:02:12 +0200 Subject: [PATCH 053/184] Solves #2542 Bug: Contracts store localtax preferences --- ChangeLog | 1 + htdocs/compta/facture.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc57dfce49b..a69eab23790 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme +- Fix: [ bug #2542 ] Contracts store localtax preferences ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d5c11cf5b63..4a2b13b0069 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry @@ -991,8 +991,12 @@ if (empty($reshook)) { $lines [$i]->fetch_optionals($lines [$i]->rowid); $array_option = $lines [$i]->array_options; } + + // View third's localtaxes for now + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); - $result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $lines [$i]->localtax1_tx, $lines [$i]->localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $date_start, $date_end, 0, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $object->origin, $lines [$i]->rowid, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines [$i]->subprice, $lines [$i]->qty, $lines [$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines [$i]->fk_product, $lines [$i]->remise_percent, $date_start, $date_end, 0, $lines [$i]->info_bits, $lines [$i]->fk_remise_except, 'HT', 0, $product_type, $lines [$i]->rang, $lines [$i]->special_code, $object->origin, $lines [$i]->rowid, $fk_parent_line, $lines [$i]->fk_fournprice, $lines [$i]->pa_ht, $label, $array_option); if ($result > 0) { $lineid = $result; From 1ab70a70869575a9aa5a874ce46c781b0c353dfb Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:05:56 +0200 Subject: [PATCH 054/184] Solves #2542 Bug: Contracts store localtax preferences Conflicts: htdocs/compta/facture.php --- ChangeLog | 1 + htdocs/compta/facture.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22a6f55fda4..619cae68ef4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -213,6 +213,7 @@ Dolibarr better: - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme +- Fix: [ bug #2542 ] Contracts store localtax preferences ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 87cbbec398b..903844ece09 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry @@ -1045,8 +1045,12 @@ if (empty($reshook)) $lines[$i]->fetch_optionals($lines[$i]->rowid); $array_option = $lines[$i]->array_options; } + + // View third's localtaxes for now + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); if ($result > 0) { $lineid = $result; From c2bc2c9ea64701563a22e582e18bafba3ec3aafc Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:10:27 +0200 Subject: [PATCH 055/184] Solves #2542 Bug: Contracts store localtax preferences Conflicts: htdocs/compta/facture.php --- ChangeLog | 1 + htdocs/compta/facture.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6617e8af742..51fed6df120 100644 --- a/ChangeLog +++ b/ChangeLog @@ -247,6 +247,7 @@ Dolibarr better: - Fix: [ bug #2534 ] SQL error when editing a supplier invoice line - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme +- Fix: [ bug #2542 ] Contracts store localtax preferences ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e8f3bde2fd9..75f829be46e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2015 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012-2013 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud @@ -1076,8 +1076,12 @@ if (empty($reshook)) $lines[$i]->fetch_optionals($lines[$i]->rowid); $array_options = $lines[$i]->array_options; } + + // View third's localtaxes for now + $localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->client); + $localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->client); - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id); + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id); if ($result > 0) { $lineid = $result; From 9d8cb459f1c935ee82ee315da5f505ed0e3ad23c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:28:45 +0200 Subject: [PATCH 056/184] Fix: Bad permission assignments for stock movements actions --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/product/stock/mouvement.php | 3 ++- htdocs/product/stock/product.php | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a69eab23790..a55e95630d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,7 @@ English Dolibarr ChangeLog - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences +- Fix: Bad permission assignments for stock movements actions ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index cf05e461e35..89c37098f2a 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -102,8 +102,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b42fc258c6d..273ea7f6336 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2013 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -1000,8 +1000,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1498b12a033..8794b00137d 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2013 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 @@ -387,7 +388,7 @@ if ($resql) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 400c3c1f006..0241c0d4dcf 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014 Cédric Gross * * This program is free software; you can redistribute it and/or modify @@ -543,7 +543,7 @@ if (empty($action) && $product->id) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } From d7ba9b3312ae22df2b7f0b4fbabdf38e3d948714 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:40:48 +0200 Subject: [PATCH 057/184] Fix: Bad permission assignments for stock movements actions Conflicts: htdocs/core/menus/standard/eldy.lib.php htdocs/product/stock/mouvement.php --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/product/stock/mouvement.php | 3 ++- htdocs/product/stock/product.php | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 619cae68ef4..61ef5f890d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -214,6 +214,7 @@ Dolibarr better: - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences +- Fix: Bad permission assignments for stock movements actions ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index e550a20ad5f..a020f607acc 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -103,8 +103,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c88c8375a41..6b94b251d50 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2014 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * * This program is free software; you can redistribute it and/or modify @@ -1061,8 +1061,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 83d856ed0cc..177d8c5e0b3 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2014 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 @@ -387,7 +388,7 @@ if ($resql) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 9bc0cd6f9c3..6dad4256aef 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014 Cédric Gross * * This program is free software; you can redistribute it and/or modify @@ -646,7 +646,7 @@ if (empty($action) && $product->id) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } From 1f4a1316910f02bb64f593a533c7d753b1df66aa Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 7 Apr 2015 20:43:27 +0200 Subject: [PATCH 058/184] Fix: Bad permission assignments for stock movements actions Conflicts: htdocs/product/stock/product.php --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 4 ++-- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- htdocs/product/stock/mouvement.php | 3 ++- htdocs/product/stock/product.php | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51fed6df120..618231d8937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -248,6 +248,7 @@ Dolibarr better: - Fix: [ bug #2535 ] Untranslated string in "Linked objects" page of a project - Fix: [ bug #2545 ] Missing object_margin.png in Amarok theme - Fix: [ bug #2542 ] Contracts store localtax preferences +- Fix: Bad permission assignments for stock movements actions ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 37d074b9f16..f1db486bfc0 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -104,8 +104,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 069d672609c..09f4321e668 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1,7 +1,7 @@ * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2012-2014 Juanjo Menent + * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * @@ -1094,8 +1094,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); - if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); + if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 44cf9df493f..9182708ec8d 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -2,6 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2014 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 @@ -400,7 +401,7 @@ if ($resql) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index c6942e8c8e2..b5639228325 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013-2015 Juanjo Menent * Copyright (C) 2014-2015 Cédric Gross * Copyright (C) 2015 Marcos García * @@ -803,7 +803,7 @@ if (empty($action) && $product->id) { print "
\n"; - if ($user->rights->stock->creer) + if ($user->rights->stock->mouvement->creer) { print ''.$langs->trans("StockCorrection").''; } From bc69703888813ed705b301723c26a061e9415e86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 00:07:46 +0200 Subject: [PATCH 059/184] Fix phpcs --- .../filemanagerdol/connectors/php/commands.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 0dc17d7313c..0449635aaac 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -23,9 +23,13 @@ */ /** - * @param string $currentFolder + * GetFolders + * + * @param string $resourceType Resource type + * @param string $currentFolder Current folder + * @return void */ -function GetFolders( $resourceType, $currentFolder ) +function GetFolders($resourceType, $currentFolder) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFolders'); @@ -182,7 +186,13 @@ function CreateFolder( $resourceType, $currentFolder ) // DOL_CHANGE //function FileUpload( $resourceType, $currentFolder, $sCommand ) /** - * @param string $currentFolder + * FileUpload + * + * @param string $resourceType Resource type + * @param string $currentFolder Current folder + * @param string $sCommand Command + * @param string $CKEcallback Callback + * @return null */ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') { From 369d6915b82b86f7d7bc48266e17f4410b04ad37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 00:14:44 +0200 Subject: [PATCH 060/184] Fix: PHPCS --- htdocs/paypal/lib/paypal.lib.php | 67 ++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 76ea5ab4834..5eb4549f0fa 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -415,36 +415,45 @@ function print_paypal_redirect($paymentAmount,$currencyCodeType,$paymentType,$re } -/* - '------------------------------------------------------------------------------------------------------------------------------------------- - ' Purpose: Prepares the parameters for the SetExpressCheckout API Call. - ' Inputs: - ' paymentAmount: Total value of the shopping cart - ' currencyCodeType: Currency code value the PayPal API - ' paymentType: paymentType has to be one of the following values: Sale or Order or Authorization - ' returnURL: the page where buyers return to after they are done with the payment review on PayPal - ' cancelURL: the page where buyers return to when they cancel the payment review on PayPal - ' shipToName: the Ship to name entered on the merchant's site - ' shipToStreet: the Ship to Street entered on the merchant's site - ' shipToCity: the Ship to City entered on the merchant's site - ' shipToState: the Ship to State entered on the merchant's site - ' shipToCountryCode: the Code for Ship to Country entered on the merchant's site - ' shipToZip: the Ship to ZipCode entered on the merchant's site - ' shipToStreet2: the Ship to Street2 entered on the merchant's site - ' phoneNum: the phoneNum entered on the merchant's site - ' email: the buyer email - ' desc: Product description - '-------------------------------------------------------------------------------------------------------------------------------------------- - */ /** - * @param double $paymentAmount - * @param string $currencyCodeType - * @param string $paymentType - * @param string $returnURL - * @param string $cancelURL - * @param string $tag - * @param string $solutionType - * @param string $landingPage + *------------------------------------------------------------------------------------------------------------------------------------------- + * Purpose: Prepares the parameters for the SetExpressCheckout API Call. + * Inputs: + * paymentAmount: Total value of the shopping cart + * currencyCodeType: Currency code value the PayPal API + * paymentType: paymentType has to be one of the following values: Sale or Order or Authorization + * returnURL: the page where buyers return to after they are done with the payment review on PayPal + * cancelURL: the page where buyers return to when they cancel the payment review on PayPal + * shipToName: the Ship to name entered on the merchant's site + * shipToStreet: the Ship to Street entered on the merchant's site + * shipToCity: the Ship to City entered on the merchant's site + * shipToState: the Ship to State entered on the merchant's site + * shipToCountryCode: the Code for Ship to Country entered on the merchant's site + * shipToZip: the Ship to ZipCode entered on the merchant's site + * shipToStreet2: the Ship to Street2 entered on the merchant's site + * phoneNum: the phoneNum entered on the merchant's site + * email: the buyer email + * desc: Product description + * + * @param double $paymentAmount Payment amount + * @param string $currencyCodeType Currency + * @param string $paymentType Payment type + * @param string $returnURL Return Url + * @param string $cancelURL Cancel Url + * @param string $tag Tag + * @param string $solutionType Type + * @param string $landingPage Landing page + * @param string $shipToName Ship to name + * @param string $shipToStreet Ship to street + * @param string $shipToCity Ship to city + * @param string $shipToState Ship to state + * @param string $shipToCountryCode Ship to country code + * @param string $shipToZip Ship to zip + * @param string $shipToStreet2 Ship to street2 + * @param string $phoneNum Phone + * @param string $email Email + * @param string $desc Description + * @return array Array */ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $tag, $solutionType, $landingPage, $shipToName, $shipToStreet, $shipToCity, $shipToState, $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum, $email='', $desc='') { From 856238c8760c5cc306b471172b52d38c7cd3eced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Apr 2015 09:09:11 +0200 Subject: [PATCH 061/184] Accounts "from" & "to" need to have same currency --- htdocs/compta/bank/virement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 5583edbe357..0c2c62c052f 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -79,7 +79,7 @@ if ($action == 'add') $accountto=new Account($db); $accountto->fetch(GETPOST('account_to','int')); - if ($accountto->id != $accountfrom->id) + if (($accountto->id != $accountfrom->id) && ($accountto->currency_code == $accountfrom->currency_code)) { $db->begin(); From 7f62892609edd60c32ca7536c059275cc4a19564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 8 Apr 2015 09:19:41 +0200 Subject: [PATCH 062/184] Display total with currency code --- htdocs/compta/bank/treso.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 91c41aa5e3c..292742315bb 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -329,8 +329,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Solde actuel $var=!$var; print ''; - print ''.$langs->trans("FutureBalance").''; - print ''.price($solde).''; + print ''.$langs->trans("FutureBalance").' ('.$acct->currency_code.')'; + print ''.price($solde, 0, $langs, 0, 0, -1, $acct->currency_code).''; print ''; print ""; From 94087f539f09576e9afdaec1956e2359641366ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 11:50:40 +0200 Subject: [PATCH 063/184] Fix style --- htdocs/fourn/commande/card.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 995c493df51..33b5eaf79e3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -950,40 +950,40 @@ if (empty($reshook)) if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0) continue; - $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); + $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); // Reset fk_parent_line for no child products and special product - if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) { + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines [$i], 'fetch_optionals')) // For avoid conflicts if + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if // trigger used { - $lines [$i]->fetch_optionals($lines [$i]->rowid); - $array_option = $lines [$i]->array_options; + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_option = $lines[$i]->array_options; } - $idprod = $productsupplier->find_min_price_product_fournisseur($lines [$i]->fk_product, $lines [$i]->qty); + $idprod = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty); $res = $productsupplier->fetch($idProductFourn); $result = $object->addline( $desc, - $lines [$i]->subprice, - $lines [$i]->qty, - $lines [$i]->tva_tx, - $lines [$i]->localtax1_tx, - $lines [$i]->localtax2_tx, - $lines [$i]->fk_product, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, $productsupplier->product_fourn_price_id, $productsupplier->ref_fourn, - $lines [$i]->remise_percent, + $lines[$i]->remise_percent, 'HT', 0, - $lines [$i]->product_type, + $lines[$i]->product_type, '', '', null, @@ -996,7 +996,7 @@ if (empty($reshook)) } // Defined the new fk_parent_line - if ($result > 0 && $lines [$i]->product_type == 9) { + if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } From 17fa1ce5b6b5263108d0d91186f83cef1e88ddff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 12:22:52 +0200 Subject: [PATCH 064/184] Fix #2552 --- htdocs/langs/en_US/errors.lang | 2 + htdocs/product/fournisseurs.php | 119 +++++++++++++++++--------------- 2 files changed, 64 insertions(+), 57 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 37670b7f003..6a7da2d3ece 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -167,6 +167,8 @@ ErrorGlobalVariableUpdater2=Missing parameter '%s' ErrorGlobalVariableUpdater3=The requested data was not found in result ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' ErrorGlobalVariableUpdater5=No global variable selected +ErrorFieldMustBeANumeric=Field %s must be a numeric value +ErrorFieldMustBeAnInteger=Field %s must be an integer # Warnings WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index f35e6628ad6..2d0b9a81576 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -43,6 +43,7 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $rowid=GETPOST('rowid','int'); $action=GETPOST('action', 'alpha'); +$cancel=GETPOST('cancel', 'alpha'); $socid=GETPOST('socid', 'int'); $backtopage=GETPOST('backtopage','alpha'); $error=0; @@ -77,6 +78,8 @@ if (! $sortorder) $sortorder="ASC"; * Actions */ +if ($cancel) $action=''; + $parameters=array('socid'=>$socid, 'id_prod'=>$id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -97,59 +100,70 @@ if (empty($reshook)) } } -if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) -{ - $id_fourn=GETPOST("id_fourn"); - if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); - $ref_fourn=GETPOST("ref_fourn"); - if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); - $quantity=GETPOST("qty"); - $remise_percent=price2num(GETPOST('remise_percent','alpha')); - $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; - $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); - $tva_tx = price2num($tva_tx); - $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode - $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; + if ($action == 'updateprice') + { + $id_fourn=GETPOST("id_fourn"); + if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); + $ref_fourn=GETPOST("ref_fourn"); + if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); + $quantity=GETPOST("qty"); + $remise_percent=price2num(GETPOST('remise_percent','alpha')); + $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0 ; + $tva_tx = str_replace('*','', GETPOST('tva_tx','alpha')); + $tva_tx = price2num($tva_tx); + $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode + $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : ''; - if ($tva_tx == '') - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors'); - } - if (empty($quantity)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors'); - } - if (empty($ref_fourn)) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors'); - } - if ($id_fourn <= 0) - { - $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors'); - } - if ($_POST["price"] < 0 || $_POST["price"] == '') - { - if ($price_expression === '') // Return error of missing price only if price_expression not set + if ($tva_tx == '') { $error++; - setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("VATRateForSupplierProduct")), 'errors'); } - else + if (! is_numeric($tva_tx)) { - $_POST["price"] = 0; + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors'); + } + if (empty($quantity)) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")), 'errors'); + } + if (empty($ref_fourn)) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")), 'errors'); + } + if ($id_fourn <= 0) + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Supplier")), 'errors'); + } + if ($_POST["price"] < 0 || $_POST["price"] == '') + { + if ($price_expression === '') // Return error of missing price only if price_expression not set + { + $error++; + $langs->load("errors"); + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Price")), 'errors'); + } + else + { + $_POST["price"] = 0; + } } - } $product = new ProductFournisseur($db); $result=$product->fetch($id); if ($result <= 0) { $error++; - setEventMessage($product->error, 'errors'); + setEventMessages($product->error, $product->errors, 'errors'); } if (! $error) @@ -222,13 +236,10 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel")) $db->rollback(); } } - } - - if (GETPOST('cancel') == $langs->trans("Cancel")) - { - $action = ''; - header("Location: fournisseurs.php?id=".$_GET["id"]); - exit; + else + { + $action = 'add_price'; + } } } @@ -253,10 +264,6 @@ if ($id || $ref) { if ($action <> 'edit' && $action <> 're-edit') { - /* - * En mode visu - */ - $head=product_prepare_head($product); $titre=$langs->trans("CardProduct".$product->type); $picto=($product->type== Product::TYPE_SERVICE?'service':'product'); @@ -325,6 +332,8 @@ if ($id || $ref) print ''; print ''; print ''; + print ''; + print ''; } else { @@ -487,11 +496,7 @@ if ($id || $ref) print ''; } - /* ************************************************************************** */ - /* */ - /* Barre d'action */ - /* */ - /* ************************************************************************** */ + // Actions buttons print "\n
\n"; From 1efa5bcabdd1a6c5eaab13e863afa3db52589c04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 12:44:11 +0200 Subject: [PATCH 065/184] Fix: Avoid duplicate tooltip --- .../fourn/class/fournisseur.product.class.php | 18 +++++++++++------- htdocs/product/list.php | 7 +++++-- htdocs/societe/class/societe.class.php | 2 +- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index adc1f3a50fc..8f839b08452 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -631,17 +631,19 @@ class ProductFournisseur extends Product /** * Display supplier of product * - * @param int $withpicto Add picto - * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @return string String with supplier price + * @param int $withpicto Add picto + * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @return string String with supplier price * TODO Remove this method. Use getNomUrl directly. */ - function getSocNomUrl($withpicto=0,$option='supplier') + function getSocNomUrl($withpicto=0,$option='supplier',$maxlen=0,$notooltip=0) { $thirdparty = new Fournisseur($this->db); $thirdparty->fetch($this->fourn_id); - return $thirdparty->getNomUrl($withpicto,$option); + return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } /** @@ -649,13 +651,15 @@ class ProductFournisseur extends Product * * @param int $showunitprice Show "Unit price" into output string * @param int $showsuptitle Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip * @return string String with supplier price */ - function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1) + function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0) { global $langs; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier').' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index f9503778411..ededdbaff01 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -476,8 +476,11 @@ else { if ($product_fourn->product_fourn_price_id > 0) { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); + print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + } else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7e2bdeef3a6..7f8df5ed810 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1727,7 +1727,7 @@ class Societe extends CommonObject * * @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only) * @param string $option Target of link ('', 'customer', 'prospect', 'supplier') - * @param int $maxlen Max length of text + * @param int $maxlen Max length of name * @param integer $notooltip 1=Disable tooltip * @return string String with URL */ From b3355df3bf7f3215b237bf140372d1abfb34e2f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 13:00:03 +0200 Subject: [PATCH 066/184] Fix delivery delay could not be set to unknown --- htdocs/fourn/class/fournisseur.product.class.php | 14 +++++++------- htdocs/fourn/commande/card.php | 2 +- htdocs/product/fournisseurs.php | 13 +++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 8f839b08452..280ea8cec2e 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -154,7 +154,7 @@ class ProductFournisseur extends Product * @param float $remise_percent Discount regarding qty (percent) * @param float $remise Discount regarding qty (amount) * @param int $newnpr Set NPR or not - * @param int $delivery_time_days Delay in days for delivery (max) + * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined. * @return int <0 if KO, >=0 if OK */ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0) @@ -167,7 +167,7 @@ class ProductFournisseur extends Product if (empty($charges)) $charges=0; if (empty($availability)) $availability=0; if (empty($remise_percent)) $remise_percent=0; - if (empty($delivery_time_days)) $delivery_time_days=0; + if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = ''; if ($price_base_type == 'TTC') { //$ttx = get_default_tva($fourn,$mysoc,$this->id); // We must use the VAT rate defined by user and not calculate it @@ -202,7 +202,7 @@ class ProductFournisseur extends Product $sql.= " entity = ".$conf->entity.","; $sql.= " info_bits = ".$newnpr.","; $sql.= " charges = ".$charges.","; - $sql.= " delivery_time_days = ".$delivery_time_days; + $sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null'); $sql.= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -437,16 +437,16 @@ class ProductFournisseur extends Product $prodfourn->fourn_remise_percent = $record["remise_percent"]; $prodfourn->fourn_remise = $record["remise"]; $prodfourn->fourn_unitprice = $record["unitprice"]; - $prodfourn->fourn_charges = $record["charges"]; - $prodfourn->fourn_unitcharges = $record["unitcharges"]; + $prodfourn->fourn_charges = $record["charges"]; + $prodfourn->fourn_unitcharges = $record["unitcharges"]; $prodfourn->fourn_tva_tx = $record["tva_tx"]; $prodfourn->fourn_id = $record["fourn_id"]; $prodfourn->fourn_name = $record["supplier_name"]; $prodfourn->fk_availability = $record["fk_availability"]; $prodfourn->delivery_time_days = $record["delivery_time_days"]; $prodfourn->id = $prodid; - $prodfourn->fourn_tva_npr = $record["info_bits"]; - $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; + $prodfourn->fourn_tva_npr = $record["info_bits"]; + $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; if (!empty($prodfourn->fk_supplier_price_expression)) { $priceparser = new PriceParser($this->db); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 33b5eaf79e3..b1d20b72371 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1911,7 +1911,7 @@ elseif (! empty($object->id)) print ''; - // Delai livraison jours + // Delivery delay (in days) print ''; print ''.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').''; print ''.$object->getMaxDeliveryTimeDay($langs).''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2d0b9a81576..9d7a9215ef1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -201,7 +201,7 @@ if (empty($reshook)) { $error++; - setEventMessage($product->error, 'errors'); + setEventMessage($product->error, $product->errors, 'errors'); } else { @@ -528,13 +528,9 @@ if ($id || $ref) print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); print ''.$langs->trans("VATRate").''; print ''.$langs->trans("PriceQtyMinHT").''; - // Charges ???? - if ($conf->global->PRODUCT_CHARGES) - { - if (! empty($conf->margin->enabled)) print ''.$langs->trans("Charges").''; - } print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); print ''.$langs->trans("DiscountQtyMin").''; + print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); // Charges ???? if ($conf->global->PRODUCT_CHARGES) { @@ -606,6 +602,11 @@ if ($id || $ref) print price2num($productfourn->fourn_remise_percent).'%'; print ''; + // Delivery delay + print ''; + print $productfourn->delivery_time_days; + print ''; + // Charges ???? if ($conf->global->PRODUCT_CHARGES) { From fc803e70008a6cc7a59655a05ea5310e85f99997 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 17:33:38 +0200 Subject: [PATCH 067/184] Fix permission lost when enabled/disabled module. --- htdocs/admin/supplier_order.php | 46 +++++++------------- htdocs/core/modules/modFournisseur.class.php | 20 +++++++++ htdocs/fourn/commande/card.php | 2 +- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 5a3c3808201..b7c7d3b5c3d 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -182,43 +182,27 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') $res3=1; }*/ - // TODO We add/delete permission until permission can have a condition on a global var - $r_id = 1190; - $entity = $conf->entity; - $r_desc=$langs->trans("Permission1190"); - $r_modul='fournisseur'; - $r_type='w'; - $r_perms='commande'; - $r_subperms='approve2'; - $r_def=0; + // TODO We add/delete permission here until permission can have a condition on a global var + include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; + $newmodule=new modFournisseur($db); + // clear default rights array + $newmodule->rights=array(); + // add new right + $r=0; + $newmodule->rights[$r][0] = 1190; + $newmodule->rights[$r][1] = $langs->trans("Permission1190"); + $newmodule->rights[$r][2] = 'w'; + $newmodule->rights[$r][3] = 0; + $newmodule->rights[$r][4] = 'commande'; + $newmodule->rights[$r][5] = 'approve2'; if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; - $sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)"; - $sql.= " VALUES "; - $sql.= "(".$r_id.",".$entity.",'".$db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')"; - - $resqlinsert=$db->query($sql,1); - if (! $resqlinsert) - { - if ($db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS") - { - setEventMessage($db->lasterror(),'errors'); - $error++; - } - } + $newmodule->insert_permissions(1); } else { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def"; - $sql.= " WHERE id = ".$r_id; - $resqldelete=$db->query($sql,1); - if (! $resqldelete) - { - setEventMessage($db->lasterror(),'errors'); - $error++; - } + $newmodule->delete_permissions(); } } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 2e42c1f8b66..dc537426179 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -161,6 +161,14 @@ class modFournisseur extends DolibarrModules $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'approuver'; + /*$r++; + $this->rights[$r][0] = 1191; + $this->rights[$r][1] = 'Approuver une commande fournisseur (si supérieur hiérarchique)'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'commande'; + $this->rights[$r][5] = 'approve_ifsupervisor_advance';*/ + $r++; $this->rights[$r][0] = 1186; $this->rights[$r][1] = 'Commander une commande fournisseur'; @@ -250,6 +258,18 @@ class modFournisseur extends DolibarrModules $this->rights[$r][4] = 'commande'; $this->rights[$r][5] = 'export'; + if ($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL) + { + $r++; + $this->rights[$r][0] = 1190; + $this->rights[$r][1] = 'Approve supplier order (second level)'; // $langs->trans("Permission1190"); + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'commande'; + $this->rights[$r][5] = 'approve2'; + } + + // Exports //-------- $r=0; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b1d20b72371..e2f7fb0ca03 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -190,7 +190,7 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) + if ($action == 'reopen') // no test on permission here, permission to use will depends on status { if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) { From 0987aa1c747228184c17261592834329ca7c4e9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 17:42:28 +0200 Subject: [PATCH 068/184] Bad trans key --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 09f4321e668..748f7111e54 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -695,7 +695,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ((empty($leftmenu) || $leftmenu=="orders_suppliers") && empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartially"), 2, $user->rights->fournisseur->commande->lire); + if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusOrderRefused"), 2, $user->rights->fournisseur->commande->lire); From 742b50b532e131fc0e10db473152479b7765a56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 8 Apr 2015 17:58:40 +0200 Subject: [PATCH 069/184] [Contributing] Added a link to the forum --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e779b97463..a603fd242cc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,10 @@ How to contribute to Dolibarr Bug reports and feature requests -------------------------------- -** NEW ** + +*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). + +**NEW** Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). From 1bbecc0912976a1f7306a4bb8940e5e772b2d7c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 19:26:36 +0200 Subject: [PATCH 070/184] Restore link to stock for products. --- htdocs/comm/card.php | 2 +- htdocs/core/lib/product.lib.php | 2 +- htdocs/fourn/card.php | 6 +++--- htdocs/langs/en_US/orders.lang | 4 +++- htdocs/product/class/product.class.php | 2 +- htdocs/product/stock/product.php | 13 +++++++------ 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 14bf6e42fe8..beaa179cb60 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -627,7 +627,7 @@ if ($id > 0) print ''; print ''; - print '
'; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''; print ''; //if($num2 > 0) print ''; //else print ''; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a35ab95a24a..87e22ac8cc9 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -93,7 +93,7 @@ function product_prepare_head($object) $head[$h][2] = 'referers'; $h++; - if($object->isproduct()) // Si produit stockable + if ($object->isproduct() || ($object->isservice() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option) { if (! empty($conf->stock->enabled) && $user->rights->stock->lire) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 97004783ae6..3794fa1e184 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -364,7 +364,7 @@ if ($object->id > 0) /* - * Last orders + * Last supplier orders */ $orderstatic = new CommandeFournisseur($db); @@ -409,7 +409,7 @@ if ($object->id > 0) print ''; print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; - print ''; + print '
'.$langs->trans("LastOrders",($num<$MAXLIST?"":$MAXLIST)).'
'; print ''; print ''; print '
'.$langs->trans("LastSupplierOrders",($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; @@ -455,7 +455,7 @@ if ($object->id > 0) } /* - * Last invoices + * Last supplier invoices */ $MAXLIST=5; diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 278fb39f0ee..088e239d955 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -79,7 +79,9 @@ NoOpenedOrders=No opened orders NoOtherOpenedOrders=No other opened orders NoDraftOrders=No draft orders OtherOrders=Other orders -LastOrders=Last %s orders +LastOrders=Last %s customer orders +LastCustomerOrders=Last %s customer orders +LastSupplierOrders=Last %s supplier orders LastModifiedOrders=Last %s modified orders LastClosedOrders=Last %s closed orders AllOrders=All orders diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 397f06ce156..c3f8cf5994d 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3689,7 +3689,7 @@ class Product extends CommonObject */ function isproduct() { - return ($this->type != Product::TYPE_PRODUCT ? true : false); + return ($this->type == Product::TYPE_PRODUCT ? true : false); } /** diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index b5639228325..39a81abe86d 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -821,8 +821,9 @@ if (empty($action) && $product->id) /* - * Stock detail + * Stock detail (by warehouse). Do not go down into batch. */ + print '
'; print ''; print ''; @@ -870,9 +871,9 @@ if ($resql) print ''; print ''; // PMP - print ''; // Ditto : Show PMP from movement or from product + print ''; // Value purchase - print ''; // Ditto : Show PMP from movement or from product + print ''; // Sell price print ''; // Value sell print ''; // Ditto : Show PMP from movement or from product + if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).''; else print $langs->trans("Variable"); print ''; ; $total += $obj->reel; if (price2num($product->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + ($product->pmp*$obj->reel); // Ditto : Show PMP from movement or from product - $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); // Ditto : Show PMP from movement or from product + $totalvalue = $totalvalue + ($product->pmp*$obj->reel); + $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); //Batch Detail if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) { From aaef3a41c015667ff58d4e3cd6d39dcc4b159467 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 19:33:06 +0200 Subject: [PATCH 071/184] Short label into table --- htdocs/langs/en_US/productbatch.lang | 1 + htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/stock/mouvement.php | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 45263681965..8508a26e96d 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -7,6 +7,7 @@ ProductStatusNotOnBatchShort=No Batch=Batch/Serial atleast1batchfield=Eat-by date or Sell-by date or Batch number batch_number=Batch/Serial number +BatchNumberShort=Batch/Serial l_eatby=Eat-by date l_sellby=Sell-by date DetailBatchNumber=Batch/Serial details diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 9019240490b..998168decdd 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -132,3 +132,4 @@ ShowWarehouse=Show warehouse MovementCorrectStock=Stock content correction for product %s MovementTransferStock=Stock transfer of product %s into another warehouse WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when batch module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps. +InventoryCodeShort=Inv./Mov. code \ No newline at end of file diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 9182708ec8d..913be813815 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -440,13 +440,13 @@ if ($resql) if (! empty($conf->productbatch->enabled)) { $langs->load("productbatch"); - print ''; + print ''; print ''; print ''; } print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("InventoryCode"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("InventoryCodeShort"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Units"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); From 091420f8aefb3b1eaa9bb3712a4a0ccec7945b84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 20:40:01 +0200 Subject: [PATCH 072/184] Close #2568 --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 1b69fd5757e..eafe92c5aa4 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -412,7 +412,7 @@ else } print '
'.$langs->trans("Warehouse").''.$langs->trans("NumberOfUnit").''.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''; if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); @@ -880,13 +881,13 @@ if ($resql) print ''; - if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'
'.$langs->trans("batch_number").''.$langs->trans("BatchNumberShort").''.$langs->trans("l_eatby").''.$langs->trans("l_sellby").'
'; - print ''; + print ''; // print ''; print ''; print ''; From e3bbbaf2e147a1da6e40f9a1fc44feec7b63e9a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 20:52:18 +0200 Subject: [PATCH 073/184] Comments --- htdocs/install/mysql/tables/llx_facture_rec.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index cba4b580cf0..7c1151f36ca 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -50,9 +50,9 @@ create table llx_facture_rec note_private text, note_public text, - usenewprice integer DEFAULT 0, - frequency integer, - unit_frequency varchar(2) DEFAULT 'd', + usenewprice integer DEFAULT 0, -- update invoice with current price of product instead of recorded price + frequency integer, -- frequency (for example: 3 for every 3 month) + unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ... date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date) date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice) From c4daca2bac72f4908333219e61c9a3078b86f916 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:34:04 +0200 Subject: [PATCH 074/184] Fix #1682 --- htdocs/core/class/commonobject.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ac87f1e693d..db4c1fc5a03 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1887,10 +1887,11 @@ abstract class CommonObject * @param int $targetid Object target id * @param string $targettype Object target type * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided + * @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type. * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR',$alsosametype=1) { global $conf; @@ -1924,7 +1925,7 @@ abstract class CommonObject return -1; } - // Links beetween objects are stored in this table + // Links between objects are stored in table element_element $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_element'; $sql.= " WHERE "; @@ -1983,7 +1984,7 @@ abstract class CommonObject $classpath = $element.'/class'; - // To work with non standard path + // To work with non standard classpath or module name if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } @@ -2019,7 +2020,7 @@ abstract class CommonObject $classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur'; } - if ($conf->$module->enabled && $element != $this->element) + if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); From ddde869ca498db71acaaa8e1cd8d977a5e78ed50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:35:27 +0200 Subject: [PATCH 075/184] Sync transifex --- htdocs/langs/fr_FR/admin.lang | 2 +- htdocs/langs/fr_FR/bills.lang | 6 +++--- htdocs/langs/fr_FR/categories.lang | 14 +++++++------- htdocs/langs/fr_FR/cron.lang | 2 +- htdocs/langs/fr_FR/donations.lang | 10 +++++----- htdocs/langs/fr_FR/errors.lang | 16 ++++++++-------- htdocs/langs/fr_FR/main.lang | 10 +++++----- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 4dea57677d3..dedbc1d5f50 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1606,7 +1606,7 @@ SalariesSetup=Configuration du module salariés SortOrder=Ordre de tri Format=Format TypePaymentDesc=0:Type de paiement client, 1:Type de paiement fournisseur, 2:Paiement de type client et fournisseur -IncludePath=Chemin Include (définir dans la variable %s) +IncludePath=Chemin Include (défini dans la variable %s) ExpenseReportsSetup=Configuration du module Notes de frais TemplatePDFExpenseReports=Modèles de documents pour générer les document de Notes de frais NoModueToManageStockDecrease=Aucun module capable d'assurer la réduction de stock en automatique a été activé. La réduction de stock se fera donc uniquement sur mise à jour manuelle. diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 9e79b16af11..a6a4c1a85a4 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -190,7 +190,7 @@ AlreadyPaid=Déjà réglé AlreadyPaidBack=Déjà remboursé AlreadyPaidNoCreditNotesNoDeposits=Déjà réglé (hors avoirs et acomptes) Abandoned=Abandonné -RemainderToPay=Restant impayé +RemainderToPay=Reste à payer RemainderToTake=Montant restant à percevoir RemainderToPayBack=Montant à rembourser Rest=Créance @@ -294,8 +294,8 @@ TotalOfTwoDiscountMustEqualsOriginal=La somme du montant des 2 nouvelles réduct ConfirmRemoveDiscount=Êtes-vous sûr de vouloir supprimer cette réduction ? RelatedBill=Facture associée RelatedBills=Factures associées -RelatedCustomerInvoices=Related customer invoices -RelatedSupplierInvoices=Related supplier invoices +RelatedCustomerInvoices=Factures clients liées +RelatedSupplierInvoices=Factures fournisseurs liées LatestRelatedBill=Dernière facture en rapport WarningBillExist=Attention, une ou plusieurs factures existent déjà diff --git a/htdocs/langs/fr_FR/categories.lang b/htdocs/langs/fr_FR/categories.lang index 5a6ac7abc31..c310342feff 100644 --- a/htdocs/langs/fr_FR/categories.lang +++ b/htdocs/langs/fr_FR/categories.lang @@ -1,9 +1,9 @@ # Dolibarr language file - Source file is en_US - categories -Rubrique=Tag/Category -Rubriques=Tags/Categories -categories=tags/categories -TheCategorie=The tag/category -NoCategoryYet=No tag/category of this type created +Rubrique=Label/Catégorie +Rubriques=Labels/Catégories +categories=labels/catégories +TheCategorie=Le label/Catégorie +NoCategoryYet=Aucun label/catégorie de ce type n'a été créé In=Dans AddIn=Ajouter dans modify=modifier @@ -18,8 +18,8 @@ ContactsCategoriesArea=Contacts tags/categories area MainCats=Main tags/categories SubCats=Sous-catégories CatStatistics=Statistiques -CatList=List of tags/categories -AllCats=All tags/categories +CatList=Liste des labels/catégories +AllCats=Tous les labels/catégories ViewCat=View tag/category NewCat=Add tag/category NewCategory=New tag/category diff --git a/htdocs/langs/fr_FR/cron.lang b/htdocs/langs/fr_FR/cron.lang index 7c67426510d..b009c0b54d6 100644 --- a/htdocs/langs/fr_FR/cron.lang +++ b/htdocs/langs/fr_FR/cron.lang @@ -18,7 +18,7 @@ CronExplainHowToRunUnix=Sur un environnement Unix vous pouvez utiliser l'entrée CronExplainHowToRunWin=Sur un environement Microsoft(tm) Windows vous pouvez utiliser le planificateur de tache pour lancer cette commande toute les 5 minutes. # Menu CronJobs=Travaux programmés -CronListActive=Liste des travaux actifs/programmés +CronListActive=Liste des travaux CronListInactive=Liste des travaux inactifs # Page list CronDateLastRun=Dernier lancement diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index a2625c9c0fa..3dbb4cc5f76 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -6,8 +6,8 @@ Donor=Donateur Donors=Donateurs AddDonation=Créer un don NewDonation=Nouveau don -DeleteADonation=Delete a donation -ConfirmDeleteADonation=Are you sure you want to delete this donation ? +DeleteADonation=Effacer le don +ConfirmDeleteADonation=Êtes-vous sûr de vouloir supprimer ce don ? ShowDonation=Montrer don DonationPromise=Promesse de don PromisesNotValid=Promesses non validées @@ -23,8 +23,8 @@ DonationStatusPaid=Don payé DonationStatusPromiseNotValidatedShort=Non validée DonationStatusPromiseValidatedShort=Validée DonationStatusPaidShort=Payé -DonationTitle=Donation receipt -DonationDatePayment=Payment date +DonationTitle=Reçu de dons +DonationDatePayment=Date paiement ValidPromess=Valider promesse DonationReceipt=Reçu de dons BuildDonationReceipt=Créer reçu @@ -40,4 +40,4 @@ FrenchOptions=Options propres à la france DONATION_ART200=Afficher article 200 du CGI si vous êtes concernés DONATION_ART238=Afficher article 238 du CGI si vous êtes concernés DONATION_ART885=Afficher article 885 du CGI si vous êtes concernés -DonationPayment=Donation payment +DonationPayment=Paiement du don diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index d784017964d..dd92729aa4d 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -25,7 +25,7 @@ ErrorFromToAccountsMustDiffers=Les comptes source et destination doivent être d ErrorBadThirdPartyName=Nom de tiers incorrect ErrorProdIdIsMandatory=Le %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte -ErrorBadBarCodeSyntax=Bad syntax for bar code. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned. +ErrorBadBarCodeSyntax=Mauvaise syntaxe pour le code barre. Peut être que vous avez défini un mauvais type de code-barres ou que vous avez défini un masque de code à barres pour la numérotation qui ne correspond pas à la valeur scannée. ErrorCustomerCodeRequired=Code client obligatoire ErrorBarCodeRequired=Code-barre requis ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé @@ -160,13 +160,13 @@ ErrorPriceExpressionInternal=Erreur interne '%s' ErrorPriceExpressionUnknown=Erreur inconnue '%s' ErrorSrcAndTargetWarehouseMustDiffers=Les entrepôts source et destination doivent être différents ErrorTryToMakeMoveOnProductRequiringBatchData=Erreur, vous essayez de faire un mouvement sans lot/numéro de série, sur un produit qui exige un lot/numéro de série. -ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action -ErrorGlobalVariableUpdater0=HTTP request failed with error '%s' -ErrorGlobalVariableUpdater1=Invalid JSON format '%s' -ErrorGlobalVariableUpdater2=Missing parameter '%s' -ErrorGlobalVariableUpdater3=The requested data was not found in result -ErrorGlobalVariableUpdater4=SOAP client failed with error '%s' -ErrorGlobalVariableUpdater5=No global variable selected +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=Toutes les réceptions enregistrées doivent d'abord être vérifiées avant d'être autorisés à faire cette action +ErrorGlobalVariableUpdater0=La requête HTTP a échoué avec l'erreur '%s' +ErrorGlobalVariableUpdater1=Format JSON invalide '%s' +ErrorGlobalVariableUpdater2=Paramètre manquant '%s' +ErrorGlobalVariableUpdater3=La donnée recherché n'a pas été trouvée +ErrorGlobalVariableUpdater4=Le client SOAP a échoué avec l'erreur '%s' +ErrorGlobalVariableUpdater5=Pas de variable globale # Warnings WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 97aa65f021e..94676450fbc 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -141,7 +141,7 @@ Cancel=Annuler Modify=Modifier Edit=Éditer Validate=Valider -ValidateAndApprove=Validate and Approve +ValidateAndApprove=Valider et Approuver ToValidate=À valider Save=Enregistrer SaveAs=Enregistrer sous @@ -159,7 +159,7 @@ Search=Rechercher SearchOf=Recherche de Valid=Valider Approve=Approuver -Disapprove=Disapprove +Disapprove=Désapprouver ReOpen=Réouvrir Upload=Envoyer fichier ToLink=Lier @@ -221,7 +221,7 @@ Cards=Fiches Card=Fiche Now=Maintenant Date=Date -DateAndHour=Date and hour +DateAndHour=Date et heure DateStart=Date début DateEnd=Date fin DateCreation=Date création @@ -395,8 +395,8 @@ Available=Disponible NotYetAvailable=Pas encore disponible NotAvailable=Non disponible Popularity=Popularité -Categories=Tags/categories -Category=Tag/category +Categories=Tags/catégories +Category=Tag/catégorie By=Par From=Du to=au From f6c2472d92d8420c90ce10870534b1659daf5ceb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Apr 2015 21:50:17 +0200 Subject: [PATCH 076/184] fix var not declared --- htdocs/core/class/events.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 4ab3ce8f6fe..f94252d076d 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -31,7 +31,6 @@ /** * Events class - * Initialy built by build_class_from_table on 2008-02-28 17:25 */ class Events // extends CommonObject { @@ -41,6 +40,8 @@ class Events // extends CommonObject var $id; var $db; + var $error; + var $tms; var $type; var $entity; From 914b324a674b014aace9f7e802a7346422450340 Mon Sep 17 00:00:00 2001 From: braito4 Date: Thu, 9 Apr 2015 10:37:54 +0200 Subject: [PATCH 077/184] minor bug drag and drop total line in tasks list --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a564a312ac2..20b7bb1ec83 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -416,7 +416,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0) { - print ''; + print ''; print ''; if ($showproject) print ''; print ''; From ed6f2e93869ea618a203fe116d4334176f487a54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 15:14:50 +0200 Subject: [PATCH 078/184] Fix error management --- .../class/fournisseur.commande.class.php | 12 +++++-- htdocs/fourn/commande/dispatch.php | 33 +++++++++++++++---- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 22ac415b511..732a381694d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1392,13 +1392,19 @@ class CommandeFournisseur extends CommonOrder function dispatchProduct($user, $product, $qty, $entrepot, $price=0, $comment='', $eatby='', $sellby='', $batch='', $fk_commandefourndet=0, $notrigger=0) { global $conf; + $error = 0; require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php'; - // Check parameters - if ($entrepot <= 0 || $qty <= 0) + // Check parameters (if test are wrong here, there is bug into caller) + if ($entrepot <= 0) { - $this->error='BadValueForParameterWarehouseOrQty'; + $this->error='ErrorBadValueForParameterWarehouse'; + return -1; + } + if ($qty <= 0) + { + $this->error='ErrorBadValueForParameterQty'; return -1; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 84b03f1953a..1da5f5eb29a 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -101,6 +101,23 @@ if ($action == 'uncheckdispatchline' && } } +if ($action == 'denydispatchline' && + ! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) +) +{ + $supplierorderdispatch = new CommandeFournisseurDispatch($db); + $result=$supplierorderdispatch->fetch($lineid); + if (! $result) dol_print_error($db); + $result=$supplierorderdispatch->setStatut(-1); + if ($result < 0) + { + setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); + $error++; + $action=''; + } +} + if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) { $commande = new CommandeFournisseur($db); @@ -123,7 +140,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (GETPOST($qty) > 0) // We ask to move a qty { - if (! GETPOST($ent,'int') > 0) + if (! (GETPOST($ent,'int') > 0)) { dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').' ' .($numline); @@ -133,7 +150,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (! $error) { - $result = $commande->DispatchProduct($user, GETPOST($prod,'int'),GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); + $result = $commande->DispatchProduct($user, GETPOST($prod,'int'), GETPOST($qty), GETPOST($ent,'int'), GETPOST($pu), GETPOST("comment"), '', '', '', GETPOST($fk_commandefourndet, 'int'), $notrigger); if ($result < 0) { setEventMessages($commande->error, $commande->errors, 'errors'); @@ -643,11 +660,13 @@ if ($id > 0 || ! empty($ref)) { if (empty($objp->status)) { - print ''.$langs->trans("Check").''; + print ''.$langs->trans("Approve").''; + print ''.$langs->trans("Deny").''; } else { - print ''.$langs->trans("Uncheck").''; + print ''.$langs->trans("Disapprove").''; + print ''.$langs->trans("Deny").''; } } else @@ -656,11 +675,13 @@ if ($id > 0 || ! empty($ref)) if ($commande->statut == 5) $disabled=1; if (empty($objp->status)) { - print 'dispatchlineid.'">'.$langs->trans("Check").''; + print 'dispatchlineid.'">'.$langs->trans("Approve").''; + print 'dispatchlineid.'">'.$langs->trans("Deny").''; } else { - print 'dispatchlineid.'">'.$langs->trans("Uncheck").''; + print 'dispatchlineid.'">'.$langs->trans("Disapprove").''; + print 'dispatchlineid.'">'.$langs->trans("Deny").''; } } print ''; From e01e0faeef86d46ce0801228f1fef45cfefee556 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 16:15:52 +0200 Subject: [PATCH 079/184] Can reopen to edit supplier order once ordered --- .../class/fournisseur.commande.class.php | 39 ++++++++++++++----- .../fournisseur.commande.dispatch.class.php | 3 ++ htdocs/fourn/commande/card.php | 5 ++- htdocs/fourn/commande/dispatch.php | 11 ++++-- htdocs/langs/en_US/errors.lang | 3 +- htdocs/langs/en_US/main.lang | 1 + 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 732a381694d..7f091749660 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1747,18 +1747,37 @@ class CommandeFournisseur extends CommonOrder if ($type == 'nev') $statut = 7; if ($type == 'can') $statut = 7; - if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && ($type == 'tot')) - { - // If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done" - $dispatchedlinearray=$this->getDispachedLines(0); - if (count($dispatchedlinearray) > 0) + // Some checks to accept the record + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) + { + // If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done" + if (! $error && ($type == 'tot')) + { + $dispatchedlinearray=$this->getDispachedLines(0); + if (count($dispatchedlinearray) > 0) + { + $result=-1; + $error++; + $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove'; + dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG); + } + + } + if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS_NEED_APPROVE) && ($type == 'tot')) // Accept to move to rception done, only if status of all line are ok (refuse denied) { - $result=-1; - $error++; - $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove'; - dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG); + $dispatcheddenied=$this->getDispachedLines(2); + if (count($dispatchedlinearray) > 0) + { + $result=-1; + $error++; + $this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionDenied'; + dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionDenied', LOG_DEBUG); + } } - } + } + + // TODO LDR01 Add option to accept only if ALL predefined products are received (same qty). + if (! $error && ! ($statut == 4 or $statut == 5 or $statut == 7)) { diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index e7aea53945e..4d6f75444b8 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -495,16 +495,19 @@ class CommandeFournisseurDispatch extends CommonObject { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4'); + if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } if ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); + if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); } if ($mode == 5) { if ($statut==0) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut==1) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut4'); + if ($statut==2) return ''.$langs->trans($this->statutshort[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut8'); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index e2f7fb0ca03..755dd1249ea 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -192,10 +192,11 @@ if (empty($reshook)) if ($action == 'reopen') // no test on permission here, permission to use will depends on status { - if (in_array($object->statut, array(1, 2, 5, 6, 7, 9))) + if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9))) { if ($object->statut == 1) $newstatus=0; // Validated->Draft else if ($object->statut == 2) $newstatus=0; // Approved->Draft + else if ($object->statut == 3) $newstatus=2; // Ordered->Approved else if ($object->statut == 5) $newstatus=4; // Received->Received partially else if ($object->statut == 6) $newstatus=2; // Canceled->Approved else if ($object->statut == 7) $newstatus=3; // Canceled->Process running @@ -2671,7 +2672,7 @@ elseif (! empty($object->id)) print ''.$langs->trans("Disapprove").''; } } - if (in_array($object->statut, array(5, 6, 7, 9))) + if (in_array($object->statut, array(3, 5, 6, 7, 9))) { if ($user->rights->fournisseur->commande->commander) { diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 1da5f5eb29a..bac6ace77e3 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -109,7 +109,7 @@ if ($action == 'denydispatchline' && $supplierorderdispatch = new CommandeFournisseurDispatch($db); $result=$supplierorderdispatch->fetch($lineid); if (! $result) dol_print_error($db); - $result=$supplierorderdispatch->setStatut(-1); + $result=$supplierorderdispatch->setStatut(2); if ($result < 0) { setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors'); @@ -678,11 +678,16 @@ if ($id > 0 || ! empty($ref)) print 'dispatchlineid.'">'.$langs->trans("Approve").''; print 'dispatchlineid.'">'.$langs->trans("Deny").''; } - else + if ($objp->status == 1) { - print 'dispatchlineid.'">'.$langs->trans("Disapprove").''; + print 'dispatchlineid.'">'.$langs->trans("Reinit").''; print 'dispatchlineid.'">'.$langs->trans("Deny").''; } + if ($objp->status == 2) + { + print 'dispatchlineid.'">'.$langs->trans("Reinit").''; + print 'dispatchlineid.'">'.$langs->trans("Approve").''; + } } print ''; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6a7da2d3ece..32a66564b07 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -160,7 +160,8 @@ ErrorPriceExpressionInternal=Internal error '%s' ErrorPriceExpressionUnknown=Unknown error '%s' ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without batch/serial information, on a product requiring batch/serial information -ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action +ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified (approved or denied) before being allowed to do this action +ErrorCantSetReceptionToTotalDoneWithReceptionDenied=All recorded receptions must first be verified (approved) before being allowed to do this action ErrorGlobalVariableUpdater0=HTTP request failed with error '%s' ErrorGlobalVariableUpdater1=Invalid JSON format '%s' ErrorGlobalVariableUpdater2=Missing parameter '%s' diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index bd2112cf871..ce4300e67c2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -700,6 +700,7 @@ SelectElementAndClickRefresh=Select an element and click Refresh PrintFile=Print File %s ShowTransaction=Show transaction GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide. +Denied=Denied # Week day Monday=Monday Tuesday=Tuesday From 3ee27907377dca510784b2c1cac10f11aedea6a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 16:26:21 +0200 Subject: [PATCH 080/184] Always sho project info when opening task card --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 0d4b43c9172..63aca7c7e92 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -371,7 +371,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $taskstatic->id=$lines[$i]->id; $taskstatic->ref=$lines[$i]->ref; $taskstatic->label=($taskrole[$lines[$i]->id]?$langs->trans("YourRole").': '.$taskrole[$lines[$i]->id]:''); - print $taskstatic->getNomUrl(1,($showproject?'':'withproject')); + print $taskstatic->getNomUrl(1,'withproject'); } print ''; From 503a4ff7a05ce892d4614d8cc3aaf259be9dbc3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Apr 2015 20:40:49 +0200 Subject: [PATCH 081/184] Enhance filtering for bank transaction and timesheet. --- htdocs/compta/bank/account.php | 2 +- htdocs/compta/bank/search.php | 7 +-- htdocs/core/lib/project.lib.php | 56 +++++++++++++++++------- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/activity/perday.php | 70 +++++++++++++++++++++++++++--- htdocs/projet/activity/perweek.php | 42 ++++++++++++------ 7 files changed, 139 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 6ba80304188..ce2bbc5381e 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -403,7 +403,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($nbcategories) { - print '
'.$langs->trans("Category").': '; + print '
'.$langs->trans("Rubrique").': '; } print ''; print '
'; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index a1e114430ce..f367149a19c 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -178,9 +178,10 @@ if ($resql) print ''."\n"; print ''."\n"; - $moreforfilter .= $langs->trans('Period') . ' ' . $langs->trans('StartDate') . ': '; - $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 1, 1); - $moreforfilter .= $langs->trans('EndDate') . ':' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 1, 1); + $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' '; + $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); + $moreforfilter .= ' - '; + $moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); if ($moreforfilter) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 63aca7c7e92..828c7c359d1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -504,9 +504,10 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * @param string $tasksrole Array of roles user has on task * @param string $mine Show only task lines I am assigned to * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to + * @param int $preselectedday Preselected day * @return $inc */ -function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) +function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0, $preselectedday='') { global $db, $user, $bc, $langs; global $form, $formother, $projectstatic, $taskstatic; @@ -527,6 +528,12 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t { $var = !$var; $lastprojectid=$lines[$i]->fk_project; + + if ($preselectedday) + { + $projectstatic->id = $lines[$i]->fk_project; + $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id); // Load time spent into this->weekWorkLoad and this->weekWorkLoadPerTaks for all day of a week + } } // If we want all or we have a role on task, we show it @@ -549,7 +556,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Ref print ''; // Label task @@ -559,7 +566,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $taskstatic->ref=$lines[$i]->label; $taskstatic->date_start=$lines[$i]->date_start; $taskstatic->date_end=$lines[$i]->date_end; - print $taskstatic->getNomUrl(0); + print $taskstatic->getNomUrl(0,'withproject'); //print "
"; //for ($k = 0 ; $k < $level ; $k++) print "   "; //print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0); @@ -613,14 +620,21 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t // Form to add new time print ''; print ''; print $tableCell; } + + print ''; + print "\n"; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ce4300e67c2..52ab660e21b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -220,6 +220,7 @@ Next=Next Cards=Cards Card=Card Now=Now +HourStart=Start hour Date=Date DateAndHour=Date and hour DateStart=Date start diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 40b1c2e308d..e56ddf2ec4a 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -14,6 +14,7 @@ MyTasksDesc=This view is limited to projects or tasks you are a contact for (wha OnlyOpenedProject=Only opened projects are visible (projects with draft or closed status are not visible). TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). +AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task you are assigned on. ProjectsArea=Projects area NewProject=New project AddProject=Create project diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9c55874a762..1df9359dfa5 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -48,11 +48,33 @@ $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); +$now=dol_now(); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; + +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); +$day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); + +$daytoparse = $now; +if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, $year); + /* * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -133,6 +155,16 @@ $projectstatic=new Project($db); $project = new Project($db); $taskstatic = new Task($db); +$prev = dol_getdate($daytoparse - (24 * 3600)); +$prev_year = $prev['year']; +$prev_month = $prev['mon']; +$prev_day = $prev['mday']; + +$next = dol_getdate($daytoparse + (24 * 3600)); +$next_year = $next['year']; +$next_month = $next['mon']; +$next_day = $next['mday']; + $title=$langs->trans("TimeSpent"); if ($mine) $title=$langs->trans("MyTimeSpent"); @@ -160,7 +192,18 @@ llxHeader("",$title,""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -print ''; +// Show navigation bar +$nav ="".img_previous($langs->trans("Previous"))."\n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"day")." \n"; +$nav.="".img_next($langs->trans("Next"))."\n"; +$nav.="   (".$langs->trans("Today").")"; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; + +$picto='calendarweek'; + + +print 'id > 0 ? '?id='.$project->id : '').'">'; print ''; print ''; print ''; @@ -169,13 +212,15 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperday', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } - +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; +print "\n"; // Filter on user /* dol_fiche_head(''); @@ -197,6 +242,10 @@ else dol_fiche_end(); */ + +print '
'.$nav.'
'; + + print '
'.$langs->trans("Project").''.$langs->trans("RefTask").''.$langs->trans("LabelTask").'
'.$langs->trans("Total").'
'; $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); - print $taskstatic->getNomUrl(1); + print $taskstatic->getNomUrl(1,'withproject'); print ''; - $s=''; - $s.=$form->select_date('',$lines[$i]->id,1,1,2,"addtime",1,0,1,$disabledtask); - print $s; + $tableCell=$form->select_date($preselectedday,$lines[$i]->id,1,1,2,"addtime",0,0,1,$disabledtask); + print $tableCell; print ''; - //$s.='   '; - $s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); - //$s.=' '; - print $s; + + $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; + $alreadyspent=''; + if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); + + $tableCell=''; + $tableCell.=''; + $tableCell.=' + '; + //$tableCell.='   '; + $tableCell.=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1); + //$tableCell.=' '; + print $tableCell; print ''; @@ -633,7 +647,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t $inc++; $level++; - if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday); $level--; } else @@ -776,18 +790,30 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ for ($idw = 0; $idw < 7; $idw++) { $tmpday=dol_time_plus_duree($firstdaytoshow, $idw, 'd'); + $tmparray=dol_getdate($tmpday); $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; $alreadyspent=''; if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin'); $tableCell =''; $tableCell.=''; - $tableCell.='+'; - $tableCell.=''; + //$placeholder=' placeholder="00:00"'; + $placeholder=''; + //if (! $disabledtask) + //{ + $tableCell.='+'; + $tableCell.=''; + //} $tableCell.=''; + if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); + else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou")); + print '
'; print ''; print ''; @@ -207,7 +256,7 @@ print ''; print ''; if ($usertoprocess->id == $user->id) print ''; else print ''; -print ''; +print ''; print ''; print "\n"; @@ -217,7 +266,7 @@ $restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJEC if (count($tasksarray) > 0) { $j=0; - projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask); + projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $daytoparse); } else { @@ -234,6 +283,13 @@ print ''; print ''; +print ''; + + llxFooter(); $db->close(); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index b7ab0a8bd71..77b65a19c6b 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -49,12 +49,15 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $projectid); $now=dol_now(); - -$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); -$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); -$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); +$nowtmp=dol_getdate($now); +$nowday=$nowtmp['mday']; +$nowmonth=$nowtmp['mon']; +$nowyear=$nowtmp['year']; +$year=GETPOST('reyear')?GETPOST('reyear'):(GETPOST("year","int")?GETPOST("year","int"):date("Y")); +$month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("month","int"):date("m")); +$day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); $day = (int) $day; +$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $startdayarray=dol_get_first_day_week($day, $month, $year); @@ -83,6 +86,13 @@ $usertoprocess=$user; * Actions */ +if (GETPOST('submitdateselect')) +{ + $daytoparse = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + + $action = ''; +} + if ($action == 'addtime' && $user->rights->projet->creer) { $task = new Task($db); @@ -176,16 +186,15 @@ llxHeader("",$title,"",'','','',array('/core/js/timesheet.js')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); -$tmpday = $first_day; - // Show navigation bar $nav ="".img_previous($langs->trans("Previous"))."\n"; -$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; -$nav.=" \n"; +$nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week." \n"; $nav.="".img_next($langs->trans("Next"))."\n"; $nav.="   (".$langs->trans("Today").")"; -$picto='calendarweek'; +$nav.='
'.$form->select_date(-1,'',0,0,2,"addtime",1,0,1).' '; +$nav.=' '; +$picto='calendarweek'; print ''; print ''; @@ -199,12 +208,14 @@ $head=project_timesheet_prepare_head($mode); dol_fiche_head($head, 'inputperweek', '', 0, 'task'); // Show description of content -if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; +if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'

'; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'

'; + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'
'; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'
'; } +print $langs->trans("AllTaskVisibleButEditIfYouAreAssigned").'
'; +print '
'; print "\n"; // Filter on user @@ -248,6 +259,7 @@ for($i=0;$i<7;$i++) { print ''; } +print ''; print "\n"; @@ -268,11 +280,12 @@ if (count($tasksarray) > 0) + '; } else { - print ''; + print ''; } print "
'.$langs->trans("Project").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("DateAndHour").''.$langs->trans("HourStart").''.$langs->trans("Duration").'
'.dol_print_date($startday + ($i * 3600 * 24), '%a').'
'.dol_print_date($startday + ($i * 3600 * 24), 'day').'
 
 
 
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; @@ -287,6 +300,7 @@ print ''; print ''."\n\n"; + $modeinput='hours'; print '