Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Jul 21, 2017
2 parents aacef21 + dc7e00c commit 3716645
Show file tree
Hide file tree
Showing 20 changed files with 130 additions and 92 deletions.
1 change: 1 addition & 0 deletions htdocs/comm/propal/list.php
Expand Up @@ -355,6 +355,7 @@
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
if (empty($search_societe)) $search_societe = $soc->name;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/commande/list.php
Expand Up @@ -578,6 +578,7 @@
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
if (empty($search_company)) $search_company = $soc->name;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/list.php
Expand Up @@ -531,6 +531,7 @@
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_societe)) $search_societe = $soc->name;
}

$param='&socid='.$socid;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/contrat/class/contrat.class.php
Expand Up @@ -1633,8 +1633,8 @@ function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $dat
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
{
$contractline = new ContratLigne($this->db);
$contractline->array_options=$array_option;
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
$contractline->array_options=$array_options;
$contractline->id= $rowid;
$result=$contractline->insertExtraFields();
if ($result < 0)
{
Expand Down
9 changes: 8 additions & 1 deletion htdocs/contrat/list.php
Expand Up @@ -305,8 +305,15 @@
$i = 0;

$arrayofselected=is_array($toselect)?$toselect:array();

if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_name)) $search_name = $soc->name;
}

$param='';
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.$sall;
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/actions_sendmails.inc.php
Expand Up @@ -391,6 +391,9 @@
$object->trackid = $trackid;
$object->fk_element = $object->id;
$object->elementtype = $object->element;
if (is_array($attachedfiles) && count($attachedfiles)>0) {
$object->attachedfiles = $attachedfiles;
}

// Call of triggers
if (! empty($trigger_name))
Expand Down
8 changes: 8 additions & 0 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -5604,6 +5604,14 @@ function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinkst
{
$listofidcompanytoscan=$object->thirdparty->id;
if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
if (($object->fk_project > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO))
{
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$tmpproject=new Project($this->db);
$tmpproject->fetch($object->fk_project);
if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) $listofidcompanytoscan.=','.$tmpproject->socid;
unset($tmpproject);
}

$possiblelinks=array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
Expand Down
49 changes: 26 additions & 23 deletions htdocs/core/class/smtps.class.php
Expand Up @@ -271,7 +271,7 @@ function setMoreInHeader($_val = '')
{
$this->_moreinheader = $_val;
}

/**
* get trackid
*
Expand All @@ -291,7 +291,7 @@ function getMoreInHeader()
{
return $this->_moreinheader;
}

/**
* Set errors to
*
Expand Down Expand Up @@ -411,7 +411,7 @@ function _server_connect()
function _server_authenticate()
{
global $conf;

// Send the RFC2554 specified EHLO.
// This improvment as provided by 'SirSir' to
// accomodate both SMTP AND ESMTP capable servers
Expand Down Expand Up @@ -462,7 +462,7 @@ function _server_authenticate()
{
$this->_setErr(126, '"' . $host . '" does not support authenticated connections.');
return $_retVal;
}
}
}
// Send Authentication to Server
// Check for errors along the way
Expand Down Expand Up @@ -903,7 +903,7 @@ function setReplyTo($_strReplyTo)
if ( $_strReplyTo )
$this->_msgReplyTo = $this->_strip_email($_strReplyTo);
}

/**
* Retrieves the Address from which mail will be the reply-to
*
Expand All @@ -913,15 +913,15 @@ function setReplyTo($_strReplyTo)
function getReplyTo($_part = true)
{
$_retValue = '';

if ( $_part === true )
$_retValue = $this->_msgReplyTo;
else
$_retValue = $this->_msgReplyTo[$_part];

return $_retValue;
}

/**
* Inserts given addresses into structured format.
* This method takes a list of given addresses, via an array
Expand Down Expand Up @@ -1217,6 +1217,8 @@ function getSubject()
*/
function getHeader()
{
global $conf;

$_header = 'From: ' . $this->getFrom('org') . "\r\n"
. 'To: ' . $this->getTO() . "\r\n";

Expand All @@ -1233,13 +1235,13 @@ function getHeader()
if ( $this->getBCC() )
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
*/

$host=$this->getHost();
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix

$host=dol_getprefix('email');

//NOTE: Message-ID should probably contain the username of the user who sent the msg
$_header .= 'Subject: ' . $this->getSubject() . "\r\n";
$_header .= 'Date: ' . date("r") . "\r\n";
Expand All @@ -1258,7 +1260,7 @@ function getHeader()
}
if ( $this->getMoreInHeader() )
$_header .= $this->getMoreInHeader(); // Value must include the "\r\n";

