From 307c06dfc36c50cf2e9d9e7cf2d923f55013dcb3 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 12 Jan 2017 16:26:09 +0100 Subject: [PATCH 01/15] FIX : pdf invoice when we use situation --- .../modules/facture/doc/pdf_crabe.modules.php | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index d50ddcfb2a0..042e22791a2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -129,7 +129,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty=145; } $this->posxdiscount=162; - $this->posxprogress=174; // Only displayed for situation invoices + $this->posxprogress=132; // Only displayed for situation invoices $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images @@ -317,8 +317,11 @@ class pdf_crabe extends ModelePDFFactures $this->posxtva -= $progress_width; $this->posxup -= $progress_width; $this->posxqty -= $progress_width; - $this->posxdiscount -= $progress_width; - $this->posxprogress -= $progress_width; + if(empty($conf->global->PRODUCT_USE_UNITS)) { + $this->posxprogress += $progress_width; + } + /*$this->posxdiscount -= $progress_width; + $this->posxprogress -= $progress_width;*/ } // New page @@ -513,6 +516,14 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R'); } + // Situation progress + if ($this->situationinvoice) + { + $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxprogress, $curY); + $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + } + // Unit if($conf->global->PRODUCT_USE_UNITS) { @@ -526,15 +537,7 @@ class pdf_crabe extends ModelePDFFactures { $pdf->SetXY($this->posxdiscount-2, $curY); $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); - $pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); - } - - // Situation progress - if ($this->situationinvoice) - { - $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); - $pdf->SetXY($this->posxprogress, $curY); - $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); } // Total HT line @@ -1376,7 +1379,12 @@ class pdf_crabe extends ModelePDFFactures if (empty($hidetop)) { $pdf->SetXY($this->posxqty-1, $tab_top+1); - if($conf->global->PRODUCT_USE_UNITS) + + if($this->situationinvoice) + { + $pdf->MultiCell($this->posxprogress-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); + } + else if($conf->global->PRODUCT_USE_UNITS) { $pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } @@ -1385,6 +1393,23 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); } } + + if ($this->situationinvoice) { + $pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height); + $pdf->SetXY($this->posxprogress, $tab_top+1); + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + } + } if($conf->global->PRODUCT_USE_UNITS) { $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); From 1886e68731e9737d0ce5ef25e36585aced5003be Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 12 Jan 2017 17:07:22 +0100 Subject: [PATCH 02/15] FIX : progress size --- .../modules/facture/doc/pdf_crabe.modules.php | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 042e22791a2..662c06cb4dc 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -129,7 +129,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty=145; } $this->posxdiscount=162; - $this->posxprogress=132; // Only displayed for situation invoices + $this->posxprogress=126; // Only displayed for situation invoices $this->postotalht=174; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images @@ -313,7 +313,7 @@ class pdf_crabe extends ModelePDFFactures if ($object->situation_cycle_ref) { $this->situationinvoice = True; - $progress_width = 14; + $progress_width = 18; $this->posxtva -= $progress_width; $this->posxup -= $progress_width; $this->posxqty -= $progress_width; @@ -443,7 +443,7 @@ class pdf_crabe extends ModelePDFFactures $curX = $this->posxdesc-1; $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX-$progress_width,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -507,7 +507,12 @@ class pdf_crabe extends ModelePDFFactures $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxqty, $curY); // Enough for 6 chars - if($conf->global->PRODUCT_USE_UNITS) + + if ($this->situationinvoice) + { + $pdf->MultiCell($this->posxprogress-$this->posxqty-0.8, 4, $qty, 0, 'R'); + } + else if($conf->global->PRODUCT_USE_UNITS) { $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); } @@ -521,7 +526,18 @@ class pdf_crabe extends ModelePDFFactures { $progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxprogress, $curY); - $pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R'); + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress-1, 3, $progress, 0, 'R'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress-1, 3, $progress, 0, 'R'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R'); + } } // Unit @@ -1399,15 +1415,15 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->posxprogress, $tab_top+1); if($conf->global->PRODUCT_USE_UNITS) { - $pdf->MultiCell($this->posxunit-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } else if ($this->atleastonediscount) { - $pdf->MultiCell($this->posxdiscount-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } else { - $pdf->MultiCell($this->postotalht-$this->posxprogress+1,2, $outputlangs->transnoentities("ProgressShort"),'','C'); + $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); } } From a90ec7a8c736a3b330c01a253e132453c3e321d2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 13 Jan 2017 14:59:29 +0100 Subject: [PATCH 03/15] FIX : hidetop progression --- .../modules/facture/doc/pdf_crabe.modules.php | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 662c06cb4dc..0fbbd82e11a 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1412,19 +1412,26 @@ class pdf_crabe extends ModelePDFFactures if ($this->situationinvoice) { $pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height); - $pdf->SetXY($this->posxprogress, $tab_top+1); - if($conf->global->PRODUCT_USE_UNITS) - { - $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); - } - else if ($this->atleastonediscount) - { - $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); - } - else - { - $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + + if (empty($hidetop)) { + + $pdf->SetXY($this->posxprogress, $tab_top+1); + + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + else if ($this->atleastonediscount) + { + $pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + else + { + $pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C'); + } + } + } if($conf->global->PRODUCT_USE_UNITS) { From 487b5b25dbf9457228e1ad55c737de9dd927714f Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 13 Jan 2017 15:37:33 +0100 Subject: [PATCH 04/15] FIX: extrafield input for varchar was not working with special char within (ie double quotes) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 496a8f2e251..63621d56a82 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -763,7 +763,7 @@ class ExtraFields } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { From 55c0a99bce46ae767e86069cc7823b307f0f1654 Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 13 Jan 2017 15:42:07 +0100 Subject: [PATCH 05/15] fix was not at the right place --- htdocs/core/class/extrafields.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 63621d56a82..cc6b61b236e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -739,7 +739,7 @@ class ExtraFields } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -763,7 +763,7 @@ class ExtraFields } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { From 3dd160c6635ebd7eb69bf9defc194eb442229db6 Mon Sep 17 00:00:00 2001 From: altatof Date: Mon, 16 Jan 2017 09:17:37 +0100 Subject: [PATCH 06/15] use dol_escape_htmltag --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index cc6b61b236e..0c9e4f3226e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -739,7 +739,7 @@ class ExtraFields } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { From 9c60474953b5aa0d393d4d93d1fb3abafcf405d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 11:06:17 +0100 Subject: [PATCH 07/15] FIX #6277 --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 51b6aa48e84..960c0db42c4 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -314,7 +314,7 @@ if ($id > 0 || ! empty($ref)) if ($commande->methode_commande) { - print ''.$langs->trans("Method").''.$commande->methode_commande.''; + print ''.$langs->trans("Method").''.$commande->getInputMethod().''; } } From fdbe4051f135d5cda58314721a1c8d5774f45d99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 12:54:51 +0100 Subject: [PATCH 08/15] FIX #6230 --- htdocs/user/class/user.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fb27aef9d2e..cd0000c1e60 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1050,7 +1050,8 @@ class User extends CommonObject $this->town = $contact->town; $this->state_id = $contact->state_id; $this->country_id = $contact->country_id; - + $this->employee = 0; + if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; From d21bb1e6b1ebea6efa3f9460ee908441440b792f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Jan 2017 13:10:54 +0100 Subject: [PATCH 09/15] FIX #6237 --- htdocs/fichinter/card.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 290f650faa1..d81f25b0c71 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -583,7 +583,7 @@ if (empty($reshook)) } } - // Classify Billed + // Classify unbilled else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) { $result=$object->setStatut(1); @@ -598,6 +598,21 @@ if (empty($reshook)) } } + // Classify Done + else if ($action == 'classifydone' && $user->rights->ficheinter->creer) + { + $result=$object->setStatut(3); + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + /* * Mise a jour d'une ligne d'intervention */ From a944c82d86a54c3f217910e21b65ff6a6a105313 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 19 Jan 2017 09:11:06 +0100 Subject: [PATCH 10/15] FIX : $progress_width initialized --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0fbbd82e11a..d31761b3a42 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -309,6 +309,7 @@ class pdf_crabe extends ModelePDFFactures //$this->postotalht; } + $progress_width = 0; // Situation invoice handling if ($object->situation_cycle_ref) { From 2cedcfece2c3a9f41c5385176e6e66d72969dd55 Mon Sep 17 00:00:00 2001 From: arnaud Date: Fri, 20 Jan 2017 12:01:20 +0100 Subject: [PATCH 11/15] FIX bug margin calcul by user with multicompany --- htdocs/margin/agentMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f9189ed7e97..d023720a875 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -126,6 +126,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if (! empty($conf->global->AGENT_CONTACT_TYPE)) From ac321617117bca763305e4e18f32072d525ca940 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jan 2017 14:35:18 +0100 Subject: [PATCH 12/15] Fix error in total of tasks --- htdocs/core/lib/date.lib.php | 2 +- htdocs/projet/tasks/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index cd897071551..202a598d8ae 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -171,7 +171,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') { - if ($iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US + if ((int) $iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US $sTime=''; $sDay=0; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index e1da8444319..74f9b122f14 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -816,7 +816,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota } elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''.convertSecondToTime($totalarray['totalplannedworkload'],$plannedworkloadoutputformat).''; elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''.convertSecondToTime($totalarray['totaldurationeffective'],$timespentoutputformat).''; - elseif ($totalarray['totalprogress_calculated'] == $i) print ''.($totalarray['totaldurationeffective'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; + elseif ($totalarray['totalprogress_calculated'] == $i) print ''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; else print ''; } print ''; From 5715233fb02eac74b4bad44f6a4debc8025ef8d8 Mon Sep 17 00:00:00 2001 From: Speed Date: Wed, 18 Jan 2017 19:38:50 +0100 Subject: [PATCH 13/15] Updated script sync members from LDAP Replace "Cotisation" class with its new name "Subscription" --- scripts/members/sync_members_ldap2dolibarr.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 2319a10a0fd..e7adb80e733 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -38,7 +38,7 @@ require_once($path."../../htdocs/master.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); -require_once(DOL_DOCUMENT_ROOT."/adherents/class/cotisation.class.php"); +require_once(DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php"); $langs->load("main"); $langs->load("errors"); @@ -291,7 +291,7 @@ if ($result >= 0) { // Cree premiere cotisation et met a jour datefin dans adherent //print "xx".$datefirst."\n"; - $crowid=$member->cotisation($datefirst, $pricefirst, 0); + $crowid=$member->subscription($datefirst, $pricefirst, 0); } // Insert last subscription @@ -299,7 +299,7 @@ if ($result >= 0) { // Cree derniere cotisation et met a jour datefin dans adherent //print "yy".dol_print_date($datelast)."\n"; - $crowid=$member->cotisation($datelast, $pricelast, 0); + $crowid=$member->subscription($datelast, $pricelast, 0); } } From f23f2e61f579d1f3cedcb1628c39723be5154e31 Mon Sep 17 00:00:00 2001 From: Ion Date: Fri, 20 Jan 2017 11:27:11 +0100 Subject: [PATCH 14/15] Fix #6161 supplier order to facture not working --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e1e96cddc9c..2d24bd2ab0f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -64,7 +64,7 @@ $cancel = GETPOST('cancel','alpha'); $lineid = GETPOST('lineid', 'int'); $projectid = GETPOST('projectid','int'); $origin = GETPOST('origin', 'alpha'); -$originid = GETPOST('origin', 'int'); +$originid = GETPOST('originid', 'int'); //PDF $hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); From 1add34b451bece75bdb3164d0ec2a7c3e2f34d34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Jan 2017 21:05:20 +0100 Subject: [PATCH 15/15] Fix multicompany --- htdocs/margin/agentMargins.php | 4 ++-- htdocs/margin/customerMargins.php | 2 +- htdocs/margin/productMargins.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 23e49db7511..61cee328b41 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -129,7 +129,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; -$sql.= " AND f.entity = ".$conf->entity; +$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')'; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if (! empty($conf->global->AGENT_CONTACT_TYPE)) @@ -137,7 +137,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE)) else $sql .= " AND sc.fk_user = u.rowid"; $sql.= " AND f.fk_statut > 0"; -$sql.= " AND s.entity = ".$conf->entity; +$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; $sql.= " AND d.fk_facture = f.rowid"; if ($agentid > 0) { if (! empty($conf->global->AGENT_CONTACT_TYPE)) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index ec30f23ee98..8b960a150a4 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -180,7 +180,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; -$sql.= " AND s.entity = ".$conf->entity; +$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if ($client) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index eb2a2e6d2ee..dcf80e9a49c 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -175,8 +175,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product"; -$sql.= " WHERE f.entity = ".$conf->entity; -$sql.= " AND f.fk_soc = s.rowid"; +$sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')'; $sql.= " AND f.fk_statut > 0"; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0)