From 568d5cb5ba8f2eddc729a4b6d362f24fe6fcf1eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Jan 2015 18:47:47 +0100 Subject: [PATCH 01/23] Fixed: Tracking number restored on PDF shipments Fixed: Translation Conflicts: htdocs/langs/en_US/agenda.lang --- ChangeLog | 1 + .../modules/expedition/doc/pdf_merou.modules.php | 16 ++++++++-------- .../expedition/doc/pdf_rouget.modules.php | 14 ++++++++++---- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/langs/en_US/admin.lang | 4 ++-- htdocs/langs/en_US/agenda.lang | 4 ++-- htdocs/langs/en_US/sendings.lang | 8 ++++---- htdocs/langs/en_US/stocks.lang | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2643b444876..ace6a13363d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1783 ] SQL error when enabling 3rd party module with PostgreSQL and MySQL strict mode ON - Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount - Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme +- Fix: Tracking number not visible on shipment pdf ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index cc9d884a831..8fab26f211c 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -534,13 +534,18 @@ class pdf_merou extends ModelePdfExpedition // Date Expedition $Yoff = $Yoff+7; - $pdf->SetXY($blSocX-80,$blSocY+20); + $pdf->SetXY($blSocX-80,$blSocY+17); $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetTextColor(0,0,0); $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L'); + $pdf->SetXY($blSocX-80,$blSocY+20); + $pdf->SetFont('','B', $default_font_size - 2); + $pdf->SetTextColor(0,0,0); + $pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, '', 'L'); + // Deliverer - $pdf->SetXY($blSocX-80,$blSocY+23); + $pdf->SetXY($blSocX-80,$blSocY+24); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetTextColor(0,0,0); @@ -554,13 +559,8 @@ class pdf_merou extends ModelePdfExpedition // Get code using getLabelFromKey $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code'); $label=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; + $pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L'); } - else - { - $label=$outputlangs->transnoentities("Deliverer"); - } - - $pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L'); } } else diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index eedc4b91827..12fd723bf9b 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -180,11 +180,17 @@ class pdf_rouget extends ModelePdfExpedition $tab_height = 130; $tab_height_newpage = 150; - if (! empty($object->note_public) || (! empty($object->tracking_number) && ! empty($object->shipping_method_id))) + if (! empty($object->note_public) || ! empty($object->tracking_number)) { $tab_top = 88; $tab_top_alt = $tab_top; + $pdf->SetFont('','B', $default_font_size - 2); + $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top-1, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, 0, 1, false, true, 'L'); + + $tab_top_alt = $pdf->GetY(); + //$tab_top_alt += 1; + // Tracking number if (! empty($object->tracking_number)) { @@ -198,14 +204,14 @@ class pdf_rouget extends ModelePdfExpedition $label=$outputlangs->trans("LinkToTrackYourPackage")."
"; $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; $pdf->SetFont('','B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 7, $this->posxdesc-1, $tab_top-1, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top+6, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); - $tab_top_alt += 7; + $tab_top_alt = $pdf->GetY(); } } } - // Affiche notes + // Notes if (! empty($object->note_public)) { $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1045bed42be..e120ce24a40 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1494,7 +1494,7 @@ class Expedition extends CommonObject } /** - * Get tracking url status + * Forge an set tracking url * * @param string $value Value * @return void diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2aa09fd867d..57d496bd0f4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1374,9 +1374,9 @@ ListOfAvailableNotifications=List of available notifications (This list depends SendingsSetup=Sending module setup SendingsReceiptModel=Sending receipt model SendingsNumberingModules=Sendings numbering modules -SendingsAbility=Support sendings sheets for customer deliveries +SendingsAbility=Support shipment sheets for customer deliveries NoNeedForDeliveryReceipts=In most cases, sendings receipts are used both as sheets for customer deliveries (list of products to send) and sheets that is recevied and signed by customer. So product deliveries receipts is a duplicated feature and is rarely activated. -FreeLegalTextOnShippings=Free text on shippings +FreeLegalTextOnShippings=Free text on shipments ##### Deliveries ##### DeliveryOrderNumberingModules=Products deliveries receipt numbering module DeliveryOrderModel=Products deliveries receipt model diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index 687e3cae146..52b2e8128fd 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -52,8 +52,8 @@ OrderSentByEMail=Customer order %s sent by EMail InvoiceSentByEMail=Customer invoice %s sent by EMail SupplierOrderSentByEMail=Supplier order %s sent by EMail SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail -ShippingSentByEMail=Shipping %s sent by EMail -ShippingValidated= Shipping %s validated +ShippingSentByEMail=Shipment %s sent by EMail +ShippingValidated= Shipment %s validated InterventionSentByEMail=Intervention %s sent by EMail NewCompanyToDolibarr= Third party created DateActionPlannedStart= Planned start date diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 039d47f6aa9..861feeaf8d0 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -4,7 +4,7 @@ Sending=Shipment Sendings=Shipments Shipment=Shipment Shipments=Shipments -Receivings=Receivings +Receivings=Receipts SendingsArea=Shipments area ListOfSendings=List of shipments SendingMethod=Shipping method @@ -14,7 +14,7 @@ SearchASending=Search for shipment StatisticsOfSendings=Statistics for shipments NbOfSendings=Number of shipments NumberOfShipmentsByMonth=Number of shipments by month -SendingCard=Shipping card +SendingCard=Shipment card NewSending=New shipment CreateASending=Create a shipment CreateSending=Create shipment @@ -37,7 +37,7 @@ StatusSendingCanceledShort=Canceled StatusSendingDraftShort=Draft StatusSendingValidatedShort=Validated StatusSendingProcessedShort=Processed -SendingSheet=Sending sheet +SendingSheet=Shipment sheet Carriers=Carriers Carrier=Carrier CarriersArea=Carriers area @@ -58,7 +58,7 @@ SendShippingRef=Send shipment %s ActionsOnShipping=Events on shipment LinkToTrackYourPackage=Link to track your package ShipmentCreationIsDoneFromOrder=For the moment, creation of a new shipment is done from the order card. -RelatedShippings=Related shippings +RelatedShippings=Related shipments ShipmentLine=Shipment line CarrierList=List of transporters diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 7a08148c9ce..63c118dd6e2 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -116,7 +116,7 @@ MassMovement=Mass movement MassStockMovement=Mass stock movement SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s". RecordMovement=Record transfert -ReceivingForSameOrder=Receivings for this order +ReceivingForSameOrder=Receipts for this order StockMovementRecorded=Stock movements recorded RuleForStockAvailability=Rules on stock requirements StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice From 11dd32a8fd7d7d29061145203e7a329762d8d051 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 26 Jan 2015 23:37:25 +0100 Subject: [PATCH 02/23] FIXED Import module was not working with multi-company and importing everything in entity 1 --- htdocs/core/modules/import/import_csv.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e83f812e8c4..da8d57395bc 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -607,7 +607,7 @@ class ImportCsv extends ModeleImports //var_dump($objimport->array_import_convertvalue); exit; // Build SQL request - if (empty($tablewithentity[$tablename])) + if (empty($tablewithentity_cache[$tablename])) { $sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key'; if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias]; From 04f83ae4ff9feddbf567dc1c94f41b083ee03cb7 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 28 Jan 2015 16:19:56 +0100 Subject: [PATCH 03/23] FIX: always show fournprice select --- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d48abbc0aa1..3f9bd972122 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -128,7 +128,7 @@ $coldisplay=-1; // We remove first td margin->enabled)) { ?> - + rights->margins->creer) { From 87b75126aa2cbc5bbe5704bd926557aceeac3a7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 16:52:34 +0100 Subject: [PATCH 04/23] Fix missing set into specimen --- htdocs/comm/action/class/actioncomm.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 360f38c3f45..96135cd3569 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1060,6 +1060,7 @@ class ActionComm extends CommonObject $this->datef=$now; $this->author=$user; $this->usermod=$user; + $this->usertodo=$user; $this->fulldayevent=0; $this->punctual=0; $this->percentage=0; From ef354834943a7af57c792a3e7d84cedca88ee8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 1 Feb 2015 12:58:54 +0100 Subject: [PATCH 05/23] Fix: [ bug #1819 ] SQL error when searching for an invoice payment --- ChangeLog | 1 + htdocs/compta/paiement/liste.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ace6a13363d..ab0f89efd60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount - Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme - Fix: Tracking number not visible on shipment pdf +- Fix: [ bug #1819 ] SQL error when searching for an invoice payment ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 6e3e1bc54ff..26f5c6eb5da 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -53,6 +54,8 @@ $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; +$search_ref = GETPOST("search_ref",'int'); +$search_account = GETPOST("search_account",'int'); @@ -109,11 +112,13 @@ else if ($userid == -1) $sql.= " AND f.fk_user_author IS NULL"; else $sql.= " AND f.fk_user_author = ".$userid; } + + // Search criteria - if (GETPOST("search_ref")) $sql .=" AND p.rowid=".GETPOST("search_ref",'int'); - if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int'); - if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'"; - if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount")); + if ($search_ref) $sql .=" AND p.rowid=".$search_ref; + if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; + if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".$db->escape(GETPOST("search_paymenttype"))."'"; + if (GETPOST("search_amount")) $sql .=" AND p.amount='".$db->escape(price2num(GETPOST("search_amount")))."'"; if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company')); } $sql.= $db->order($sortfield,$sortorder); @@ -129,7 +134,7 @@ if ($resql) $paramlist=''; $paramlist.=(GETPOST("orphelins")?"&orphelins=1":""); - $paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:""); + $paramlist.=($search_ref?"&search_ref=".$search_ref:""); $paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:""); $paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:""); @@ -154,7 +159,7 @@ if ($resql) // Lines for filters fields print ''; print ''; - print ''; + print ''; print ''; print ' '; print ''; From 0c6364403850cb293ed92b9e1906a58b2f70862e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 1 Feb 2015 13:26:30 +0100 Subject: [PATCH 06/23] Fix: [ bug #1819 ] SQL error when searching for an invoice payment --- ChangeLog | 1 + htdocs/comm/mailing/fiche.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ace6a13363d..a3b356e2436 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount - Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme - Fix: Tracking number not visible on shipment pdf +- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 6e7546fb70d..97f06b3d9ba 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -188,7 +188,7 @@ if (empty($reshook)) { $now=dol_now(); // Positionne date debut envoi - $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate($now)." WHERE rowid=".$object->id; + $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id; $resql2=$db->query($sql); if (! $resql2) { @@ -284,7 +284,7 @@ if (empty($reshook)) { dol_syslog("comm/mailing/fiche.php: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; - $sql.=" SET statut=1, date_envoi=".$db->idate($now)." WHERE rowid=".$obj->rowid; + $sql.=" SET statut=1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid; $resql2=$db->query($sql); if (! $resql2) { From a9ba2f317986ca4542dbdcdda07504ad0691d98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Mon, 2 Feb 2015 11:48:57 +0100 Subject: [PATCH 07/23] Fix: [ bug #1810 ] [pgsql] Error while upgrading from 3.6 to 3.7 --- htdocs/core/db/pgsql.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 7381fd77b93..58e79da87b9 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Yann Droneaud * Copyright (C) 2012 Florian Henry + * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -255,7 +256,7 @@ class DoliDBPgsql extends DoliDB $newreg3=preg_replace('/ NOT NULL/i','',$newreg3); $newreg3=preg_replace('/ NULL/i','',$newreg3); $newreg3=preg_replace('/ DEFAULT 0/i','',$newreg3); - $newreg3=preg_replace('/ DEFAULT \'[0-9a-zA-Z_@]*\'/i','',$newreg3); + $newreg3=preg_replace('/ DEFAULT \'?[0-9a-zA-Z_@]*\'?/i','',$newreg3); $line.= "ALTER TABLE ".$reg[1]." ALTER COLUMN ".$reg[2]." TYPE ".$newreg3; // TODO Add alter to set default value or null/not null if there is this in $reg[3] } From fb865e818490ba2008d2d44fc1a4a5737e4e5478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 2 Feb 2015 17:08:59 +0100 Subject: [PATCH 08/23] FIXED Removed deprecated forcing SSLv3 for CURL Since the Poodle vulnerability, SSLv3 has been supersedded by TLS. Many services do not offer SSLv3 anymore. CURL has also been patched in PHP so it now auto-negociates the most appropriate protocol. This prevented most API calls from working. --- htdocs/core/lib/geturl.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8a9ac1385be..e4c3625257d 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -52,7 +52,6 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea exit;*/ curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_VERBOSE, 1); - curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3 curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false)); From eb2c5c29b787b8aa9c2a9669006ae83ab0f1f83c Mon Sep 17 00:00:00 2001 From: Arnaud Aujon Chevallier Date: Thu, 5 Feb 2015 13:33:58 +0100 Subject: [PATCH 09/23] FIXES Webservice : fk_delivery_address not saved --- htdocs/webservices/server_order.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index d70725b468f..8cd69b352a7 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -640,6 +640,7 @@ function createOrder($authentication,$order) $newobject->statut=0; // We start with status draft $newobject->facturee=$order['facturee']; $newobject->fk_project=$order['project_id']; + $newObject->fk_delivery_address=$order['fk_delivery_address']; $newobject->cond_reglement_id=$order['cond_reglement_id']; $newobject->demand_reason_id=$order['demand_reason_id']; $newobject->date_creation=$now; From 65efa7ddf76d442264c9aff8c995fecd78a6df00 Mon Sep 17 00:00:00 2001 From: Arnaud Aujon Date: Thu, 5 Feb 2015 12:05:34 +0100 Subject: [PATCH 10/23] FIXED #1824 Add ref_ext for Contact webservices Add possibility to use ref_ext to reference contact using webservice, field was present but not saved and not used to fetch object --- htdocs/contact/class/contact.class.php | 9 +++++++-- htdocs/webservices/server_contact.php | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4187de7136c..a5c3764fd28 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -140,6 +140,7 @@ class Contact extends CommonObject $sql.= ", statut"; $sql.= ", canvas"; $sql.= ", entity"; + $sql.= ",ref_ext"; $sql.= ", import_key"; $sql.= ") VALUES ("; $sql.= "'".$this->db->idate($now)."',"; @@ -152,6 +153,7 @@ class Contact extends CommonObject $sql.= " ".$this->statut.","; $sql.= " ".(! empty($this->canvas)?"'".$this->canvas."'":"null").","; $sql.= " ".$conf->entity.","; + $sql.= "'".$this->db->escape($this->ref_ext)."',"; $sql.= " ".(! empty($this->import_key)?"'".$this->import_key."'":"null"); $sql.= ")"; @@ -496,10 +498,12 @@ class Contact extends CommonObject * * @param int $id id du contact * @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact + * @param string $ref_ext External reference, not given by Dolibarr * @return int -1 if KO, 0 if OK but not found, 1 if OK */ - function fetch($id, $user=0) + function fetch($id, $user=0, $ref_ext='') { + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; $langs->load("companies"); @@ -521,7 +525,8 @@ class Contact extends CommonObject $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - $sql.= " WHERE c.rowid = ". $id; + if ($id) $sql.= " WHERE c.rowid = ". $id; + elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'"; dol_syslog(get_class($this)."::fetch sql=".$sql); $resql=$this->db->query($sql); diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index eb05665ea04..edd95566287 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -83,6 +83,7 @@ $server->wsdl->addComplexType( $contact_fields = array( 'id' => array('name'=>'id','type'=>'xsd:string'), + 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'), 'lastname' => array('name'=>'lastname','type'=>'xsd:string'), 'firstname' => array('name'=>'firstname','type'=>'xsd:string'), 'address' => array('name'=>'address','type'=>'xsd:string'), @@ -176,14 +177,14 @@ $styleuse='encoded'; // encoded/literal/literal wrapped $server->register( 'getContact', // Entry values - array('authentication'=>'tns:authentication','id'=>'xsd:string','ref'=>'xsd:string','ref_ext'=>'xsd:string'), + array('authentication'=>'tns:authentication','id'=>'xsd:string','ref_ext'=>'xsd:string'), // Exit values array('result'=>'tns:result','contact'=>'tns:contact'), $ns, $ns.'#getContact', $styledoc, $styleuse, - 'WS to get contact' + 'WS to get a contact' ); // Register WSDL @@ -232,16 +233,15 @@ $server->register( * Get Contact * * @param array $authentication Array of authentication information - * @param int $id Id of object - * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param int $id Id of object + * @param string $ref_ext Ref external of object * @return mixed */ -function getContact($authentication,$id,$ref='',$ref_ext='') +function getContact($authentication,$id,$ref_ext) { global $db,$conf,$langs; - dol_syslog("Function: getContact login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); + dol_syslog("Function: getContact login=".$authentication['login']." id=".$id." ref_ext=".$ref_ext); if ($authentication['entity']) $conf->entity=$authentication['entity']; @@ -251,10 +251,10 @@ function getContact($authentication,$id,$ref='',$ref_ext='') $error=0; $fuser=check_authentication($authentication,$error,$errorcode,$errorlabel); // Check parameters - if (! $error && (($id && $ref) || ($id && $ref_ext) || ($ref && $ref_ext))) + if (! $error && ($id && $ref_ext)) { $error++; - $errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id, ref and ref_ext can't be both provided. You must choose one or other but not both."; + $errorcode='BAD_PARAMETERS'; $errorlabel="Parameter id and ref_ext can't be both provided. You must choose one or other but not both."; } if (! $error) @@ -262,7 +262,7 @@ function getContact($authentication,$id,$ref='',$ref_ext='') $fuser->getrights(); $contact=new Contact($db); - $result=$contact->fetch($id,$ref,$ref_ext); + $result=$contact->fetch($id,0,$ref_ext); if ($result > 0) { // Only internal user who have contact read permission @@ -273,6 +273,7 @@ function getContact($authentication,$id,$ref='',$ref_ext='') ){ $contact_result_fields =array( 'id' => $contact->id, + 'ref_ext' => $contact->ref_ext, 'lastname' => $contact->lastname, 'firstname' => $contact->firstname, 'address' => $contact->address, @@ -383,6 +384,7 @@ function createContact($authentication,$contact) $newobject=new Contact($db); $newobject->id=$contact['id']; + $newobject->ref_ext=$contact['ref_ext']; $newobject->civility_id=$contact['civility_id']; $newobject->lastname=$contact['lastname']; $newobject->firstname=$contact['firstname']; From b8b9df7b953e6e8ba5226cd7096433c3e57a1813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Fri, 6 Feb 2015 12:36:09 +0100 Subject: [PATCH 11/23] Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes --- ChangeLog | 1 + htdocs/core/lib/tax.lib.php | 26 +++++++++----------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index ace6a13363d..f5faea819fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1717 ] Sorting unpaid invoices by amount received brings due amount - Fix: [ bug #1784 ] MOTD doesn't show up in Amarok theme - Fix: Tracking number not visible on shipment pdf +- Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index a52aeb37345..3b7e4044227 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2007 Yannick Warnier * Copyright (C) 2011 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,26 +87,18 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction global $conf; $list=array(); - //print "xx".$conf->global->MAIN_MODULE_ACCOUNTING; - //print "xx".$conf->global->MAIN_MODULE_COMPTABILITE; if ($direction == 'sell') { $invoicetable='facture'; - $invoicedettable='facturedet'; - $fk_facture='fk_facture'; - $total_tva='total_tva'; - $total_localtax1='total_localtax1'; - $total_localtax2='total_localtax2'; + $total_ht='total'; + $total_tva='tva'; } if ($direction == 'buy') { $invoicetable='facture_fourn'; - $invoicedettable='facture_fourn_det'; - $fk_facture='fk_facture_fourn'; - $total_tva='tva'; - $total_localtax1='total_localtax1'; - $total_localtax2='total_localtax2'; + $total_ht='total_ht'; + $total_tva='total_tva'; } // Define sql request @@ -125,11 +118,10 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) { $sql = "SELECT s.rowid as socid, s.nom as nom, s.siren as tva_intra, s.tva_assuj as assuj,"; - $sql.= " sum(fd.total_ht) as amount, sum(fd.".$total_tva.") as tva,"; - $sql.= " sum(fd.".$total_localtax1.") as localtax1,"; - $sql.= " sum(fd.".$total_localtax2.") as localtax2"; + $sql.= " sum(f.$total_ht) as amount, sum(f.".$total_tva.") as tva,"; + $sql.= " sum(f.localtax1) as localtax1,"; + $sql.= " sum(f.localtax2) as localtax2"; $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,"; - $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as fd,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) @@ -146,7 +138,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction $sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,12,false))."'"; } if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - $sql.= " AND s.rowid = f.fk_soc AND f.rowid = fd.".$fk_facture; + $sql.= " AND s.rowid = f.fk_soc"; $sql.= " GROUP BY s.rowid, s.nom, s.tva_intra, s.tva_assuj"; } } From 7cc9a09f99fcd673bb0ba830bd89b1b014585382 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 03:29:33 +0100 Subject: [PATCH 12/23] Fix bad order --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 796aa1fa89d..5c54cae4174 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -770,7 +770,7 @@ class Project extends CommonObject if ($statut == 1) return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); if ($statut == 2) - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6'); } } From c5269eb0a55e06e131fe99656de7ed1334222dff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 04:04:56 +0100 Subject: [PATCH 13/23] Fix: back to project page --- htdocs/projet/tasks.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 850b76bd3b3..1b69fd5757e 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -133,8 +133,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) } else { - setEventMessage($task->error,'errors'); - setEventMessage($task->errors,'errors'); + setEventMessages($task->error,$task->errors,'errors'); } } @@ -150,6 +149,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php'.(empty($mode)?'':'?mode='.$mode)); exit; } + $id = $projectid; } } else @@ -168,9 +168,10 @@ if ($action == 'createtask' && $user->rights->projet->creer) } } + /* * View -*/ + */ $form=new Form($db); $formother=new FormOther($db); From ba78b4c5e95cfd5b815ec479d33d4068b2a3a4fa Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 7 Feb 2015 14:18:02 +0100 Subject: [PATCH 14/23] FIXED Missing language file --- htdocs/compta/tva/clients.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index c2620fd34df..5d8dce0fd73 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -35,6 +35,7 @@ $langs->load("bills"); $langs->load("compta"); $langs->load("companies"); $langs->load("products"); +$langs->load("other"); // Date range $year=GETPOST("year"); From ace524056e221372d198b3a975eea7a01bb75889 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 7 Feb 2015 14:34:04 +0100 Subject: [PATCH 15/23] Same problem --- htdocs/compta/tva/quadri_detail.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 681448e901e..f551e92cb9d 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -41,6 +41,7 @@ $langs->load("bills"); $langs->load("compta"); $langs->load("companies"); $langs->load("products"); +$langs->load("other"); // Date range $year=GETPOST("year"); From f23212eb22082b7e8ce933d4ba4ee0ed35b6e9bb Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 7 Feb 2015 14:55:56 +0100 Subject: [PATCH 16/23] Center title column & modify language key --- htdocs/compta/resultat/index.php | 8 ++++---- htdocs/langs/en_US/compta.lang | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index b586241c11e..83ad1495a9f 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/resultat/index.php - * \brief Page reporting resultat + * \brief Page reporting result */ require '../../main.inc.php'; @@ -570,8 +570,8 @@ print ''; print ''.$langs->trans("Month").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''.$langs->trans("Outcome").''; - print ''.$langs->trans("Income").''; + print ''.$langs->trans("Outcome").''; + print ''.$langs->trans("Income").''; } print ''; @@ -634,7 +634,7 @@ print "\n"; // Balance $var=!$var; -print ''.$langs->trans("Profit").''; +print ''.$langs->trans("AccountingResult").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { print ' '; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 89a32876dc3..65b5c1c1bb9 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -29,6 +29,7 @@ ReportTurnover=Turnover PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to any third party PaymentsNotLinkedToUser=Payments not linked to any user Profit=Profit +AccountingResult=Accounting Result Balance=Balance Debit=Debit Credit=Credit From 63dd237b850001c10eee5abaf3cd062832d33fab Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 7 Feb 2015 15:21:30 +0100 Subject: [PATCH 17/23] Typo --- htdocs/langs/en_US/compta.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 65b5c1c1bb9..116b2c52fa8 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -29,7 +29,7 @@ ReportTurnover=Turnover PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to any third party PaymentsNotLinkedToUser=Payments not linked to any user Profit=Profit -AccountingResult=Accounting Result +AccountingResult=Accounting result Balance=Balance Debit=Debit Credit=Credit From 90fdc29d5ecea60c8070577ae4316bde83018417 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 17:41:20 +0100 Subject: [PATCH 18/23] Fix restore compatibility --- htdocs/core/class/extrafields.class.php | 32 ++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 30c97e9f1ef..1c7c3ffb634 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -100,7 +100,7 @@ class ExtraFields * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') * @param int $pos Position of attribute * @param int $size Size/length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not * @param string $default_value Defaulted value @@ -113,6 +113,8 @@ class ExtraFields if (empty($attrname)) return -1; if (empty($label)) return -1; + if ($elementtype == 'thirdparty') $elementtype='societe'; + // Create field into database except for separator type which is not stored in database if ($type != 'separate') { @@ -145,7 +147,7 @@ class ExtraFields * @param string $attrname code of attribute * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') * @param int $length Size/length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not * @param string $default_value Default value for field @@ -155,6 +157,8 @@ class ExtraFields */ private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='') { + if ($elementtype == 'thirdparty') $elementtype='societe'; + $table=$elementtype.'_extrafields'; if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9_]*$/",$attrname) && ! is_numeric($attrname)) @@ -216,7 +220,7 @@ class ExtraFields * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float') * @param int $pos Position of attribute * @param int $size Size/length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not * @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) @@ -227,6 +231,8 @@ class ExtraFields { global $conf; + if ($elementtype == 'thirdparty') $elementtype='societe'; + // Clean parameters if (empty($pos)) $pos=0; @@ -277,11 +283,13 @@ class ExtraFields * Delete an optional attribute * * @param string $attrname Code of attribute to delete - * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ function delete($attrname, $elementtype='member') { + if ($elementtype == 'thirdparty') $elementtype='societe'; + $table=$elementtype.'_extrafields'; if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) @@ -307,13 +315,15 @@ class ExtraFields * Delete description of an optional attribute * * @param string $attrname Code of attribute to delete - * @param string $elementtype Element type ('member', 'product', 'company', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ private function delete_label($attrname, $elementtype='member') { global $conf; + if ($elementtype == 'thirdparty') $elementtype='societe'; + if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; @@ -347,7 +357,7 @@ class ExtraFields * @param string $label Label of attribute * @param string $type Type of attribute * @param int $length Length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', 'contact', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not * @param int $pos Position of attribute @@ -357,6 +367,8 @@ class ExtraFields */ function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0) { + if ($elementtype == 'thirdparty') $elementtype='societe'; + $table=$elementtype.'_extrafields'; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) @@ -433,7 +445,7 @@ class ExtraFields * @param string $label Label of attribute * @param string $type Type of attribute * @param int $size Length of attribute - * @param string $elementtype Element type ('member', 'product', 'company', ...) + * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not * @param int $pos Position of attribute @@ -446,6 +458,8 @@ class ExtraFields global $conf; dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required); + if ($elementtype == 'thirdparty') $elementtype='societe'; + if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { $this->db->begin(); @@ -513,7 +527,7 @@ class ExtraFields /** * Load array this->attribute_xxx like attribute_label, attribute_type, ... * - * @param string $elementtype Type of element ('adherent', 'commande', societe', 'facture', 'propal', 'product', ...) + * @param string $elementtype Type of element ('adherent', 'commande', thirdparty', 'facture', 'propal', 'product', ...) * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED * @return array Array of attributes for all extra fields */ @@ -521,6 +535,8 @@ class ExtraFields { global $conf; + if ($elementtype == 'thirdparty') $elementtype='societe'; + $array_name_label=array(); // For avoid conflicts with external modules From 64963ef9bde0e0babb56e9fe91b71335487089b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 19:12:22 +0100 Subject: [PATCH 19/23] Fix: the syslog handler for chromphp an fiefoxphp was not visible when they should not. --- htdocs/admin/syslog.php | 29 +- .../modules/syslog/mod_syslog_chromephp.php | 21 +- .../core/modules/syslog/mod_syslog_file.php | 4 +- .../modules/syslog/mod_syslog_firephp.php | 6 +- .../core/modules/syslog/mod_syslog_syslog.php | 6 +- htdocs/includes/chromephp/ChromePhp.php | 446 ++++++++++++++++++ htdocs/includes/chromephp/README.md | 23 + htdocs/includes/chromephp/composer.json | 24 + htdocs/langs/en_US/admin.lang | 1 + 9 files changed, 532 insertions(+), 28 deletions(-) create mode 100644 htdocs/includes/chromephp/ChromePhp.php create mode 100644 htdocs/includes/chromephp/README.md create mode 100644 htdocs/includes/chromephp/composer.json diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 18de8bf6bfc..c1fc11add9b 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -81,33 +81,32 @@ if ($action == 'set') { $db->begin(); - $activeModules = array(); + $newActiveModules = array(); $selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array()); - - foreach ($selectedModules as $syslogHandler) + //var_dump($selectedModules); + foreach ($syslogModules as $syslogHandler) { if (in_array($syslogHandler, $syslogModules)) { $module = new $syslogHandler; - if ($module->isActive()) + if (in_array($syslogHandler, $selectedModules)) $newActiveModules[] = $syslogHandler; + foreach ($module->configure() as $option) { - $activeModules[] = $syslogHandler; - - foreach ($module->configure() as $option) + if (isset($_POST[$option['constant']])) { - if ($_POST[$option['constant']]) - { - dolibarr_del_const($db, $option['constant'], 0); - dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine',0, '', 0); - } + $_POST[$option['constant']] = trim($_POST[$option['constant']]); + dolibarr_del_const($db, $option['constant'], 0); + dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine',0, '', 0); } } } } + $activeModules = $newActiveModules; dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0); + if (! $error) { $db->commit(); @@ -165,6 +164,9 @@ if ($conf->global->MAIN_MODULE_MULTICOMPANY && $user->entity) $option = 'disabled="disabled"'; } + +//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL."

