diff --git a/ChangeLog b/ChangeLog index d905ba24168..8bdae25eac7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -186,6 +186,10 @@ Dolibarr better: - 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 +- Fix: [ bug #1812 ] SQL Error message while sending emailing with PostgreSQL datatabase +- Fix: [ bug #1819 ] SQL error when searching for an invoice payment +- 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/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 09a2abf329a..223c00afc6e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1162,6 +1162,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; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index dc0d981ae7c..32a0bb78dbc 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -197,7 +197,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) { @@ -293,7 +293,7 @@ if (empty($reshook)) dol_syslog("comm/mailing/card.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) { @@ -336,7 +336,7 @@ if (empty($reshook)) dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING); $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) { diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c7fd426babf..5cf941302c7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -121,10 +121,10 @@ else else $sql.= " AND f.fk_user_author = ".$userid; } // Search criteria - if ($search_ref) $sql .=" AND p.rowid=".$search_ref; + if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref; if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; - if ($search_paymenttype != "") $sql .=" AND c.code='".$search_paymenttype."'"; - if ($search_amount) $sql .=" AND p.amount='".price2num($search_amount)."'"; + if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; + if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; if ($search_company) $sql .= natural_search('s.nom', $search_company); } $sql.= $db->order($sortfield,$sortorder); @@ -237,7 +237,7 @@ if ($resql) if ($objp->statut == 0) print ''; print ''; } - + print ' '; print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 6a7776b27bd..bd37c155196 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.= ")"; @@ -492,10 +494,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 - * @return int -1 if KO, 0 if OK but not found, 1 if OK + * @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=null) + function fetch($id, $user=0, $ref_ext='') { + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; $langs->load("companies"); @@ -517,7 +521,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", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 50c02125fb7..8f6847bcb9a 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)); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index cc9478f5d61..6b750bf2f96 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 name, 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"; } } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index e861bff6169..312e8bc5e1f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -558,6 +558,7 @@ class pdf_merou extends ModelePdfExpedition // Date Expedition $Yoff = $Yoff+7; $pdf->SetXY($blSocX-80,$blSocY+17); + $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetTextColor(0,0,0); $pdf->MultiCell(50, 8, $outputlangs->transnoentities("DateDelivery")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L'); @@ -581,6 +582,7 @@ class pdf_merou extends ModelePdfExpedition { // Get code using getLabelFromKey $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code'); + $label=''; $label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); //var_dump($object->tracking_url != $object->tracking_number);exit; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index c8d77040a9d..14de889d9ce 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -599,7 +599,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]; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index fbe2870a6a4..69550d546d5 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -333,7 +333,7 @@ if (! empty($conf->margin->enabled)) var rounding = main_rounding_unit; var pos = amount.indexOf(dec); var decpart = ''; - if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale + if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Remove 0 for decimal part var nbdec = decpart.length; if (nbdec > rounding) rounding = nbdec; // If rounding higher than max shown diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 59579237d33..6f9449f209d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1558,4 +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 +IncludePath=Include path (defined into variable %s) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index cd6d6fbf033..13de82c602f 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -60,6 +60,7 @@ SupplierOrderSentByEMail=Supplier order %s sent by EMail SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail ShippingSentByEMail=Shipment %s sent by EMail ShippingValidated= Shipment %s validated +InterventionSentByEMail=Intervention %s sent by EMail NewCompanyToDolibarr= Third party created DateActionPlannedStart= Planned start date DateActionPlannedEnd= Planned end date diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index b7550244fc2..ec652e80074 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 @@ -233,15 +234,14 @@ $server->register( * * @param array $authentication Array of authentication information * @param int $id Id of object - * @param string $ref Ref 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']; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 9229d3b9c26..587e50385a6 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -690,6 +690,7 @@ function createOrder($authentication,$order) $newobject->statut=0; // We start with status draft $newobject->billed=$order['billed']; $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;