From eb9d26a9e0fa38673db05beced0b1485875067cb Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 27 Jun 2016 11:36:13 +0200 Subject: [PATCH 01/16] FIX #5383 bad object id on don delete --- htdocs/don/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index b56171b8796..cc27b1bcfd1 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -740,9 +740,9 @@ if (! empty($id) && $action != 'edit') // Delete if ($user->rights->don->supprimer) { - if ($don->statut == -1 || $don->statut == 0) + if ($object->statut == -1 || $object->statut == 0) { - print '
'.$langs->trans("Delete")."
"; + print '
'.$langs->trans("Delete")."
"; } else { From d9035e53089f4cc2599f54a7852daf3c657d67dd Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 28 Jun 2016 11:41:23 +0200 Subject: [PATCH 02/16] 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 1c0c589870e..f95fd5dbe76 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 7e8506e25ff3579cd54bb360ff52114a1726899e Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 28 Jun 2016 13:25:47 +0200 Subject: [PATCH 03/16] FIX #5338 use of not initialized var $aphour, $apmin, etc --- htdocs/comm/action/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 5b013e7a57c..e54fd788a92 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -61,8 +61,14 @@ $originid=GETPOST('originid','int'); $confirm = GETPOST('confirm', 'alpha'); $fulldayevent=GETPOST('fullday'); -$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); -$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); + +$aphour = GETPOST('aphour'); +$apmin = GETPOST('apmin'); +$p2hour = GETPOST('p2hour'); +$p2min = GETPOST('p2min'); + +$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); +$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year")); // Security check $socid = GETPOST('socid','int'); @@ -92,7 +98,6 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('actioncard','globalcard')); - /* * Actions */ 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 04/16] 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 93f9b243624..eef29d2edc3 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -341,7 +341,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $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 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $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 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $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 05/16] 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 48dc7a3ebf2..3faedf4b601 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 @@ class FormFile 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 06/16] 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 02fa370fc13..7fc6be32725 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -53,7 +53,7 @@ $projectstatic = new Project($db); * Actions */ -if ($action == 'addtimespent' && $user->rights->projet->creer) +if ($action == 'addtimespent' && $user->rights->projet->lire) { $error=0; From 22bc44620b8f2733009867e6a6ca6c9065b5dbc6 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 30 Jun 2016 14:27:58 +0200 Subject: [PATCH 07/16] FIX #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option --- htdocs/core/lib/pdf.lib.php | 14 ++++++++++---- .../core/modules/facture/doc/pdf_crabe.modules.php | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6389c71b06c..9fe2bbb1b40 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1342,7 +1342,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line))) { @@ -1355,7 +1358,7 @@ function pdf_getlineupwithtax($object,$i,$outputlangs,$hidedetails=0) } else { - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + if (empty($hidedetails) || $hidedetails > 1) return price($sign * (($object->lines[$i]->subprice) + ($object->lines[$i]->subprice)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs); } } @@ -1629,7 +1632,10 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) */ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) { - global $hookmanager; + global $hookmanager,$conf; + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if ($object->lines[$i]->special_code == 3) { @@ -1648,7 +1654,7 @@ function pdf_getlinetotalwithtax($object,$i,$outputlangs,$hidedetails=0) } else { - if (empty($hidedetails) || $hidedetails > 1) return price(($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100, 0, $outputlangs); + if (empty($hidedetails) || $hidedetails > 1) return price($sign * (($object->lines[$i]->total_ht) + ($object->lines[$i]->total_ht)*($object->lines[$i]->tva_tx)/100), 0, $outputlangs); } } return ''; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 719449bcbd4..33febb9028b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -539,13 +539,16 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + + $sign=1; + if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress(); if ($prev_progress > 0) // Compute progress from previous situation { - $tvaligne = $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; + $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { - $tvaligne = $object->lines[$i]->total_tva; + $tvaligne = $sign * $object->lines[$i]->total_tva; } $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; From 97fe75f198de42b116db78a0ecb21f281eca7bfc Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 14:57:23 +0200 Subject: [PATCH 08/16] 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 e07e13ef751..ea2cb899893 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -280,43 +280,45 @@ if ($type_element == 'contract') $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.=")"; + } + $sql.= $db->order($sortfield,$sortorder); + + $resql=$db->query($sql); + $totalnboflines = $db->num_rows($resql); + + $sql.= $db->plimit($limit + 1, $offset); } -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); //print $sql; // Define type of elements From 02169478d03e86ae3b8ec1c57373b30376cb5d37 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Thu, 30 Jun 2016 15:30:07 +0200 Subject: [PATCH 09/16] FIX #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines --- htdocs/expedition/class/expedition.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1b7fbefb8a6..a15c3b53b83 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1266,7 +1266,7 @@ class Expedition extends CommonObject $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; - $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; + $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; @@ -1336,6 +1336,8 @@ class Expedition extends CommonObject $line->volume = $obj->volume; $line->volume_units = $obj->volume_units; + $line->pa_ht = $obj->pa_ht; + // For invoicing $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) From 0ffe106e2cdb7cfa5213a93a12baf3fc89026267 Mon Sep 17 00:00:00 2001 From: arnaud Date: Thu, 30 Jun 2016 16:03:48 +0200 Subject: [PATCH 10/16] 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 68ef0a42e32..61941a4cefb 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -36,10 +36,10 @@ $id=GETPOST('account'); $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 @@ $linkback = ''.$langs->trans("B // Ref print ''.$langs->trans("Ref").''; print ''; -if ($_GET["account"]) +if (!empty($id)) { if (! preg_match('/,/', $id)) { From 75bb16193089d141c71a96d0db24fb95364545ec Mon Sep 17 00:00:00 2001 From: atm-geoffrey Date: Thu, 30 Jun 2016 16:20:53 +0200 Subject: [PATCH 11/16] FIX #4828 --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 123189bdc87..a78eac54695 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -781,7 +781,7 @@ if ($action == 'create') print ''.$langs->trans("Project").''; - $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); + $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) { print '   '.$langs->trans("AddProject").''; From aa67a29115817036fcc9016b0641f7f984e82202 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 30 Jun 2016 16:40:38 +0200 Subject: [PATCH 12/16] 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 30c795bbd72..437be45c7b2 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -142,8 +142,7 @@ class UserBankAccount extends Account $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 13/16] 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 5188003c115..956d4b52452 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -407,6 +407,18 @@ if ($object->id > 0) } // 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 ($object->id > 0) if ($resql) { $i = 0 ; - $num = $db->num_rows($resql); if ($num > 0) { @@ -433,7 +444,7 @@ if ($object->id > 0) } $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 14/16] 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 610fe257732..8fd5450d66a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -918,7 +918,10 @@ class BonPrelevement extends CommonObject $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 @@ class BonPrelevement extends CommonObject { $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 @@ class BonPrelevement extends CommonObject // 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); } /* From 102179028c6db5db2ee3277ad6e04e0954389e1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 03:11:41 +0200 Subject: [PATCH 15/16] FIX #5414 --- htdocs/langs/en_US/admin.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index af3373bf4aa..d5086ca1343 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -564,6 +564,8 @@ Module59000Name=Margins Module59000Desc=Module to manage margins Module60000Name=Commissions Module60000Desc=Module to manage commissions +Module63000Name=Resources +Module63000Desc=Manage resources (printers, cars, room, ...) you can then share into events Permission11=Read customer invoices Permission12=Create/modify customer invoices Permission13=Unvalidate customer invoices From 2c5e1c17fe4407cb2abae27fcc68900368569614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Jul 2016 03:42:19 +0200 Subject: [PATCH 16/16] Fix hard coded table prefix --- htdocs/societe/class/societe.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 0e7e375ac2f..e9b77836d3c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3483,17 +3483,17 @@ class Societe extends CommonObject * Because this function is meant to be executed within a transaction, we won't take care of it. */ $sql = 'SELECT rowid -FROM llx_societe_commerciaux +FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( SELECT fk_user - FROM llx_societe_commerciaux + FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE fk_soc = '.(int) $origin_id.' );'; $query = $db->query($sql); while ($result = $db->fetch_object($query)) { - $db->query('DELETE FROM llx_societe_commerciaux WHERE rowid = '.$result->rowid); + $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.$result->rowid); } /**