\n"; + // Output mode print_titre($langs->trans("SyslogOutput")); @@ -190,7 +192,7 @@ foreach ($syslogModules as $moduleName) $var=!$var; print ''; print ''; - print ' '; + print ' '; print $module->getName(); print ''; @@ -205,6 +207,7 @@ foreach ($syslogModules as $moduleName) else $value = (isset($option['default']) ? $option['default'] : ''); print $option['name'].': '; + if (! empty($option['example'])) print '
'.$langs->trans("Example").': '.$option['example']; } } print ''; diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index 06d37dfa431..ca257e6b0f6 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -42,7 +42,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface /** * Is the module active ? * - * @return boolean + * @return int */ public function isActive() { @@ -51,8 +51,13 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface { if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH='/usr/share/php'; set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - $res = @include_once 'ChromePhp.class.php'; + + //print 'rrrrr'.get_include_path(); + $res = include_once('ChromePhp.php'); + if (! $res) $res=@include_once('ChromePhp.class.php'); + restore_include_path(); + if ($res) { return 1; @@ -77,10 +82,11 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface return array( array( - 'name' => $langs->trans('IncludePath'), + 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'), 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', 'default' => '/usr/share/php', - 'attr' => 'size="40"' + 'attr' => 'size="60"', + 'example' => DOL_DOCUMENT_ROOT.'/includes/chromephp' ) ); } @@ -92,16 +98,17 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface */ public function checkConfiguration() { - global $langs; + global $langs,$conf; $errors = array(); $oldinclude = get_include_path(); - set_include_path(SYSLOG_CHROMEPHP_INCLUDEPATH); + set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); if (!file_exists('ChromePhp.class.php')) { $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php'); + $errors[] = $langs->trans("IncludePath").' : '.get_include_path(); } set_include_path($oldinclude); @@ -129,7 +136,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface // Warning ChromePHP must be into PHP include path. It is not possible to use into require_once() a constant from // database or config file because we must be able to log data before database or config file read. $oldinclude=get_include_path(); - set_include_path(SYSLOG_CHROMEPHP_INCLUDEPATH); + set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); include_once 'ChromePhp.class.php'; set_include_path($oldinclude); ob_start(); // To be sure headers are not flushed until all page is completely processed diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 331b7331194..318fe30d4f0 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -45,11 +45,11 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface /** * Is the module active ? * - * @return boolean + * @return int */ public function isActive() { - return true; + return 1; } /** diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php index 31a3fb13431..013b5de85a7 100644 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php @@ -42,7 +42,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface /** * Is the module active ? * - * @return boolean + * @return int */ public function isActive() { @@ -53,7 +53,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface restore_include_path(); if ($res) { - return true; + return 1; } } catch(Exception $e) @@ -61,7 +61,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface print ''."\n"; } - return false; + return -1; } ///** diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 58ac241695c..a342114a33f 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -42,14 +42,14 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface /** * Is the module active ? * - * @return boolean + * @return int */ public function isActive() { // This function does not exists on some ISP (Ex: Free in France) - if (!function_exists('openlog')) return false; + if (!function_exists('openlog')) return 0; - return true; + return 1; } /** diff --git a/htdocs/includes/chromephp/ChromePhp.php b/htdocs/includes/chromephp/ChromePhp.php new file mode 100644 index 00000000000..577b1cecb9d --- /dev/null +++ b/htdocs/includes/chromephp/ChromePhp.php @@ -0,0 +1,446 @@ + + */ +class ChromePhp +{ + /** + * @var string + */ + const VERSION = '4.1.0'; + + /** + * @var string + */ + const HEADER_NAME = 'X-ChromeLogger-Data'; + + /** + * @var string + */ + const BACKTRACE_LEVEL = 'backtrace_level'; + + /** + * @var string + */ + const LOG = 'log'; + + /** + * @var string + */ + const WARN = 'warn'; + + /** + * @var string + */ + const ERROR = 'error'; + + /** + * @var string + */ + const GROUP = 'group'; + + /** + * @var string + */ + const INFO = 'info'; + + /** + * @var string + */ + const GROUP_END = 'groupEnd'; + + /** + * @var string + */ + const GROUP_COLLAPSED = 'groupCollapsed'; + + /** + * @var string + */ + const TABLE = 'table'; + + /** + * @var string + */ + protected $_php_version; + + /** + * @var int + */ + protected $_timestamp; + + /** + * @var array + */ + protected $_json = array( + 'version' => self::VERSION, + 'columns' => array('log', 'backtrace', 'type'), + 'rows' => array() + ); + + /** + * @var array + */ + protected $_backtraces = array(); + + /** + * @var bool + */ + protected $_error_triggered = false; + + /** + * @var array + */ + protected $_settings = array( + self::BACKTRACE_LEVEL => 1 + ); + + /** + * @var ChromePhp + */ + protected static $_instance; + + /** + * Prevent recursion when working with objects referring to each other + * + * @var array + */ + protected $_processed = array(); + + /** + * constructor + */ + private function __construct() + { + $this->_php_version = phpversion(); + $this->_timestamp = $this->_php_version >= 5.1 ? $_SERVER['REQUEST_TIME'] : time(); + $this->_json['request_uri'] = $_SERVER['REQUEST_URI']; + } + + /** + * gets instance of this class + * + * @return ChromePhp + */ + public static function getInstance() + { + if (self::$_instance === null) { + self::$_instance = new self(); + } + return self::$_instance; + } + + /** + * logs a variable to the console + * + * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] + * @return void + */ + public static function log() + { + $args = func_get_args(); + return self::_log('', $args); + } + + /** + * logs a warning to the console + * + * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] + * @return void + */ + public static function warn() + { + $args = func_get_args(); + return self::_log(self::WARN, $args); + } + + /** + * logs an error to the console + * + * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] + * @return void + */ + public static function error() + { + $args = func_get_args(); + return self::_log(self::ERROR, $args); + } + + /** + * sends a group log + * + * @param string value + */ + public static function group() + { + $args = func_get_args(); + return self::_log(self::GROUP, $args); + } + + /** + * sends an info log + * + * @param mixed $data,... unlimited OPTIONAL number of additional logs [...] + * @return void + */ + public static function info() + { + $args = func_get_args(); + return self::_log(self::INFO, $args); + } + + /** + * sends a collapsed group log + * + * @param string value + */ + public static function groupCollapsed() + { + $args = func_get_args(); + return self::_log(self::GROUP_COLLAPSED, $args); + } + + /** + * ends a group log + * + * @param string value + */ + public static function groupEnd() + { + $args = func_get_args(); + return self::_log(self::GROUP_END, $args); + } + + /** + * sends a table log + * + * @param string value + */ + public static function table() + { + $args = func_get_args(); + return self::_log(self::TABLE, $args); + } + + /** + * internal logging call + * + * @param string $type + * @return void + */ + protected static function _log($type, array $args) + { + // nothing passed in, don't do anything + if (count($args) == 0 && $type != self::GROUP_END) { + return; + } + + $logger = self::getInstance(); + + $logger->_processed = array(); + + $logs = array(); + foreach ($args as $arg) { + $logs[] = $logger->_convert($arg); + } + + $backtrace = debug_backtrace(false); + $level = $logger->getSetting(self::BACKTRACE_LEVEL); + + $backtrace_message = 'unknown'; + if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) { + $backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line']; + } + + $logger->_addRow($logs, $backtrace_message, $type); + } + + /** + * converts an object to a better format for logging + * + * @param Object + * @return array + */ + protected function _convert($object) + { + // if this isn't an object then just return it + if (!is_object($object)) { + return $object; + } + + //Mark this object as processed so we don't convert it twice and it + //Also avoid recursion when objects refer to each other + $this->_processed[] = $object; + + $object_as_array = array(); + + // first add the class name + $object_as_array['___class_name'] = get_class($object); + + // loop through object vars + $object_vars = get_object_vars($object); + foreach ($object_vars as $key => $value) { + + // same instance as parent object + if ($value === $object || in_array($value, $this->_processed, true)) { + $value = 'recursion - parent object [' . get_class($value) . ']'; + } + $object_as_array[$key] = $this->_convert($value); + } + + $reflection = new ReflectionClass($object); + + // loop through the properties and add those + foreach ($reflection->getProperties() as $property) { + + // if one of these properties was already added above then ignore it + if (array_key_exists($property->getName(), $object_vars)) { + continue; + } + $type = $this->_getPropertyKey($property); + + if ($this->_php_version >= 5.3) { + $property->setAccessible(true); + } + + try { + $value = $property->getValue($object); + } catch (ReflectionException $e) { + $value = 'only PHP 5.3 can access private/protected properties'; + } + + // same instance as parent object + if ($value === $object || in_array($value, $this->_processed, true)) { + $value = 'recursion - parent object [' . get_class($value) . ']'; + } + + $object_as_array[$type] = $this->_convert($value); + } + return $object_as_array; + } + + /** + * takes a reflection property and returns a nicely formatted key of the property name + * + * @param ReflectionProperty + * @return string + */ + protected function _getPropertyKey(ReflectionProperty $property) + { + $static = $property->isStatic() ? ' static' : ''; + if ($property->isPublic()) { + return 'public' . $static . ' ' . $property->getName(); + } + + if ($property->isProtected()) { + return 'protected' . $static . ' ' . $property->getName(); + } + + if ($property->isPrivate()) { + return 'private' . $static . ' ' . $property->getName(); + } + } + + /** + * adds a value to the data array + * + * @var mixed + * @return void + */ + protected function _addRow(array $logs, $backtrace, $type) + { + // if this is logged on the same line for example in a loop, set it to null to save space + if (in_array($backtrace, $this->_backtraces)) { + $backtrace = null; + } + + // for group, groupEnd, and groupCollapsed + // take out the backtrace since it is not useful + if ($type == self::GROUP || $type == self::GROUP_END || $type == self::GROUP_COLLAPSED) { + $backtrace = null; + } + + if ($backtrace !== null) { + $this->_backtraces[] = $backtrace; + } + + $row = array($logs, $backtrace, $type); + + $this->_json['rows'][] = $row; + $this->_writeHeader($this->_json); + } + + protected function _writeHeader($data) + { + header(self::HEADER_NAME . ': ' . $this->_encode($data)); + } + + /** + * encodes the data to be sent along with the request + * + * @param array $data + * @return string + */ + protected function _encode($data) + { + return base64_encode(utf8_encode(json_encode($data))); + } + + /** + * adds a setting + * + * @param string key + * @param mixed value + * @return void + */ + public function addSetting($key, $value) + { + $this->_settings[$key] = $value; + } + + /** + * add ability to set multiple settings in one call + * + * @param array $settings + * @return void + */ + public function addSettings(array $settings) + { + foreach ($settings as $key => $value) { + $this->addSetting($key, $value); + } + } + + /** + * gets a setting + * + * @param string key + * @return mixed + */ + public function getSetting($key) + { + if (!isset($this->_settings[$key])) { + return null; + } + return $this->_settings[$key]; + } +} diff --git a/htdocs/includes/chromephp/README.md b/htdocs/includes/chromephp/README.md new file mode 100644 index 00000000000..3dd7dbe19dd --- /dev/null +++ b/htdocs/includes/chromephp/README.md @@ -0,0 +1,23 @@ +## Overview +ChromePhp is a PHP library for the Chrome Logger Google Chrome extension. + +This library allows you to log variables to the Chrome console. + +## Requirements +- PHP 5 or later + +## Installation +1. Install the Chrome extension from: https://chrome.google.com/extensions/detail/noaneddfkdjfnfdakjjmocngnfkfehhd +2. Click the extension icon in the browser to enable it for the current tab's domain +3. Put ChromePhp.php somewhere in your PHP include path +4. Log some data + + ```php + include 'ChromePhp.php'; + ChromePhp::log('Hello console!'); + ChromePhp::log($_SERVER); + ChromePhp::warn('something went wrong!'); + ``` + +More information can be found here: +http://www.chromelogger.com diff --git a/htdocs/includes/chromephp/composer.json b/htdocs/includes/chromephp/composer.json new file mode 100644 index 00000000000..dc16853d3ec --- /dev/null +++ b/htdocs/includes/chromephp/composer.json @@ -0,0 +1,24 @@ +{ + "name": "ccampbell/chromephp", + "type": "library", + "description": "Log variables to the Chrome console (via Chrome Logger Google Chrome extension).", + "keywords": ["log","logging"], + "homepage": "http://github.com/ccampbell/chromephp", + "license": "Apache-2.0", + "authors": [ + { + "name": "Craig Campbell", + "email": "iamcraigcampbell@gmail.com", + "homepage": "http://craig.is", + "role": "Developer" + } + ], + "require": { + "php": ">=5.0.0" + }, + "autoload": { + "psr-0": { + "ChromePhp": "" + } + } +} diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d262b835794..59579237d33 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1558,3 +1558,4 @@ SalariesSetup=Setup of module salaries SortOrder=Sort order Format=Format TypePaymentDesc=0:Customer payment type, 1:Supplier payment type, 2:Both customers and suppliers payment type +IncludePath=Include path (defined into variable %s) \ No newline at end of file From 1d1b3da182c27f09cb818fa26659eba40a9e98b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 19:30:28 +0100 Subject: [PATCH 20/23] Fix: the syslog handler for chromphp an fiefoxphp was not visible when they should not. --- .../modules/syslog/mod_syslog_chromephp.php | 18 +++++++----------- htdocs/core/modules/syslog/mod_syslog_file.php | 2 +- .../core/modules/syslog/mod_syslog_firephp.php | 2 +- .../core/modules/syslog/mod_syslog_syslog.php | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index ca257e6b0f6..b2520d27d7b 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -94,7 +94,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { @@ -102,17 +102,11 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface $errors = array(); - $oldinclude = get_include_path(); - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - - if (!file_exists('ChromePhp.class.php')) + if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php'); - $errors[] = $langs->trans("IncludePath").' : '.get_include_path(); + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); } - set_include_path($oldinclude); - return $errors; } @@ -129,7 +123,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration())) return false; + if (count($this->checkConfiguration()) > 0) return false; try { @@ -137,8 +131,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface // database or config file because we must be able to log data before database or config file read. $oldinclude=get_include_path(); set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - include_once 'ChromePhp.class.php'; + $res = @include_once('ChromePhp.php'); + if (! $res) $res=@include_once('ChromePhp.class.php'); set_include_path($oldinclude); + ob_start(); // To be sure headers are not flushed until all page is completely processed if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 318fe30d4f0..92d2302bea7 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -74,7 +74,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php index 013b5de85a7..31addd8b17a 100644 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php @@ -86,7 +86,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index a342114a33f..2043225857b 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -73,7 +73,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { From e42290cb8858348e1eba7dc1dbcb4e4f8eeb2d50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 19:35:00 +0100 Subject: [PATCH 21/23] Update doc --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index c6a629c5c7a..1631f85d321 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -13,6 +13,7 @@ Component Version License GPL Compatible ------------------------------------------------------------------------------------- PHP libraries: AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package) +ChromePHP 4.3.3 Apache Software License 2.0 Yes Return server log to chrome browser console CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management From 0ca6661e6916e06e38a2f5873a8d91e2363d8d31 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Sat, 7 Feb 2015 23:33:37 +0100 Subject: [PATCH 22/23] FIX empty discount where created if amount is null for a line with a different tva --- htdocs/compta/facture.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8e74c674084..67ba28b4e47 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -563,10 +563,12 @@ if (empty($reshook)) // Boucle sur chaque taux de tva $i = 0; foreach ($object->lines as $line) { - $amount_ht [$line->tva_tx] += $line->total_ht; - $amount_tva [$line->tva_tx] += $line->total_tva; - $amount_ttc [$line->tva_tx] += $line->total_ttc; - $i ++; + if($line->total_ht!=0) { // no need to create discount if amount is null + $amount_ht [$line->tva_tx] += $line->total_ht; + $amount_tva [$line->tva_tx] += $line->total_tva; + $amount_ttc [$line->tva_tx] += $line->total_ttc; + $i ++; + } } // Insert one discount by VAT rate category @@ -583,6 +585,7 @@ if (empty($reshook)) $discount->fk_facture_source = $object->id; $error = 0; + foreach ($amount_ht as $tva_tx => $xxx) { $discount->amount_ht = abs($amount_ht [$tva_tx]); $discount->amount_tva = abs($amount_tva [$tva_tx]); From fce7a0e36e51fa7f6f3e01469e370a7bc66720e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Feb 2015 21:01:44 +0100 Subject: [PATCH 23/23] Bad translation --- htdocs/langs/en_US/orders.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 4127de804c6..e8c0556d550 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -29,7 +29,7 @@ StatusOrderDraftShort=Draft StatusOrderValidatedShort=Validated StatusOrderSentShort=In process StatusOrderSent=Shipment in process -StatusOrderOnProcessShort=Reception +StatusOrderOnProcessShort=Order sent StatusOrderProcessedShort=Processed StatusOrderToBillShort=Delivered StatusOrderToBill2Short=To bill @@ -41,7 +41,7 @@ StatusOrderReceivedAllShort=Everything received StatusOrderCanceled=Canceled StatusOrderDraft=Draft (needs to be validated) StatusOrderValidated=Validated -StatusOrderOnProcess=Waiting to receive +StatusOrderOnProcess=Order sent - Standby reception StatusOrderProcessed=Processed StatusOrderToBill=Delivered StatusOrderToBill2=To bill