From 8670a89ecb8f6742420486dc20125e680d62c740 Mon Sep 17 00:00:00 2001 From: Cedric Date: Thu, 14 Aug 2014 08:41:24 +0200 Subject: [PATCH 01/22] Fix #1544: Can remove date from invoice --- ChangeLog | 1 + htdocs/compta/facture.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6e81703b33a..2fc6cb6a5bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ Fix: Link product, In list view and label product Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to. Fix: When disabled, all fields to add time into task line must be disabled. Fix: Missing include files.lib.php in some pages ti use dol_delete_recursive +Fix: [ bug #1544 ] Can remove date from invoice ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index bd5cdb0e9c8..50da8aab884 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -282,7 +282,15 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer) { $object->fetch($id); $old_date_lim_reglement=$object->date_lim_reglement; - $object->date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']); + $date=dol_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']); + if (empty($date)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); + header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate'); + exit; + + } + $object->date=$date; $new_date_lim_reglement=$object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement=$new_date_lim_reglement; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date; From c6637207f88ad57bf3a6586d5899ad560ff18723 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 14 Aug 2014 14:25:41 +0200 Subject: [PATCH 02/22] Fix : VAT and NPR rates where coming from multiprice... --- htdocs/compta/facture.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 07960ed2c2c..1933bfe4f7c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1254,8 +1254,8 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- $pu_ttc = $prod->multiprices_ttc[$object->client->price_level]; $price_min = $prod->multiprices_min[$object->client->price_level]; $price_base_type = $prod->multiprices_base_type[$object->client->price_level]; - $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; - $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; + //$tva_tx=$prod->multiprices_tva_tx[$object->client->price_level]; + //$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level]; } else { From e7a8de18bf17c269830abc92fd4cf3d6888f763c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Aug 2014 15:05:42 +0200 Subject: [PATCH 03/22] Fix: Minimum size for captcha --- htdocs/theme/amarok/style.css.php | 4 ++++ htdocs/theme/auguria/style.css.php | 3 +++ htdocs/theme/bureau2crea/style.css.php | 3 +++ htdocs/theme/cameleo/style.css.php | 3 +++ htdocs/theme/eldy/style.css.php | 3 +++ 5 files changed, 16 insertions(+) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index eda6e01f1f4..54bd05b6762 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -590,6 +590,10 @@ div.login { height: 16px; } +#securitycode { + min-width: 60px; +} + img.login, img.printer, img.entity { /* padding: dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ margin:2px 0px 0px 0px; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 946f46ad141..43a5bf87219 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -545,6 +545,9 @@ form#login { background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); } +#securitycode { + min-width: 60px; +} #img_securitycode { border: 1px solid #DDDDDD; } diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 92d6b4f242f..c9619448b9f 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -578,6 +578,9 @@ form#login { background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); } +#securitycode { + min-width: 60px; +} #img_securitycode { border: 1px solid #DDDDDD; } diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 8b4172522aa..4e83ab1c2a4 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -649,6 +649,9 @@ form#login { background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%); } +#securitycode { + min-width: 60px; +} #img_securitycode { border: 1px solid #DDDDDD; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 309d6f87e46..19b994ffc32 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -862,6 +862,9 @@ div#login_left, div#login_right { table.login_table tr td table.none tr td { padding: 2px; } +#securitycode { + min-width: 60px; +} #img_securitycode { border: 1px solid #DDDDDD; } From 86f1d59e3cfa7d82f7ed3461bb3debd95473321d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 17 Aug 2014 15:12:20 +0200 Subject: [PATCH 04/22] Fix: broken feature: add param for use only "disabled" with delConstant and "enabled" with setConstant --- htdocs/core/js/lib_head.js | 21 ++++++++++++--------- htdocs/core/lib/ajax.lib.php | 14 ++++++++------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 9221843d575..18dc2258c70 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -1,5 +1,5 @@ // Copyright (C) 2005-2013 Laurent Destailleur -// Copyright (C) 2005-2012 Regis Houssin +// Copyright (C) 2005-2014 Regis Houssin // // 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 @@ -631,7 +631,7 @@ function hideMessage(fieldId,message) { /* * TODO Used by admin page only ? */ -function setConstant(url, code, input, entity) { +function setConstant(url, code, input, entity, strict) { $.get( url, { action: "set", name: code, @@ -642,7 +642,7 @@ function setConstant(url, code, input, entity) { $("#del_" + code).show(); $.each(input, function(type, data) { // Enable another element - if (type == "disabled") { + if (type == "disabled" && strict != 1) { $.each(data, function(key, value) { var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; $(newvalue).removeAttr("disabled"); @@ -654,7 +654,10 @@ function setConstant(url, code, input, entity) { } else if (type == "enabled") { $.each(data, function(key, value) { var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; - $(newvalue).attr("disabled", true); + if (strict == 1) + $(newvalue).removeAttr("disabled"); + else + $(newvalue).attr("disabled", true); if ($(newvalue).hasClass("butAction") == true) { $(newvalue).removeClass("butAction"); $(newvalue).addClass("butActionRefused"); @@ -686,7 +689,7 @@ function setConstant(url, code, input, entity) { /* * TODO Used by admin page only ? */ -function delConstant(url, code, input, entity) { +function delConstant(url, code, input, entity, strict) { $.get( url, { action: "del", name: code, @@ -706,7 +709,7 @@ function delConstant(url, code, input, entity) { $(newvalue).addClass("butActionRefused"); } }); - } else if (type == "enabled") { + } else if (type == "enabled" && strict != 1) { $.each(data, function(key, value) { var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; $(newvalue).removeAttr("disabled"); @@ -740,7 +743,7 @@ function delConstant(url, code, input, entity) { /* * TODO Used by admin page only ? */ -function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) { +function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) { var boxConfirm = box; $("#confirm_" + code) .attr("title", boxConfirm.title) @@ -756,9 +759,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, text : yesButton, click : function() { if (action == "set") { - setConstant(url, code, input, entity); + setConstant(url, code, input, entity, strict); } else if (action == "del") { - delConstant(url, code, input, entity); + delConstant(url, code, input, entity, strict); } // Close dialog $(this).dialog("close"); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e24d12dbc52..46aed9ec1c9 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2007-2012 Regis Houssin + * Copyright (C) 2007-2014 Regis Houssin * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -380,9 +380,10 @@ function ajax_combobox($htmlname, $event=array(), $minLengthToAutocomplete=0) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param int $entity Entity to set * @param int $revertonoff Revert on/off + * @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant * @return void */ -function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) +function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0) { global $conf, $langs; @@ -395,6 +396,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\'; var code = \''.$code.'\'; var entity = \''.$entity.'\'; + var strict = \''.$strict.'\'; var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'"; var noButton = "'.dol_escape_js($langs->transnoentities("No")).'"; @@ -403,9 +405,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) if (input.alert && input.alert.set) { if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton; - confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton); + confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict); } else { - setConstant(url, code, input, entity); + setConstant(url, code, input, entity, strict); } }); @@ -414,9 +416,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) if (input.alert && input.alert.del) { if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; if (input.alert.del.noButton) noButton = input.alert.del.noButton; - confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton); + confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict); } else { - delConstant(url, code, input, entity); + delConstant(url, code, input, entity, strict); } }); }); From 50eb2e2c152a936644997696d6849ce51407b8d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Aug 2014 18:24:57 +0200 Subject: [PATCH 05/22] Fix: backlink was wrong after deleting product or service. --- htdocs/product/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index e6a5075bd3b..d96aac8fc33 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -389,7 +389,7 @@ if (empty($reshook)) if ($result > 0) { - header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref)); + header('Location: '.DOL_URL_ROOT.'/product/liste.php?type='.$object->type.'&delprod='.urlencode($object->ref)); exit; } else From 9fdfc740dee3129ef6ab0436321f81088e01f92e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Aug 2014 20:23:06 +0200 Subject: [PATCH 06/22] Fix: define new ref before trigger --- htdocs/commande/class/commande.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6b88ff3553d..795c2e26526 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2011 Jean Heimburger @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * * 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 + * 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. * @@ -290,6 +290,13 @@ class Commande extends CommonOrder } } + // Set new ref and current status + if (! $error) + { + $this->ref = $num; + $this->statut = 1; + } + if (! $error) { // Appel des triggers @@ -300,13 +307,6 @@ class Commande extends CommonOrder // Fin appel triggers } - // Set new ref and current status - if (! $error) - { - $this->ref = $num; - $this->statut = 1; - } - if (! $error) { $this->db->commit(); From b0163fbed25b3b4bef00d3ab07b65fc96668afca Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Fri, 22 Aug 2014 16:17:45 +0200 Subject: [PATCH 07/22] FIX error sql on update ficheinter --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bd1306b0cf6..3055a73c73c 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -235,7 +235,7 @@ class Fichinter extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; - $sql.= ", description = '".$this->db->escape($this->description)."'"; + $sql.= "description = '".$this->db->escape($this->description)."'"; $sql.= ", duree = ".$this->duree; $sql.= ", fk_projet = ".$this->fk_project; $sql.= ", note_private = ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); From 28ad819ab4a9e3f7c3de6b593ce5e1dcb636034e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 26 Aug 2014 09:49:15 +0200 Subject: [PATCH 08/22] Fix: error in strict mode --- 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 2b84f51cb0d..7f12b4ee14b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1206,7 +1206,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu else dol_print_error($db); $db->free($resql); } - if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP + if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP=20; $i=1; From f5883741bf2a94995a5df419bf887e482fca5b2e Mon Sep 17 00:00:00 2001 From: braito4 Date: Tue, 26 Aug 2014 20:20:29 +0200 Subject: [PATCH 09/22] Update fiche.php Proyect selection was missing --- htdocs/fourn/facture/fiche.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 74cc1bd486d..f36ff37fc1a 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1320,6 +1320,16 @@ if ($action == 'create') $form->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); print ''; + // Project + if (! empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); + + $langs->load('projects'); + print '' . $langs->trans('Project') . ''; + $formproject->select_projects($soc->id, $projectid, 'projectid'); + print ''; + } + // Public note print ''.$langs->trans('NotePublic').''; print ''; From cdd716eb9d126c784a34c5ab35cae7ad78ce2c46 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 10:44:40 +0200 Subject: [PATCH 10/22] Fix: error with php strict mode --- 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 7f12b4ee14b..83fcfca04bc 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1176,7 +1176,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu); // We update newmenu for special dynamic menus - if ($user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account + if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account { $sql = "SELECT rowid, label, courant, rappro, courant"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; From a446318649ed655967f0f42a8f71fd48ab5103db Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Aug 2014 19:02:13 +0200 Subject: [PATCH 11/22] Fix: strict mode anarchy ;-) check your variable please --- htdocs/core/tpl/document_actions_pre_headers.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/document_actions_pre_headers.tpl.php b/htdocs/core/tpl/document_actions_pre_headers.tpl.php index ca6929331ec..b386391cec2 100644 --- a/htdocs/core/tpl/document_actions_pre_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_pre_headers.tpl.php @@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); } } - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':'')); + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.(!empty($withproject)?'&withproject=1':'')); exit; } } From 4fdd98c4a75b719d3b0729fadca6d9eca138ac50 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:34:50 +0200 Subject: [PATCH 12/22] Fix: another strict mode alert --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 88a931a3d8a..4b1e2e5c4ed 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -268,7 +268,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - $printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false; + $printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false; $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; From 48f9ef25740d6e188e2ccf3f5b3c14732911e030 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 15:52:20 +0200 Subject: [PATCH 13/22] Fix: php strict mode saga --- htdocs/core/class/html.formfile.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 4b1e2e5c4ed..51a27c7f860 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2010-2012 Regis Houssin - * Copyright (c) 2010 Juanjo Menent - * Copyright (c) 2013 Charles-Fr BENKE - * Copyright (C) 2013 Cédric Salvador - * Copyright (c) 2014 Marcos García +/* Copyright (C) 2008-2013 Laurent Destailleur + * Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2013 Charles-Fr BENKE + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -513,11 +513,11 @@ class FormFile $out.= $genbutton; $out.= ''; - if($hookmanager->hooks['formfile']) + if (!empty($hookmanager->hooks['formfile'])) { foreach($hookmanager->hooks['formfile'] as $module) { - if(method_exists($module, 'formBuilddocLineOptions')) $out .= ''; + if (method_exists($module, 'formBuilddocLineOptions')) $out .= ''; } } $out.= ''; From 1aad1b6acd7decfce50a4d19602d6e1ab373950d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 19:32:41 +0200 Subject: [PATCH 14/22] Fix: strict mode --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8f884ee0f7b..68695fa2340 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -131,7 +131,7 @@ class InterfaceActionsAuto $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); - if ($object->prefix) $object->actionmsg.=" (".$object->prefix.")"; + if (!empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; From ff04729a07ca1b82bb8499d318fc686b2ba2d512 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 28 Aug 2014 19:32:41 +0200 Subject: [PATCH 15/22] Fix: strict mode --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 68695fa2340..32700488cb1 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -131,7 +131,7 @@ class InterfaceActionsAuto $object->actiontypecode='AC_OTH_AUTO'; if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); - if (!empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; + if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; From 2c68317864a424d0ef88b6aa2dce1ce7ad544b37 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Aug 2014 10:23:58 +0200 Subject: [PATCH 16/22] Fix : bad sql request when linking resource to an element --- htdocs/resource/class/resource.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/resource/class/resource.class.php b/htdocs/resource/class/resource.class.php index 6edeef201fb..9cf6a83ef1d 100644 --- a/htdocs/resource/class/resource.class.php +++ b/htdocs/resource/class/resource.class.php @@ -779,7 +779,7 @@ class Resource extends CommonObject // Links beetween objects are stored in this table $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_resources'; - $sql.= " WHERE element_id='".$element_id."' AND resource_type='".$this->element."'"; + $sql.= " WHERE element_id='".$element_id."' AND element_type='".$element."'"; if($resource_type) $sql.=" AND resource_type LIKE '%".$resource_type."%'"; $sql .= ' ORDER BY resource_type'; From 71afc4adb0a84f8acc430ca9eaf6cf7b13576381 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Aug 2014 11:11:32 +0200 Subject: [PATCH 17/22] Fix : missing actions for resource element --- .../resource/class/actions_resource.class.php | 82 ------------------ htdocs/resource/element_resource.php | 83 ++++++++++++++++++- 2 files changed, 80 insertions(+), 85 deletions(-) diff --git a/htdocs/resource/class/actions_resource.class.php b/htdocs/resource/class/actions_resource.class.php index 8d233dea847..afcf9eb19b8 100644 --- a/htdocs/resource/class/actions_resource.class.php +++ b/htdocs/resource/class/actions_resource.class.php @@ -82,87 +82,5 @@ class ActionsResource } } } - if (in_array('element_resource',explode(':',$parameters['context']))) - { - - $element_id = GETPOST('element_id','int'); - $element = GETPOST('element','alpha'); - $resource_type = GETPOST('resource_type'); - - $fk_resource = GETPOST('fk_resource'); - - $busy = GETPOST('busy','int'); - $mandatory = GETPOST('mandatory','int'); - - if($action == 'add_element_resource' && !GETPOST('cancel')) - { - $objstat = fetchObjectByElement($element_id,$element); - - $res = $objstat->add_element_resource($fk_resource,$resource_type,$busy,$mandatory); - - - if($res > 0) - { - setEventMessage($langs->trans('ResourceLinkedWithSuccess'),'mesgs'); - header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$element_id); - exit; - } - else - { - setEventMessage($langs->trans('ErrorWhenLinkingResource'),'errors'); - header("Location: ".$_SERVER['PHP_SELF'].'?mode=add&resource_type='.$resource_type.'&element='.$element.'&element_id='.$element_id); - exit; - } - } - - // Delete a resource linked to an element - if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes') - { - $res = $object->fetch(GETPOST('id')); - if($res) - { - - $result = $object->delete_resource(GETPOST('lineid'),GETPOST('element')); - - if ($result >= 0) - { - setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted')); - Header("Location: ".$_SERVER['PHP_SELF']."?element=".GETPOST('element')."&element_id=".GETPOST('element_id')); - exit; - } - else { - setEventMessage($object->error,'errors'); - } - } - else - { - setEventMessage($object->error,'errors'); - } - } - - // Update ressource - if ($action == 'update_linked_resource' && $user->rights->resource->write && !GETPOST('cancel') ) - { - $res = $object->fetch_element_resource(GETPOST('lineid')); - if($res) - { - - $object->busy = GETPOST('busy'); - $object->mandatory = GETPOST('mandatory'); - - $result = $object->update_element_resource($user); - - if ($result >= 0) - { - setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated')); - Header("Location: ".$_SERVER['PHP_SELF']."?element=".GETPOST('element')."&element_id=".GETPOST('element_id')); - exit; - } - else { - setEventMessage($object->error,'errors'); - } - } - } - } }*/ } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 7bd4b0dc2fb..c5329edd1f3 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -57,13 +57,90 @@ if( ! $user->rights->resource->read) $object=new Resource($db); $hookmanager->initHooks(array('element_resource')); - - $object->available_resources = array('resource'); -$parameters=array('resource_id'=>$available_resources); +// Get parameters +$id = GETPOST('id','int'); +$action = GETPOST('action','alpha'); +$mode = GETPOST('mode','alpha'); +$lineid = GETPOST('lineid','int'); +$element = GETPOST('element','alpha'); +$element_id = GETPOST('element_id','int'); +$resource_id = GETPOST('fk_resource','int'); +$resource_type = GETPOST('resource_type','alpha'); +$busy = GETPOST('busy','int'); +$mandatory = GETPOST('mandatory','int'); + +if($action == 'add_element_resource' && !GETPOST('cancel')) +{ + $objstat = fetchObjectByElement($element_id,$element); + $res = $objstat->add_element_resource($resource_id,$resource_type,$busy,$mandatory); + if($res > 0) + { + setEventMessage($langs->trans('ResourceLinkedWithSuccess'),'mesgs'); + header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$element_id); + exit; + } + else + { + setEventMessage($langs->trans('ErrorWhenLinkingResource'),'errors'); + header("Location: ".$_SERVER['PHP_SELF'].'?mode=add&resource_type='.$resource_type.'&element='.$element.'&element_id='.$element_id); + exit; + } +} + +// Update ressource +if ($action == 'update_linked_resource' && $user->rights->resource->write && !GETPOST('cancel') ) +{ + $res = $object->fetch_element_resource($lineid); + if($res) + { + $object->busy = $busy; + $object->mandatory = $mandatory; + + $result = $object->update_element_resource($user); + + if ($result >= 0) + { + setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated')); + Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id); + exit; + } + else { + setEventMessage($object->error,'errors'); + } + } +} + +// Delete a resource linked to an element +if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes') +{ + $res = $object->fetch(GETPOST('id')); + if($res) + { + $result = $object->delete_resource($lineid,$element); + + if ($result >= 0) + { + setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted')); + Header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id); + exit; + } + else { + setEventMessage($object->error,'errors'); + } + } + else + { + setEventMessage($object->error,'errors'); + } +} + +$parameters=array('resource_id'=>resource_id); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + + $parameters=array('resource_id'=>$resource_id); $reshook=$hookmanager->executeHooks('getElementResources',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks From b7a2e3783ebe050271692bc671cc4882e55ccadd Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Aug 2014 11:11:51 +0200 Subject: [PATCH 18/22] Fix : missing translations --- htdocs/langs/en_US/resource.lang | 2 ++ htdocs/langs/fr_FR/resource.lang | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/resource.lang b/htdocs/langs/en_US/resource.lang index f5927388193..502d328d7c3 100755 --- a/htdocs/langs/en_US/resource.lang +++ b/htdocs/langs/en_US/resource.lang @@ -23,9 +23,11 @@ ShowResourcePlanning=Show resource planning NoResourceInDatabase=No resource in database GotoDate=Go to date +ResourceElementPage=Element resources ResourceCreatedWithSuccess=Resource successfully created RessourceLineSuccessfullyDeleted=Resource line successfully deleted RessourceLineSuccessfullyUpdated=Resource line successfully updated +ResourceLinkedWithSuccess=Resource linked with success TitleResourceCard=Resource card ConfirmDeleteResource=Confirm to delete this resource diff --git a/htdocs/langs/fr_FR/resource.lang b/htdocs/langs/fr_FR/resource.lang index 7d896e27f5f..e4c8a6ade87 100755 --- a/htdocs/langs/fr_FR/resource.lang +++ b/htdocs/langs/fr_FR/resource.lang @@ -2,7 +2,7 @@ MenuResourceIndex=Ressources MenuResourceAdd=Nouvelle ressource MenuResourcePlanning=Planning des Ressources -DeleteResource=Effacer resource +DeleteResource=Effacer ressource ConfirmDeleteResourceElement=Confirmer la suppression de la ressource pour cet élément NoResourceInDatabase=Aucune ressource en base de données. NoResourceLinked=Aucune ressource liée @@ -17,17 +17,19 @@ ResourceFormLabel_description=Description de la ressource ResourcesLinkedToElement=Ressources liées à l'élément RessourceLineSuccessfullyUpdated=Ressource mise à jour -RessourceLineSuccessfullyDeleted=Resource supprimée +RessourceLineSuccessfullyDeleted=Ressource supprimée ShowResourcePlanning=Montrer le planning des ressources PlanningOfAffectedResources=Planning des ressources affectées aux évènements GotoDate=Afficher la date +ResourceElementPage=Ressources de l'élément ResourceCreatedWithSuccess=Ressource créee avec succès RessourceLineSuccessfullyDeleted=Ressource supprimée avec succès RessourceLineSuccessfullyUpdated=Ressource mise à jour +ResourceLinkedWithSuccess=Ressource liée avec succès -TitleResourceCard=Fiche resource +TitleResourceCard=Fiche ressource ConfirmDeleteResource=Confirmer la suppression de cette ressource? RessourceSuccessfullyDeleted=Ressource effacée avec succès DictionaryResourceType=Type de ressources \ No newline at end of file From bff33166a59bf5e4ba20b9bdbd274a44f36b4741 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 1 Sep 2014 11:49:44 +0200 Subject: [PATCH 19/22] Fix missing $user in create method --- htdocs/categories/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index d43c4df9a3d..58b4696c305 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -132,7 +132,7 @@ if ($action == 'add' && $user->rights->categorie->creer) // Create category in database if (! $error) { - $result = $object->create(); + $result = $object->create($user); if ($result > 0) { $action = 'confirmed'; From 17dec4b924c2fca89a3a6d1d6ddae2f9e6429ef6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Sep 2014 13:05:03 +0200 Subject: [PATCH 20/22] Fix: Bad merge --- htdocs/compta/facture.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1cf4649547c..8138c56450e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -248,16 +248,18 @@ else if ($action == 'setmode' && $user->rights->facture->creer) { dol_print_error($db, $object->error); } -else if ($action == 'setinvoicedate' && $user->rights->facture->creer) { +else if ($action == 'setinvoicedate' && $user->rights->facture->creer) +{ $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $object->date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']); + $date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']); if (empty($date)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate'); exit; } + $object->date=$date; $new_date_lim_reglement = $object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date; From f7c48558e6d2d17bf6f0f885ab76b9b87967137d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Sep 2014 19:45:05 +0200 Subject: [PATCH 21/22] Fix: balance with td --- htdocs/product/price.php | 295 ++++++++++++++++++++------------------- 1 file changed, 148 insertions(+), 147 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index db88599f52d..b208cba1c7e 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - + $prodcustprice = new Productcustomerprice($db); } @@ -58,18 +58,18 @@ $object = new Product($db); if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { $result = $object->fetch($id); - + // MultiPrix - if (! empty($conf->global->PRODUIT_MULTIPRICES)) + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { $newprice = ''; $newprice_min = ''; $newpricebase = ''; $newvat = ''; - - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) + + for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { - if (isset($_POST ["price_" . $i])) + if (isset($_POST ["price_" . $i])) { $level = $i; $newprice = price2num($_POST ["price_" . $i], 'MU'); @@ -92,7 +92,7 @@ if ($action == 'update_price' && ! $_POST ["cancel"] && ($user->rights->produit- $newpsq = GETPOST('psqflag'); $newpsq = empty($newpsq) ? 0 : $newpsq; } - + if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) { $action = ''; $mesg = '
' . $langs->trans("RecordSaved") . '
'; @@ -115,7 +115,7 @@ $error = 0; if ($action == 'activate_price_by_qty') { // Activating product price by quantity add a new price, specified as by quantity $result = $object->fetch($id); $level = GETPOST('level'); - + $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); } @@ -125,7 +125,7 @@ if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par quantité $result = $object->fetch($id); - + // Récupération des variables $rowid = GETPOST('rowid'); $priceid = GETPOST('priceid'); @@ -148,10 +148,10 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu if ($object->price_base_type == 'TTC') { $price = price2num($newprice) / (1 + ($object->tva_tx / 100)); } - + $price = price2num($newprice, 'MU'); $unitPrice = price2num($price / $quantity, 'MU'); - + // Ajout / mise à jour if ($rowid > 0) { $sql = "UPDATE " . MAIN_DB_PREFIX . "product_price_by_qty SET"; @@ -161,12 +161,12 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu $sql .= " remise_percent=" . $remise_percent . ","; $sql .= " remise=" . $remise; $sql .= " WHERE rowid = " . GETPOST('rowid'); - + $result = $db->query($sql); } else { $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_price_by_qty (fk_product_price,price,unitprice,quantity,remise_percent,remise) values ("; $sql .= $priceid . ',' . $price . ',' . $unitPrice . ',' . $quantity . ',' . $remise_percent . ',' . $remise . ')'; - + $result = $db->query($sql); } } @@ -174,19 +174,19 @@ if ($action == 'update_price_by_qty') { // Ajout / Mise à jour d'un prix par qu if ($action == 'delete_price_by_qty') { $rowid = GETPOST('rowid'); - + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; $sql .= " WHERE rowid = " . GETPOST('rowid'); - + $result = $db->query($sql); } if ($action == 'delete_all_price_by_qty') { $priceid = GETPOST('priceid'); - + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_price_by_qty"; $sql .= " WHERE fk_product_price = " . $priceid; - + $result = $db->query($sql); } @@ -196,11 +196,11 @@ if ($action == 'delete_all_price_by_qty') { * **************************************************** */ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $update_child_soc = GETPOST('updatechildprice'); - + $result = $object->fetch($id); - + // add price by customer $prodcustprice->fk_soc = GETPOST('socid', 'int'); $prodcustprice->fk_product = $object->id; @@ -209,15 +209,15 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->create($user, 0, $update_child_soc); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -225,7 +225,7 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer || // Delete price by customer $prodcustprice->id = GETPOST('lineid'); $result = $prodcustprice->delete($user); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'mesgs'); } else { @@ -235,26 +235,26 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->supprimer || } if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $update_child_soc = GETPOST('updatechildprice'); - + $prodcustprice->fetch(GETPOST('lineid', 'int')); - + // update price by customer $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->update($user, 0, $update_child_soc); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -304,22 +304,22 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { $soc = new Societe($db); $soc->id = $socid; $soc->fetch($socid); - + print '' . $langs->trans("SellingPrice") . ''; - + if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { print '' . price($object->multiprices_ttc ["$soc->price_level"]); } else { print '' . price($object->multiprices ["$soc->price_level"]); } - + if ($object->multiprices_base_type ["$soc->price_level"]) { print ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); } else { print ' ' . $langs->trans($object->price_base_type); } print ''; - + // Prix mini print '' . $langs->trans("MinPrice") . ''; if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { @@ -328,41 +328,41 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print price($object->multiprices_min ["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); } print ''; - + // TVA print '' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . ''; - } + } else { - for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) + for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { // TVA if ($i == 1) // We show only price for level 1 { print '' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . ''; } - + print ''; - + // Label of price print '' . $langs->trans("SellingPrice") . ' ' . $i; $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); print ''; - + if ($object->multiprices_base_type ["$i"] == 'TTC') { print '' . price($object->multiprices_ttc ["$i"]); } else { print '' . price($object->multiprices ["$i"]); } - + if ($object->multiprices_base_type ["$i"]) { print ' ' . $langs->trans($object->multiprices_base_type ["$i"]); } else { print ' ' . $langs->trans($object->price_base_type); } print ''; - + // Prix mini print '' . $langs->trans("MinPrice") . ' ' . $i . ''; if ($object->multiprices_base_type ["$i"] == 'TTC') { @@ -371,15 +371,15 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print price($object->multiprices_min ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); } print ''; - + // Price by quantity if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { print '' . $langs->trans("PriceByQuantity") . ' ' . $i; print ''; - + if ($object->prices_by_qty [$i] == 1) { print ''; - + print ''; print ''; print ''; @@ -434,7 +434,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; print ''; } - + print '
' . $langs->trans("PriceByQuantityRange") . ' ' . $i . '' . $langs->trans("HT") . '
'; } else { print $langs->trans("No"); @@ -447,7 +447,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { } else { // TVA print '' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . ''; - + // Price print '' . $langs->trans("SellingPrice") . ''; if ($object->price_base_type == 'TTC') { @@ -456,7 +456,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print price($object->price) . ' ' . $langs->trans($object->price_base_type); } print ''; - + // Price minimum print '' . $langs->trans("MinPrice") . ''; if ($object->price_base_type == 'TTC') { @@ -465,7 +465,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print price($object->price_min) . ' ' . $langs->trans($object->price_base_type); } print ''; - + // Price by quantity if ($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { print '' . $langs->trans("PriceByQuantity"); @@ -473,7 +473,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ' ' . $langs->trans("Activate"); } print ''; - + if ($object->prices_by_qty [0] == 1) { print ''; print ''; @@ -530,7 +530,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; print ''; } - + print '
'; } else { print $langs->trans("No"); @@ -560,11 +560,11 @@ if (! empty($mesg)) { if (! $action || $action == 'delete') { print "\n" . '
\n"; } @@ -573,19 +573,19 @@ if (! $action || $action == 'delete') { */ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->service->creer)) { print_fiche_titre($langs->trans("NewPrice"), '', ''); - + if (empty($conf->global->PRODUIT_MULTIPRICES)) { print '
'; print ''; print ''; print ''; print ''; - + // VAT print ''; - + // Price base print ''; print ''; - + // Price print ''; - + // Price minimum print ''; - + print '
' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print '
'; print $langs->trans('PriceBase'); @@ -594,7 +594,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print $form->select_PriceBaseType($object->price_base_type, "price_base_type"); print '
'; $text = $langs->trans('SellingPrice'); @@ -606,7 +606,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; } print '
'; $text = $langs->trans('MinPrice'); @@ -617,12 +617,12 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; } print '
'; - + print '

 '; print '
'; - + print '
'; } else { for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { @@ -631,7 +631,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; print ''; print ''; - + // VAT if ($i == 1) { print ''; - + // Min price print ''; - + print ''; print '
' . $langs->trans("VATRate") . ''; @@ -640,7 +640,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> } else { // We always use the vat rate of price level 1 (A vat rate does not depends on customer) print ''; } - + // Selling price print '
'; $text = $langs->trans('SellingPrice') . ' ' . $i; @@ -653,7 +653,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> } print $form->select_PriceBaseType($object->multiprices_base_type ["$i"], "multiprices_base_type_" . $i); print '
'; $text = $langs->trans('MinPrice') . ' ' . $i; @@ -664,7 +664,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> print ''; } print '
 '; print '
'; @@ -691,33 +691,33 @@ dol_syslog("sql=" . $sql); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - + if (! $num) { $db->free($result); - + // Il doit au moins y avoir la ligne de prix initial. // On l'ajoute donc pour remettre a niveau (pb vieilles versions) $object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min); - + $result = $db->query($sql); $num = $db->num_rows($result); } - + if ($num > 0) { print '
'; - + print ''; - + print ''; print ''; - + if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; } if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { print ''; } - + print ''; print ''; print ''; @@ -728,7 +728,7 @@ if ($result) { if ($user->rights->produit->supprimer) print ''; print ''; - + $var = True; $i = 0; while ($i < $num) { @@ -737,7 +737,7 @@ if ($result) { print ""; // Date print ""; - + // Price level if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print '"; @@ -747,17 +747,17 @@ if ($result) { $type = ($objp->price_by_qty == 1) ? 'PriceByQuantity' : 'Standard'; print '"; } - + print '"; print '"; print '"; print '"; print ''; print ''; - + // User print ''; - + // Action if ($user->rights->produit->supprimer) { print ''; } - + print "\n"; $i ++; } @@ -782,9 +782,9 @@ if ($result) { } if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - + $prodcustprice = new Productcustomerprice($db); - + $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); @@ -798,21 +798,21 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $sortorder = "ASC"; if (! $sortfield) $sortfield = "soc.nom"; - + // Build filter to diplay only concerned lines $filter = array('t.fk_product' => $object->id); - + $search_soc = GETPOST('search_soc'); if (! empty($search_soc)) { $filter ['soc.nom'] = $search_soc; } - + if ($action == 'add_customer_price') { - + // Create mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + print ''; print ''; print ''; @@ -824,12 +824,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_company('', 'socid', 's.rowid NOT IN (SELECT fk_soc FROM ' . MAIN_DB_PREFIX . 'product_customer_price WHERE fk_product='.$object->id.')', 1); print ''; print ''; - + // VAT print ''; - + // Price base print ''; print ''; - + // Price print ''; - + // Price minimum print ''; - + // Update all child soc print ''; print ''; - + print '
' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("MultiPriceLevelsName") . '' . $langs->trans("Type") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . ' 
" . dol_print_date($db->jdate($objp->dp), "dayhour") . "' . $objp->price_level . "' . $langs->trans($type) . "' . $langs->trans($objp->price_base_type) . "' . vatrate($objp->tva_tx, true, $objp->recuperableonly) . "' . price($objp->price) . "' . price($objp->price_ttc) . "' . price($objp->price_min) . '' . price($objp->price_min_ttc) . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . ''; @@ -769,7 +769,7 @@ if ($result) { print ' '; // Can not delete last price (it's current price) print '
' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print '
'; print $langs->trans('PriceBase'); @@ -838,7 +838,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_PriceBaseType($object->price_base_type, "price_base_type"); print '
'; $text = $langs->trans('SellingPrice'); @@ -850,7 +850,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print '
'; $text = $langs->trans('MinPrice'); @@ -861,7 +861,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print '
'; print $langs->trans('ForceUpdateChildPriceSoc'); @@ -870,24 +870,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print '
'; - + print '

 '; print '