//$_header .=
// 'Read-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n"
// 'Return-Receipt-To: ' . $this->getFrom( 'org' ) . "\r\n";
Expand All @@ -1279,9 +1281,10 @@ function getHeader()
$_header .= "Reply-To: ".$this->getReplyTo('addr') ."\r\n";

$_header .= 'X-Mailer: Dolibarr version ' . DOL_VERSION .' (using SMTPs Mailer)' . "\r\n";
$_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART?'MAIN_MAIL_USE_MULTI_PART':'No MAIN_MAIL_USE_MULTI_PART') . "\r\n";
$_header .= 'Mime-Version: 1.0' . "\r\n";


return $_header;
}

Expand Down Expand Up @@ -1310,17 +1313,17 @@ function setBodyContent($strContent, $strType = 'plain')
$strContentAltText = html_entity_decode(strip_tags($strContent));
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
}

// Make RFC2045 Compliant
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.

$this->_msgContent[$strType] = array();

$this->_msgContent[$strType]['mimeType'] = $strMimeType;
$this->_msgContent[$strType]['data'] = $strContent;
$this->_msgContent[$strType]['dataText'] = $strContentAltText;

if ( $this->getMD5flag() )
$this->_msgContent[$strType]['md5'] = dol_hash($strContent, 3);
//}
Expand All @@ -1334,7 +1337,7 @@ function setBodyContent($strContent, $strType = 'plain')
function getBodyContent()
{
global $conf;

// Generate a new Boundary string
$this->_setBoundary();

Expand Down Expand Up @@ -1382,15 +1385,15 @@ function getBodyContent()
$content .= "\r\n";

$content .= "--" . $this->_getBoundary('mixed') . "\r\n";

if (key_exists('image', $this->_msgContent)) // If inline image found
{
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
$content .= "\r\n";
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
}


// $this->_msgContent must be sorted with key 'text' or 'html' first then 'image' then 'attachment'


Expand Down Expand Up @@ -1450,18 +1453,18 @@ function getBodyContent()
$content.= "\r\n";
$content.= "--" . $this->_getBoundary('related') . "\r\n";
}

if (! key_exists('image', $this->_msgContent) && $_content['dataText'] && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
{
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
$content .= "\r\n";
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";

$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
$content.= "\r\n". $_content['dataText'] . "\r\n";
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
}
}

$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
// . 'charset="' . $this->getCharSet() . '"';
. 'charset=' . $this->getCharSet() . '';
Expand All @@ -1483,7 +1486,7 @@ function getBodyContent()
{
$content.= "--" . $this->_getBoundary('alternative') . "--". "\r\n";
}

$content .= "\r\n";
}
}
Expand Down
34 changes: 17 additions & 17 deletions htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -45,28 +45,28 @@ class pdf_einstein extends ModelePDFCommandes
* @var DoliDb Database handler
*/
public $db;

/**
* @var string model name
*/
public $name;

/**
* @var string model description (short text)
*/
public $description;

/**
* @var string document type
*/
public $type;

/**
* @var array() Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.3 = array(5, 3)
*/
public $phpmin = array(5, 2);
public $phpmin = array(5, 2);

/**
* Dolibarr version of the loaded document
* @public string
Expand Down Expand Up @@ -240,11 +240,11 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$pdf->SetAutoPageBreak(1,0);

$heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)

if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
Expand All @@ -263,10 +263,10 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$pdf->SetDrawColor(128,128,128);

$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Order"));
$pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);

$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
Expand Down Expand Up @@ -317,16 +317,16 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
$nexY = $pdf->GetY();
$height_incoterms=$nexY-$tab_top;

// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);

$tab_top = $nexY+6;
$height_incoterms += 4;
}
}

// Affiche notes
$notetoshow=empty($object->note_public)?'':$object->note_public;
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
Expand Down Expand Up @@ -478,7 +478,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
else $tvaligne=$object->lines[$i]->total_tva;

$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
Expand Down Expand Up @@ -585,7 +585,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
$posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs);
}
*/

// Pied de page
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
Expand Down Expand Up @@ -1201,7 +1201,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
* @param string $titlekey Translation key to show as title of document
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="Order")
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle")
{
global $conf,$langs,$hookmanager;

Expand Down Expand Up @@ -1294,7 +1294,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="Order"
$pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R');
}
}

$posy+=2;

// Show list of linked objects
Expand Down

0 comments on commit 3716645

Please sign in to comment.