Merge remote-tracking branch 'origin/3.6' into 3.7

Conflicts:
	htdocs/comm/mailing/fiche.php
	htdocs/compta/paiement/liste.php
	htdocs/contact/class/contact.class.php
	htdocs/core/lib/tax.lib.php
	htdocs/core/modules/expedition/doc/pdf_merou.modules.php
	htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
	htdocs/langs/en_US/agenda.lang
	htdocs/webservices/server_contact.php
This commit is contained in:
Laurent Destailleur 2015-02-10 21:33:43 +01:00
commit ddb95e5765
14 changed files with 46 additions and 39 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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)
{

View File

@ -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 '</a>';
print '</td>';
}
print '<td>&nbsp;</td>';
print '</tr>';

View File

@ -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);

View File

@ -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));

View File

@ -3,6 +3,7 @@
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* 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";
}
}

View File

@ -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;

View File

@ -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];

View File

@ -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

View File

@ -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)
IncludePath=Include path (defined into variable %s)

View File

@ -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

View File

@ -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'];

View File

@ -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;