'; - + print '
'; } elseif ($action == 'edit_customer_price') { - + // Edit mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + $result = $prodcustprice->fetch(GETPOST('lineid', 'int')); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + print '
'; print ''; print ''; @@ -899,12 +899,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $staticsoc->fetch($prodcustprice->fk_soc); print "" . $staticsoc->getNomUrl(1) . ""; print ''; - + // VAT print '' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly); print ''; - + // Price base print ''; print $langs->trans('PriceBase'); @@ -913,7 +913,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_PriceBaseType($prodcustprice->price_base_type, "price_base_type"); print ''; print ''; - + // Price print ''; $text = $langs->trans('SellingPrice'); @@ -925,18 +925,19 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print ''; - + // Price minimum print ''; $text = $langs->trans('MinPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + print ''; if ($prodcustprice->price_base_type == 'TTC') { - print ''; + print ''; } else { - print ''; + print ''; } print ''; - + // Update all child soc print ''; print $langs->trans('ForceUpdateChildPriceSoc'); @@ -945,39 +946,39 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + print ''; - + print '

 '; print '
'; - + print '
'; } elseif ($action == 'showlog_customer_price') { - + $filter = array('t.fk_product' => $object->id,'t.fk_soc' => GETPOST('socid', 'int')); - + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } - + $result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + $option = '&socid=' . GETPOST('socid', 'int') . '&id=' . $object->id; - + print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - + if (count($prodcustprice->lines) > 0) { - + print '
'; print ''; - + print ''; - + print ''; print ''; print ''; @@ -990,26 +991,26 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + $var = True; - + foreach ($prodcustprice->lines as $line) { - + print ""; // Date $staticsoc = new Societe($db); $staticsoc->fetch($line->fk_soc); - + print ""; print ""; - + print '"; print '"; print '"; print '"; print ''; print ''; - + // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); @@ -1021,36 +1022,36 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } else { print $langs->trans('None'); } - + print "\n" . '
' . "\n"; print ''; print "\n

