From 0a5ded20a34f8d88769f9ae1f88d191e5f17b66a Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Fri, 24 Jun 2016 15:27:47 +0200 Subject: [PATCH 01/12] FIX extrafield cloned on project clone --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 7f8aa6252e852..91a75f80ce1ba 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1121,6 +1121,7 @@ function createFromClone($fromid,$clone_contact=false,$clone_task=true,$clone_pr // Load source object $clone_project->fetch($fromid); + $clone_project->fetch_optionals(); $clone_project->fetch_thirdparty(); $orign_dt_start=$clone_project->date_start; From 321ccce438c25c3fe55969a310cd5699053b5233 Mon Sep 17 00:00:00 2001 From: "geoffrey.girard" Date: Fri, 24 Jun 2016 15:57:08 +0200 Subject: [PATCH 02/12] Fix PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS on project edit view --- htdocs/projet/card.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index af4a4c7299fca..5dc8d8e03b455 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -635,8 +635,12 @@ $filteronlist=''; if (! empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) $filteronlist=$conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; $text=$form->select_thirdparty_list($object->thirdparty->id, 'socid', $filteronlist, 1, 1); - $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); - print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); + if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) + { + $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); + print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); + } + else print $text; print ''; // Visibility From 1368e6d462c7191a79977cb88effb22541ae72e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Jun 2016 17:04:59 +0200 Subject: [PATCH 03/12] Fix: error message was not enough to understand Conflicts: htdocs/langs/en_US/errors.lang --- htdocs/comm/propal/class/propal.class.php | 3 ++- htdocs/commande/class/commande.class.php | 6 ++++-- htdocs/compta/facture/class/facture.class.php | 6 ++++-- htdocs/expedition/class/expedition.class.php | 6 ++++-- htdocs/langs/en_US/errors.lang | 7 +++++++ 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 112dbf792ff0f..463c81266f8bc 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -429,7 +429,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0 $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_PROPOSAL) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnProposal', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 30d22e7588ea4..9eb67cecc56a8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1242,7 +1242,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); return self::STOCK_NOT_ENOUGH_FOR_ORDER; @@ -2563,7 +2564,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocalt if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnOrder', $product->ref); dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR); $this->db->rollback(); unset($_POST['productid']); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0bb1a4cf189a1..27432d7c39948 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2138,7 +2138,8 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } @@ -2348,7 +2349,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $dat $product_type=$product->type; if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE) && $product_type == 0 && $product->stock_reel < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnInvoice', $product->ref); $this->db->rollback(); return -3; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 143e86330ee6d..1b7fbefb8a693 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -874,7 +874,8 @@ function addline($entrepot_id, $id, $qty,$array_options=0) $product_type=$product->type; if ($product_type == 0 && $product_stock < $qty) { - $this->error=$langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); $this->db->rollback(); return -3; } @@ -930,7 +931,8 @@ function addline_batch($dbatch,$array_options=0) if ($prod_batch->qty < $linebatch->dluo_qty) { - $this->errors[] = $langs->trans('ErrorStockIsNotEnough'); + $langs->load("errors"); + $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); dol_syslog(get_class($this)."::addline_batch error=Product ".$prod_batch->batch.": ".$this->errorsToString(), LOG_ERR); $this->db->rollback(); return -1; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 50fd77a85e797..dc3502e027a0e 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -173,6 +173,13 @@ ErrorOppStatusRequiredIfAmount=You set an estimated amount for this opportunity/ ErrorBadDefinitionOfMenuArrayInModuleDescriptor=Bad Definition Of Menu Array In Module Descriptor (bad value for key fk_menu) ErrorSavingChanges=An error has ocurred when saving the changes ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship +ErrorFileMustHaveFormat=File must have format %s +ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. +ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal. # Warnings WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. From d9035e53089f4cc2599f54a7852daf3c657d67dd Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 28 Jun 2016 11:41:23 +0200 Subject: [PATCH 04/12] FIX : receiving link never works --- htdocs/core/lib/sendings.lib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 1c0c589870e1c..f95fd5dbe76dd 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -302,7 +302,9 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $expedition->id=$objp->sendingid; $expedition->fetchObjectLinked($expedition->id,$expedition->element); //var_dump($expedition->linkedObjects); - $receiving=(! empty($expedition->linkedObjects['delivery'][0])?$expedition->linkedObjects['delivery'][0]:''); + reset($expedition->linkedObjects['delivery']); + $first = key($expedition->linkedObjects['delivery']); + $receiving=(! empty($expedition->linkedObjects['delivery'][$first])?$expedition->linkedObjects['delivery'][$first]:''); if (! empty($receiving)) { From 76a113257e965d154da458444ead0a4c5c3490ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jun 2016 16:16:56 +0200 Subject: [PATCH 05/12] Update index.php --- htdocs/comm/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 93f9b243624e3..eef29d2edc3bf 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -341,7 +341,7 @@ $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1,'customer',16); + print $companystatic->getNomUrl(1,'supplier',16); print ''; print ''.price($obj->total_ttc).''; $i++; @@ -647,7 +647,7 @@ $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; print dol_print_date($db->jdate($obj->dp),'day').''."\n"; @@ -746,7 +746,7 @@ $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas=$obj->canvas; - print $companystatic->getNomUrl(1, 'company', 44); + print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; print dol_print_date($db->jdate($obj->dp),'day').''."\n"; From e4a2b5abb372eeb43a7d46d507344fdd6cea7a5f Mon Sep 17 00:00:00 2001 From: fmarcet Date: Thu, 30 Jun 2016 11:27:29 +0200 Subject: [PATCH 06/12] Fix: Incorrect document link on supplier invoices's list --- htdocs/core/class/html.formfile.class.php | 4 +--- htdocs/fourn/facture/list.php | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 48dc7a3ebf259..3faedf4b601e9 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2016 Ferran Marcet * 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 @@ -716,9 +717,6 @@ function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='') if ($modulepart == 'export') { $relativepath = $file["name"]; } - if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_fournisseur') { - $relativepath = get_exdir($modulesubdir, 2,0,0,null,'invoice_supplier'). $modulesubdir. "/" . $file["name"]; - } // Show file name with link to download $out.= 'getNomUrl(1); $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); - print $formfile->getDocumentsLink('facture_fournisseur', $filename, $filedir); + $subdir = get_exdir($obj->facid,2,0,0,$facturestatic,'invoice_supplier').dol_sanitizeFileName($obj->ref); + print $formfile->getDocumentsLink('facture_fournisseur', $subdir, $filedir); print "\n"; // Ref supplier From c73c1a577adb9d8c6614dc21def9992c0954a72f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 14:24:03 +0200 Subject: [PATCH 07/12] Time spent can be saved with project read right --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 02fa370fc13ea..7fc6be327256f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -53,7 +53,7 @@ * Actions */ -if ($action == 'addtimespent' && $user->rights->projet->creer) +if ($action == 'addtimespent' && $user->rights->projet->lire) { $error=0; From 97fe75f198de42b116db78a0ecb21f281eca7bfc Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 14:57:23 +0200 Subject: [PATCH 08/12] FIX #5004 --- htdocs/societe/consumption.php | 70 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index e07e13ef751ad..ea2cb8998932c 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -280,43 +280,45 @@ $thirdTypeSelect='customer'; } -$sql = $sql_select; -$sql.= ' d.description as description,'; -if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; -if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; -if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; -$sql.= " s.rowid as socid "; -if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; -if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; -$sql.= $where; -if ($month > 0) { - if ($year > 0) { - $start = dol_mktime(0, 0, 0, $month, 1, $year); - $end = dol_time_plus_duree($start,1,'m') - 1; +if(!empty($sql_select)) { + $sql = $sql_select; + $sql.= ' d.description as description,'; + if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; + if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; + $sql.= " s.rowid as socid "; + if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; + if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; + $sql.= $where; + if ($month > 0) { + if ($year > 0) { + $start = dol_mktime(0, 0, 0, $month, 1, $year); + $end = dol_time_plus_duree($start,1,'m') - 1; + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; + } else { + $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; + } + } else if ($year > 0) { + $start = dol_mktime(0, 0, 0, 1, 1, $year); + $end = dol_time_plus_duree($start,1,'y') - 1; $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; - } else { - $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; } -} else if ($year > 0) { - $start = dol_mktime(0, 0, 0, 1, 1, $year); - $end = dol_time_plus_duree($start,1,'y') - 1; - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; -} -if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; -if ($sprod_fulldescr) -{ - $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; - $sql.=")"; + if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; + if ($sprod_fulldescr) + { + $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; + $sql.=")"; + } + $sql.= $db->order($sortfield,$sortorder); + + $resql=$db->query($sql); + $totalnboflines = $db->num_rows($resql); + + $sql.= $db->plimit($limit + 1, $offset); } -$sql.= $db->order($sortfield,$sortorder); - -$resql=$db->query($sql); -$totalnboflines = $db->num_rows($resql); - -$sql.= $db->plimit($limit + 1, $offset); //print $sql; // Define type of elements From 0ffe106e2cdb7cfa5213a93a12baf3fc89026267 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 16:03:48 +0200 Subject: [PATCH 09/12] FIX #4749 --- htdocs/compta/bank/annuel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 68ef0a42e32aa..61941a4cefb7b 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -36,10 +36,10 @@ $ref=GETPOST('ref'); // Security check -$fieldid = (! empty($ref)?$ref:$id); -$fieldname = isset($ref)?'ref':'rowid'; +$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); +$fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$fieldid,'bank_account','','',$fieldname); +$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); $year_start=GETPOST('year_start'); $year_current = strftime("%Y",time()); @@ -146,7 +146,7 @@ // Ref print ''.$langs->trans("Ref").''; print ''; -if ($_GET["account"]) +if (!empty($id)) { if (! preg_match('/,/', $id)) { From aa67a29115817036fcc9016b0641f7f984e82202 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 16:40:38 +0200 Subject: [PATCH 10/12] FIX #4383 $userid not defined --- htdocs/user/class/userbankaccount.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 30c795bbd723a..437be45c7b2ae 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -142,8 +142,7 @@ function fetch($id) $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; $sql.= " owner_address, label, datec, tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rib"; - if ($id) $sql.= " WHERE rowid = ".$id; - if ($socid) $sql.= " WHERE fk_user = ".$userid; + $sql.= " WHERE rowid = ".$id; $resql = $this->db->query($sql); if ($resql) From 38dcb0de4988a9a632db69b1f96278983615f042 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 16:53:24 +0200 Subject: [PATCH 11/12] FIX #4455 --- htdocs/fourn/card.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 5188003c1150d..956d4b5245203 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -407,6 +407,18 @@ } // TODO move to DAO class + $sql = "SELECT count(p.rowid) as total"; + $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; + $sql.= " WHERE p.fk_soc =".$object->id; + $sql.= " AND p.entity =".$conf->entity; + $sql.= " ORDER BY p.date_commande DESC"; + $resql=$db->query($sql); + if ($resql) + { + $object_count = $db->fetch_object($resql); + $num = $object_count->total; + } + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; @@ -417,7 +429,6 @@ if ($resql) { $i = 0 ; - $num = $db->num_rows($resql); if ($num > 0) { @@ -433,7 +444,7 @@ } $var = True; - while ($i < $num && $i <= $MAXLIST) + while ($i < $num && $i < $MAXLIST) { $obj = $db->fetch_object($resql); $var=!$var; From d004f3a538c6a0907ea75cb2e07671f47a775bc9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 17:03:56 +0200 Subject: [PATCH 12/12] FIX #4448 $filebonprev is not used, $this->filename now --- .../compta/prelevement/class/bonprelevement.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 610fe25773205..8fd5450d66a49 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -918,7 +918,10 @@ function Create($banque=0, $agence=0, $mode='real') $row = $this->db->fetch_row($resql); $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0])+1,0,2),2,"0",STR_PAD_LEFT); - $this->filename = $conf->prelevement->dir_output.'/receipts/'.$ref.'.xml'; + $dir=$conf->prelevement->dir_output.'/receipts'; + if (! is_dir($dir)) dol_mkdir($dir); + + $this->filename = $dir.'/receipts/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; @@ -934,10 +937,6 @@ function Create($banque=0, $agence=0, $mode='real') { $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $this->id = $prev_id; - - $dir=$conf->prelevement->dir_output.'/receipts'; - $file=$filebonprev; - if (! is_dir($dir)) dol_mkdir($dir); } else { @@ -1033,7 +1032,7 @@ function Create($banque=0, $agence=0, $mode='real') // Generation of SEPA file $this->generate(); } - dol_syslog(__METHOD__."::End withdraw receipt, file ".$filebonprev, LOG_DEBUG); + dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } /*