From 1a9e98cda9563b42f1f7e7d1faf215d165ff34bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Fri, 8 Aug 2014 19:30:21 +0200 Subject: [PATCH 01/27] Fix categories bug When using the string type, $typeid == 1 matched all strings making other conditions ineffective. --- htdocs/categories/class/categorie.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b7e2ed030ab..1788f2e1ac6 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1123,11 +1123,11 @@ class Categorie $cats = array(); $table=''; $type=''; - if ($typeid == 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } - else if ($typeid == 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } - else if ($typeid == 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } - else if ($typeid == 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($typeid == 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + if ($typeid === 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } + else if ($typeid === 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } + else if ($typeid === 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } + else if ($typeid === 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } + else if ($typeid === 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; From 739d309a0d3e38becd20c28bf07e41078fcf49c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 14 Aug 2014 08:46:51 +0200 Subject: [PATCH 02/27] Updated category fix Categories ID can be passed as strings PSR code formatting --- htdocs/categories/class/categorie.class.php | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 1788f2e1ac6..60b738ea8ba 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1122,12 +1122,29 @@ class Categorie { $cats = array(); - $table=''; $type=''; - if ($typeid === 0 || $typeid == 'product') { $typeid=0; $table='product'; $type='product'; } - else if ($typeid === 1 || $typeid == 'supplier') { $typeid=1; $table='societe'; $type='fournisseur'; } - else if ($typeid === 2 || $typeid == 'customer') { $typeid=2; $table='societe'; $type='societe'; } - else if ($typeid === 3 || $typeid == 'member') { $typeid=3; $table='member'; $type='member'; } - else if ($typeid === 4 || $typeid == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } + $table = ''; + $type = ''; + if ($typeid === 0 || $typeid === '0' || $typeid == 'product') { + $typeid = 0; + $table = 'product'; + $type = 'product'; + } else if ($typeid === 1 || $typeid === '1' || $typeid == 'supplier') { + $typeid = 1; + $table = 'societe'; + $type = 'fournisseur'; + } else if ($typeid === 2 || $typeid === '2' || $typeid == 'customer') { + $typeid = 2; + $table = 'societe'; + $type = 'societe'; + } else if ($typeid === 3 || $typeid === '3' || $typeid == 'member') { + $typeid = 3; + $table = 'member'; + $type = 'member'; + } else if ($typeid === 4 || $typeid === '4' || $typeid == 'contact') { + $typeid = 4; + $table = 'socpeople'; + $type = 'contact'; + } $sql = "SELECT ct.fk_categorie, c.label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; From f5883741bf2a94995a5df419bf887e482fca5b2e Mon Sep 17 00:00:00 2001 From: braito4 Date: Tue, 26 Aug 2014 20:20:29 +0200 Subject: [PATCH 03/27] 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 2c68317864a424d0ef88b6aa2dce1ce7ad544b37 Mon Sep 17 00:00:00 2001 From: jfefe Date: Sat, 30 Aug 2014 10:23:58 +0200 Subject: [PATCH 04/27] 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 05/27] 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 06/27] 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 67b308cb2549550777d76551800db94c4cf2b3d0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:14:41 +0200 Subject: [PATCH 07/27] Fix: list event view lost type event filter --- ChangeLog | 1 + htdocs/comm/action/listactions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80696a3d7a6..9a40ed7e9ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Fix: Missing include files.lib.php in some pages to use dol_delete_recursive. Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref. Fix: [ bug #1553 ] Saving User displays setup removes menu. Fix: [ bug #1544 ] Can remove date from invoice +Fix: list event view lost type event filter ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index ebe68fa3328..8b945a16670 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -211,7 +211,7 @@ if ($resql) $head = calendars_prepare_head(''); dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1,$actioncode); dol_fiche_end(); // Add link to show birthdays From c8a9f4600c57d237c4f484b0922830fc7bc79de2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:20:57 +0200 Subject: [PATCH 08/27] Fix: list event view lost type event filter --- ChangeLog | 1 + htdocs/comm/action/listactions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 53dde2583f0..57a9aef6c90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ For users: - Fix: Salary payments are not reflected on the reporting sheets - Fix: Unsubscribe emailing not working - Fix: Trigger on create category call failed because user is not passed on card +- Fix: list event view lost type event filter ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 48e21690d2a..2c0c108b275 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -195,7 +195,7 @@ if ($resql) $head = calendars_prepare_head(''); dol_fiche_head($head, 'card', $langs->trans('Events'), 0, 'list'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,$filtera,$filtert,$filterd,$pid,$socid,-1,$actioncode); dol_fiche_end(); // Add link to show birthdays From 911aca399ddad5ecc9ebe7100eff5f89d31687f4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:30:35 +0200 Subject: [PATCH 09/27] save code event --- ChangeLog | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 9a40ed7e9ab..3b4def098c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old Fix: [ bug #1553 ] Saving User displays setup removes menu. Fix: [ bug #1544 ] Can remove date from invoice Fix: list event view lost type event filter +Fix: Add code save on create event ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 10082062d06..b51b33e5b66 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -140,6 +140,7 @@ class ActionComm extends CommonObject if ($result > 0) { $this->type_id=$cactioncomm->id; + $this->code=$cactioncomm->code; } else if ($result == 0) { From 832d1b37c12709757a8c9ddca988ea862614820f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Sep 2014 11:32:38 +0200 Subject: [PATCH 10/27] Save also code of event --- ChangeLog | 1 + htdocs/comm/action/class/actioncomm.class.php | 1 + 2 files changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 57a9aef6c90..d7ec265d040 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ For users: - Fix: Unsubscribe emailing not working - Fix: Trigger on create category call failed because user is not passed on card - Fix: list event view lost type event filter +- Fix: Save also code event ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9e4c032ee..e41e556f3d9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -140,6 +140,7 @@ class ActionComm extends CommonObject if ($result > 0) { $this->type_id=$cactioncomm->id; + $this->code=$cactioncomm->code; } else if ($result == 0) { From f7c48558e6d2d17bf6f0f885ab76b9b87967137d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Sep 2014 19:45:05 +0200 Subject: [PATCH 11/27] 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 12/27] 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 ''; } From bd99f3943df513830407cc98577fcaff635ae91e Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:31:40 +0200 Subject: [PATCH 13/27] Payment VAT :: Add control on field required --- htdocs/compta/tva/fiche.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/tva/fiche.php b/htdocs/compta/tva/fiche.php index 65c4285d7d1..a4a5a8831c4 100644 --- a/htdocs/compta/tva/fiche.php +++ b/htdocs/compta/tva/fiche.php @@ -72,6 +72,16 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $tva->label=GETPOST("label"); $tva->note=GETPOST("note"); + if (empty($tva->datev)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors'); + $error++; + } + if (empty($tva->datep)) + { + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors'); + $error++; + } if (empty($tva->type_payment) || $tva->type_payment < 0) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors'); From 4e05afdd6682d7fcebc4958fb8d6c0c87588ca61 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 3 Sep 2014 21:32:31 +0200 Subject: [PATCH 14/27] Payment Salaries :: Add field required & control on it --- htdocs/compta/salaries/fiche.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index ae74344ccf8..c46f83dd6fb 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -80,7 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $sal->num_payment=GETPOST("num_payment"); $sal->fk_user_creat=$user->id; - if (empty($datep) || empty($datesp) || empty($dateep)) + if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep)) { setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors'); $error++; @@ -219,7 +219,7 @@ if ($action == 'create') print $form->select_date((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print ''; - print ''.$langs->trans("DateValue").''; + print ''.$langs->trans("DateValue").''; print $form->select_date((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print ''; From 395209a5dbaee724a516e2958d505deaa56212dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 15:17:05 +0200 Subject: [PATCH 15/27] Fix: Reason to have button greyed is wrong Conflicts: htdocs/compta/facture/prelevement.php --- htdocs/compta/facture/prelevement.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index e579bc21640..81505af34ee 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * @@ -142,7 +142,7 @@ if ($object->id > 0) /* * Facture - */ + */ print ''; $linkback = ''.$langs->trans("BackToList").''; @@ -450,7 +450,7 @@ if ($object->id > 0) /* * Buttons - */ + */ print "\n
\n"; // Add a withdraw request @@ -467,7 +467,11 @@ if ($object->id > 0) } else { - if ($num == 0) print ''.$langs->trans("MakeWithdrawRequest").''; + if ($num == 0) + { + if ($object->statut > 0) print ''.$langs->trans("MakeWithdrawRequest").''; + else print ''.$langs->trans("MakeWithdrawRequest").''; + } else print ''.$langs->trans("MakeWithdrawRequest").''; } From b88b4fbc2cbf1f50852aa7ac2be6b8ae1415e126 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 14:43:16 +0200 Subject: [PATCH 16/27] Fix: bad balance of td --- htdocs/core/class/html.formfile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9299702a1bb..1cdf6fd194e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1148,7 +1148,7 @@ class FormFile print ''; print '
'; print ''; - print ''; @@ -1163,7 +1163,7 @@ class FormFile print ''; print ''; print ''; - print ''; } From da8a1cb47507cfcb2fea6888b8166c71df5fdf0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 15:38:20 +0200 Subject: [PATCH 17/27] Fix: Iban was used instead of Bic into SEPA file. Fix: Must unaccent strings into SEPA file. --- ChangeLog | 2 ++ .../class/bonprelevement.class.php | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e060f84ad15..f8193c0ce1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ For users: - Fix: Trigger on create category call failed because user is not passed on card - Fix: list event view lost type event filter - Fix: Save also code event +- Fix: Iban was used instead of Bic into SEPA file. +- Fix: Must unaccent strings into SEPA file. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 417f4362000..5c21c3c5fbf 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1219,11 +1219,11 @@ class BonPrelevement extends CommonObject /** - * Generate a withdrawal file. Generation Formats: - * France: CFONB - * Spain: AEB19 (if external module EsAEB is enabled) - * Others: Warning message - * File is generated with name this->filename + * Generate a withdrawal file. + * Generation Formats: + * - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled) + * - Others countries: Warning message + * File is generated with name this->filename * * @return int 0 if OK, <0 if KO */ @@ -1410,7 +1410,7 @@ class BonPrelevement extends CommonObject fputs($this->file, ' '.$CrLf); fputs($this->file, ' '.$CrLf); fputs($this->file, ''.$CrLf); - + $sql = "SELECT pl.amount"; $sql.= " FROM"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; @@ -1419,14 +1419,14 @@ class BonPrelevement extends CommonObject $sql.= " WHERE pl.fk_prelevement_bons = ".$this->id; $sql.= " AND pl.rowid = pf.fk_prelevement_lignes"; $sql.= " AND pf.fk_facture = f.rowid"; - + //Lines $i = 0; $resql=$this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - + while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1574,7 +1574,7 @@ class BonPrelevement extends CommonObject * @param string $row_bic rib.bic AS bic, * @param string $row_datec soc.datec, * @param string $row_drum soc.rowid AS drum - * @return void + * @return string Return string with SEPA part DrctDbtTxInf */ function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { @@ -1598,15 +1598,15 @@ class BonPrelevement extends CommonObject $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.$row_iban.''.$CrLf; + $XML_DEBITOR .=' '.$row_bic.''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; - $XML_DEBITOR .=' '.strtoupper($row_nom).''.$CrLf; + $XML_DEBITOR .=' '.strtoupper(dol_string_unaccent($row_nom)).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$row_country_code.''.$CrLf; $XML_DEBITOR .=' '.strtr($row_adr, array(CHR(13) => ", ", CHR(10) => "")).''.$CrLf; - $XML_DEBITOR .=' '.$row_zip.' '.$row_town.''.$CrLf; + $XML_DEBITOR .=' '.dol_string_unaccent($row_zip.' '.$row_town).''.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; @@ -1689,7 +1689,8 @@ class BonPrelevement extends CommonObject } /** - * Write sender of request (me) + * Write sender of request (me). + * Note: The tag PmtInf is opened here but closed into caller * * @param string $configuration conf * @param date $ladate Date From cd00ec29bf6f307c74d301599f4fcbb3ce757ef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 19:00:28 +0200 Subject: [PATCH 18/27] Fix: Dictionnary with one n Conflicts: htdocs/expedition/fiche.php --- htdocs/expedition/fiche.php | 4 ++-- htdocs/fichinter/fiche.php | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 9a52ce47788..f676c1b2138 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -698,7 +698,7 @@ if ($action == 'create') print '\n"; // Tracking number @@ -1262,7 +1262,7 @@ else if ($id || $ref) print ''; $object->fetch_delivery_methods(); print $form->selectarray("shipping_method_id",$object->meths,$object->shipping_method_id,1,0,0,"",1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''; print ''; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index fcd03755136..bf0583ce0ba 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -63,6 +63,7 @@ $confirm = GETPOST('confirm','alpha'); $mesg = GETPOST('msg','alpha'); $origin=GETPOST('origin','alpha'); $originid=(GETPOST('originid','int')?GETPOST('originid','int'):GETPOST('origin_id','int')); // For backward compatibility +$note_public = GETPOST('note_public'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -919,8 +920,8 @@ if ($action == 'create') $soc = $objectsrc->client; - $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); - $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : GETPOST('note_private'))); + $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : GETPOST('note_public')); // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1,'external',1); @@ -928,8 +929,6 @@ if ($action == 'create') } else { $projectid = GETPOST('projectid','int'); - $note_private = ''; - $note_public = ''; } if (! $conf->global->FICHEINTER_ADDON) @@ -966,7 +965,7 @@ if ($action == 'create') // Description (must be a textarea and not html must be allowed (used in list view) print ''; print ''; // Project From 643fc6c61f8ae7ea4d726be32a2a68ec54f185c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Sep 2014 19:03:48 +0200 Subject: [PATCH 19/27] Fix: Bad use of fetch_lines Conflicts: htdocs/comm/propal.php htdocs/contrat/fiche.php htdocs/opensurvey/class/opensurveysondage.class.php --- htdocs/commande/fiche.php | 17 +++++++---- htdocs/commande/orderstoinvoice.php | 10 +++++-- htdocs/compta/facture.php | 6 +++- htdocs/contrat/fiche.php | 28 +++++++++++-------- htdocs/expedition/fiche.php | 2 -- htdocs/fichinter/class/fichinter.class.php | 4 +-- htdocs/fichinter/fiche.php | 12 ++++++-- htdocs/fourn/facture/fiche.php | 6 +++- htdocs/livraison/class/livraison.class.php | 2 +- htdocs/livraison/fiche.php | 11 ++++---- .../class/opensurveysondage.class.php | 4 +-- htdocs/opensurvey/public/studs.php | 2 +- htdocs/opensurvey/results.php | 2 +- 13 files changed, 68 insertions(+), 38 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8f6df313506..25c8d068ae1 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -269,10 +269,12 @@ else if ($action == 'add' && $user->rights->commande->creer) { if ($ret < 0) $error ++; - if (! $error) { + if (! $error) + { $object_id = $object->create($user); - if ($object_id > 0) { + if ($object_id > 0) + { dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); $classname = ucfirst($subelement); @@ -280,15 +282,20 @@ else if ($action == 'add' && $user->rights->commande->creer) { 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) { + if ($result > 0) + { $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject, 'fetch_lines')) - $lines = $srcobject->fetch_lines(); + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line = 0; $num = count($lines); - for($i = 0; $i < $num; $i ++) { + for($i = 0; $i < $num; $i ++) + { $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); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bdb96718dfa..5332690e40b 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -97,7 +97,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - + $langs->load('bills'); $langs->load('products'); $langs->load('main'); @@ -213,13 +213,17 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $result=$objectsrc->fetch($orders_id[$ii]); if ($result > 0) { - if ($closeOrders) + if ($closeOrders) { $objectsrc->classifyBilled(); $objectsrc->setStatut(3); } $lines = $objectsrc->lines; - if (empty($lines) && method_exists($objectsrc,'fetch_lines')) $lines = $objectsrc->fetch_lines(); + if (empty($lines) && method_exists($objectsrc, 'fetch_lines')) + { + $objectsrc->fetch_lines(); + $lines = $objectsrc->lines; + } $fk_parent_line=0; $num=count($lines); for ($i=0;$i<$num;$i++) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8138c56450e..0e237af632c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -924,7 +924,11 @@ else if ($action == 'add' && $user->rights->facture->creer) if ($result > 0) { $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject, 'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject, 'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 7bcd7fcbc8d..38a2b3f1095 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -250,7 +250,11 @@ if ($action == 'add' && $user->rights->contrat->creer) { $srcobject->fetch_thirdparty(); $lines = $srcobject->lines; - if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + if (empty($lines) && method_exists($srcobject,'fetch_lines')) + { + $srcobject->fetch_lines(); + $lines = $srcobject->lines; + } $fk_parent_line=0; $num=count($lines); @@ -337,10 +341,10 @@ if ($action == 'add' && $user->rights->contrat->creer) } else { - + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - + $result = $object->create($user); if ($result > 0) { @@ -715,7 +719,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra $error ++; if (! $error) { - + $result = $object->insertExtraFields(); if ($result < 0) { $error ++; @@ -948,7 +952,7 @@ if ($action == 'create') // Other attributes $parameters=array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + // Other attributes if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields, 'edit'); @@ -1112,7 +1116,7 @@ else // Other attributes $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + $res = $object->fetch_optionals($object->id, $extralabels); if (empty($reshook) && ! empty($extrafields->attribute_label)) { foreach ($extrafields->attribute_label as $key => $label) { @@ -1132,16 +1136,16 @@ else if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) { $value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]); } - + if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) { print '
'; print ''; print ''; print ''; print ''; - + print $extrafields->showInputField($key, $value); - + print ''; print ''; } else { @@ -1153,9 +1157,9 @@ else } } } - - - + + + print "
' . dol_print_date(dol_now(), "dayhour", "tzuser") . ''; + print ''; print ''; print ''; print '' . dol_print_date($link->datea, "dayhour", "tzuser") . ''; + print ''; print '' . img_edit() . ''; // id= is included into $param if ($permtodelete) { print '   ' . img_delete() . ''; // id= is included into $param @@ -1176,7 +1176,7 @@ class FormFile } if ($nboflinks == 0) { - print '
'; + print '
'; print $langs->trans("NoLinkFound"); print '
'; $expe->fetch_delivery_methods(); print $form->selectarray("shipping_method_id",$expe->meths,GETPOST('shipping_method_id','int'),1,0,0,"",1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print "
'.$langs->trans("Description").''; - print ''; + print ''; print '
"; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index f676c1b2138..c11c1d549a9 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -112,7 +112,6 @@ if ($action == 'add') $classname = ucfirst($object->origin); $objectsrc = new $classname($db); $objectsrc->fetch($object->origin_id); - //$object->fetch_lines(); $object->socid = $objectsrc->socid; $object->ref_customer = $objectsrc->ref_client; @@ -717,7 +716,6 @@ if ($action == 'create') * Lignes de commandes */ - //$lines = $object->fetch_lines(1); $numAsked = count($object->lines); print '