\n"; } else { - + // View mode - + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); } - + $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + $option = '&search_soc=' . $search_soc . '&id=' . $object->id; - + print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - + if (count($prodcustprice->lines) > 0) { - + print ''; print ''; - + print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("ChangedBy") . ' 
" . $staticsoc->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '
'; - + print ''; print ''; print ''; @@ -1063,7 +1064,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -1072,33 +1073,33 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + $var = True; - + foreach ($prodcustprice->lines as $line) { - + print ""; // Date $staticsoc = new Societe($db); $staticsoc->fetch($line->fk_soc); - + print ""; print ""; - + print '"; print '"; print '"; print '"; print ''; print ''; - + // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); print ''; - + // Todo Edit or delete button // Action if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { @@ -1114,24 +1115,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; } - + print "\n"; } print "
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("ChangedBy") . ' 
 
" . $staticsoc->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; print $userstatic->getLoginUrl(1); print '
"; - + print "
"; } else { print $langs->trans('None'); } - + /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ - + print "\n" . '
' . "\n"; - + if ($user->rights->produit->creer || $user->rights->service->creer) { print ''; } From 165856656a366ee48f8c755c0742286fc14f160a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Sep 2014 19:45:50 +0200 Subject: [PATCH 22/22] Fix: balance with td --- htdocs/societe/price.php | 167 ++++++++++++++++++++------------------- 1 file changed, 84 insertions(+), 83 deletions(-) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 0765a6adb31..7ab39a10ddc 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - + $prodcustprice = new Productcustomerprice($db); } @@ -54,9 +54,9 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); * **************************************************** */ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $update_child_soc = GETPOST('updatechildprice'); - + // add price by customer $prodcustprice->fk_soc = $socid; $prodcustprice->fk_product = GETPOST('prodid', 'int'); @@ -65,15 +65,15 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->create($user, 0, $update_child_soc); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -81,7 +81,7 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use // Delete price by customer $prodcustprice->id = GETPOST('lineid'); $result = $prodcustprice->delete($user); - + if ($result < 0) { setEventMessage($prodcustprice->error, 'mesgs'); } else { @@ -91,25 +91,25 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use } if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { - + $prodcustprice->fetch(GETPOST('lineid', 'int')); - + $update_child_soc = GETPOST('updatechildprice'); - + // update price by customer $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + $result = $prodcustprice->update($user, 0, $update_child_soc); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } else { setEventMessage($langs->trans('Save'), 'mesgs'); } - + $action = ''; } @@ -199,9 +199,9 @@ print ''; print '
'; if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { - + $prodcustprice = new Productcustomerprice($db); - + $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); @@ -215,23 +215,23 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $sortorder = "ASC"; if (! $sortfield) $sortfield = "soc.nom"; - + // Build filter to diplay only concerned lines $filter = array ( - 't.fk_soc' => $soc->id + 't.fk_soc' => $soc->id ); - + $search_soc = GETPOST('search_soc'); if (! empty($search_soc)) { $filter ['soc.nom'] = $search_soc; } - + if ($action == 'add_customer_price') { - + // Create mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + print '
'; print ''; print ''; @@ -243,12 +243,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_produits('', 'prodid', '', 0); print ''; print ''; - + // VAT print '' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); print ''; - + // Price base print ''; print $langs->trans('PriceBase'); @@ -257,7 +257,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_PriceBaseType($object->price_base_type, "price_base_type"); print ''; print ''; - + // Price print ''; $text = $langs->trans('SellingPrice'); @@ -269,7 +269,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print ''; - + // Price minimum print ''; $text = $langs->trans('MinPrice'); @@ -280,7 +280,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print ''; - + // Update all child soc print ''; print $langs->trans('ForceUpdateChildPriceSoc'); @@ -289,24 +289,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + print ''; - + print '

 '; print '
