Merge remote-tracking branch 'origin/3.9' into 4.0
Conflicts: htdocs/core/modules/facture/doc/pdf_crabe.modules.php
This commit is contained in:
commit
b85bb8c0f8
@ -446,8 +446,8 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$newinvoiceline=$this->lines[$i];
|
||||
$newinvoiceline->fk_facture=$this->id;
|
||||
$newinvoiceline->origin = $this->element;
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
$newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object !
|
||||
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
||||
{
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
|
||||
$dir=$conf->prelevement->dir_output.'/receipts';
|
||||
if (! is_dir($dir)) dol_mkdir($dir);
|
||||
|
||||
$this->filename = $dir.'/receipts/'.$ref.'.xml';
|
||||
$this->filename = $dir.$ref.'.xml';
|
||||
|
||||
// Create withdraw receipt in database
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
|
||||
|
||||
@ -170,7 +170,8 @@ class HookManager
|
||||
'printObjectLine',
|
||||
'printObjectSubLine',
|
||||
'createDictionaryFieldList',
|
||||
'editDictionaryFieldlist'
|
||||
'editDictionaryFieldlist',
|
||||
'getFormMail'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
// Deprecated hook types ('returnvalue')
|
||||
|
||||
@ -140,8 +140,8 @@ class FormProjets
|
||||
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
if (!empty($filterkey)) {
|
||||
$sql .= ' AND p.title LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
$sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'";
|
||||
$sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'";
|
||||
}
|
||||
$sql.= " ORDER BY p.ref ASC";
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
{
|
||||
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
||||
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||
@ -338,6 +338,11 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
if (is_object($object->thirdparty))
|
||||
{
|
||||
$object->fk_incoterms=$object->thirdparty->fk_incoterms;
|
||||
$object->location_incoterms=$object->thirdparty->location_incoterms;
|
||||
}
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
if ($desc_incoterms)
|
||||
{
|
||||
@ -553,7 +558,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne= $sign * $object->lines[$i]->multicurrency_total_tva;
|
||||
else $tvaligne= $sign * $object->lines[$i]->total_tva;
|
||||
}
|
||||
|
||||
|
||||
$localtax1ligne=$object->lines[$i]->total_localtax1;
|
||||
$localtax2ligne=$object->lines[$i]->total_localtax2;
|
||||
$localtax1_rate=$object->lines[$i]->localtax1_tx;
|
||||
@ -1577,7 +1582,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$posy=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42;
|
||||
$posx=$this->marge_gauche;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
|
||||
|
||||
|
||||
$hautcadre=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40;
|
||||
$widthrecbox=!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ IMG;
|
||||
|
||||
/**
|
||||
* Merge template variables
|
||||
* Called automatically for a save
|
||||
* Called at the beginning of the _save function
|
||||
*
|
||||
* @param string $type 'content', 'styles' or 'meta'
|
||||
* @return void
|
||||
@ -296,6 +296,7 @@ IMG;
|
||||
// Search all tags fou into condition to complete $this->vars, so we will proceed all tests even if not defined
|
||||
$reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU';
|
||||
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
|
||||
|
||||
//var_dump($this->vars);exit;
|
||||
foreach($matches as $match) // For each match, if there is no entry into this->vars, we add it
|
||||
{
|
||||
@ -313,15 +314,23 @@ IMG;
|
||||
// If value is true (not 0 nor false nor null nor empty string)
|
||||
if ($value)
|
||||
{
|
||||
dol_syslog("Var ".$key." is defined, we remove the IF, ELSE and ENDIF ");
|
||||
$sav=$this->contentXml;
|
||||
// Remove the IF tag
|
||||
$this->contentXml = str_replace('[!-- IF '.$key.' --]', '', $this->contentXml);
|
||||
// Remove everything between the ELSE tag (if it exists) and the ENDIF tag
|
||||
$reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
$this->contentXml = preg_replace($reg, '', $this->contentXml);
|
||||
if ($sav != $this->contentXml)
|
||||
{
|
||||
dol_syslog("We found a IF and it was processed");
|
||||
}
|
||||
}
|
||||
// Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it
|
||||
else
|
||||
{
|
||||
dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF ");
|
||||
$sav=$this->contentXml;
|
||||
// Find all conditional blocks for this variable: from IF to ELSE and to ENDIF
|
||||
$reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy
|
||||
preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER);
|
||||
@ -330,6 +339,11 @@ IMG;
|
||||
}
|
||||
// Cleanup the other conditional blocks (all the others where there were no ELSE clause, we can just remove them altogether)
|
||||
$this->contentXml = preg_replace($reg, '', $this->contentXml);
|
||||
if ($sav != $this->contentXml)
|
||||
{
|
||||
dol_syslog("We found a IF and it was processed");
|
||||
//var_dump($sav);exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@ -1983,12 +1983,24 @@ class Societe extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$contact_emails = $this->contact_property_array('email');
|
||||
$contact_emails = $this->contact_property_array('email',1);
|
||||
if ($this->email && $addthirdparty)
|
||||
{
|
||||
if (empty($this->name)) $this->name=$this->nom;
|
||||
// TODO: Tester si email non deja present dans tableau contact
|
||||
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
|
||||
$exist = 0;
|
||||
foreach($contact_emails as $contacts){
|
||||
if($exist ===0){
|
||||
$contacts = str_replace('>','',$contacts);
|
||||
$contacts = explode ('<',$contacts);
|
||||
if($contacts[1]===$this->email){
|
||||
$exist = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($exist ===0){
|
||||
if (empty($this->name)) $this->name=$this->nom;
|
||||
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
|
||||
}
|
||||
|
||||
}
|
||||
return $contact_emails;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user