'; - + print '
'; } elseif ($action == 'edit_customer_price') { - + // Edit mode - + print_fiche_titre($langs->trans('PriceByCustomer')); - + $result = $prodcustprice->fetch(GETPOST('lineid', 'int')); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + print '
'; print ''; print ''; @@ -318,12 +318,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $staticprod->fetch($prodcustprice->fk_product); print "" . $staticprod->getNomUrl(1) . ""; print ''; - + // VAT print '' . $langs->trans("VATRate") . ''; print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $staticprod->id, $prodcustprice->recuperableonly); print ''; - + // Price base print ''; print $langs->trans('PriceBase'); @@ -332,7 +332,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $form->select_PriceBaseType($prodcustprice->price_base_type, "price_base_type"); print ''; print ''; - + // Price print ''; $text = $langs->trans('SellingPrice'); @@ -344,18 +344,19 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print ''; - + // Price minimum print ''; $text = $langs->trans('MinPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); + print ''; if ($prodcustprice->price_base_type == 'TTC') { - print ''; + print ''; } else { - print ''; + print ''; } print ''; - + // Update all child soc print ''; print $langs->trans('ForceUpdateChildPriceSoc'); @@ -364,41 +365,41 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + print ''; - + print '

 '; print '
'; - + print '
'; } elseif ($action == 'showlog_customer_price') { - + $filter = array ( - 't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid + 't.fk_product' => GETPOST('prodid', 'int'),'t.fk_soc' => $socid ); - + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); } - + $result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + $option = '&socid=' . GETPOST('socid', 'int') . '&prodid=' . GETPOST('prodid', 'int'); - + print_barre_liste($langs->trans('PriceByCustomerLog'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - + if (count($prodcustprice->lines) > 0) { - + print '
'; print ''; - + print ''; - + print ''; print ''; print ''; @@ -411,25 +412,25 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + $var = True; - + foreach ( $prodcustprice->lines as $line ) { - + print ""; $staticprod = new Product($db); $staticprod->fetch($line->fk_product); - + print ""; print ""; - + print '"; print '"; print '"; print '"; print ''; print ''; - + // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); @@ -441,36 +442,36 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } else { print $langs->trans('None'); } - + print "\n" . '
' . "\n"; print ''; print "\n

\n"; } else { - + // View mode - + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $prodcustprice->fetch_all('', '', 0, 0, $filter); } - + $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); if ($result < 0) { setEventMessage($prodcustprice->error, 'errors'); } - + $option = '&search_soc=' . $search_soc . '&id=' . $object->id; - + print_barre_liste($langs->trans('PriceByCustomer'), $page, $_SERVEUR ['PHP_SELF'], $option, $sortfield, $sortorder, '', count($prodcustprice->lines), $nbtotalofrecords); - + if (count($prodcustprice->lines) > 0) { - + print ''; print ''; - + print '
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("ChangedBy") . ' 
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '
'; - + print ''; print ''; print ''; @@ -483,7 +484,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -492,33 +493,33 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - + $var = True; - + foreach ( $prodcustprice->lines as $line ) { - + print ""; - + $staticprod = new Product($db); $staticprod->fetch($line->fk_product); - + print ""; print ""; - + print '"; print '"; print '"; print '"; print ''; print ''; - + // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); print ''; - + // Todo Edit or delete button // Action if ($user->rights->produit->creer || $user->rights->service->creer) { @@ -534,24 +535,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; } - + print "\n"; } print "
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("ChangedBy") . ' 
 
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; print $userstatic->getLoginUrl(1); print '
"; - + print "
"; } else { print $langs->trans('None'); } - + /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ - + print "\n" . '
' . "\n"; - + if ($user->rights->produit->creer || $user->rights->service->creer) { print ''; }