Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into

develop

Conflicts:
	htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
This commit is contained in:
Laurent Destailleur 2013-04-11 07:39:16 +02:00
commit 792341a4b8
21 changed files with 177 additions and 171 deletions

View File

@ -240,7 +240,9 @@ if ($socid)
} }
// Address // Address
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">'.nl2br($soc->address).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
print dol_print_address($soc->address,'gmap','thirdparty',$object->id);
print '</td></tr>';
// Zip / Town // Zip / Town
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>"; print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -307,7 +307,7 @@ if ($object->fetch($id) >= 0)
print $modulename; print $modulename;
print "</td>"; print "</td>";
*/ */
$nbofrecipient=$obj->getNbOfRecipients(); $nbofrecipient=$obj->getNbOfRecipients('');
print '<td align="center">'; print '<td align="center">';
if ($nbofrecipient >= 0) if ($nbofrecipient >= 0)
{ {
@ -346,21 +346,8 @@ if ($object->fetch($id) >= 0)
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<form action="'.$_SERVER['PHP_SELF'].'?action=clear&id='.$object->id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print_titre($langs->trans("ToClearAllRecipientsClickHere"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="right"><input type="submit" class="button" value="'.$langs->trans("TargetsReset").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
} }
// List of selected targets // List of selected targets
print "\n<!-- Liste destinataires selectionnes -->\n"; print "\n<!-- Liste destinataires selectionnes -->\n";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -383,21 +370,23 @@ if ($object->fetch($id) >= 0)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$parm = "&amp;id=".$object->id; $param = "&amp;id=".$object->id;
if ($search_lastname) $parm.= "&amp;search_lastname=".urlencode($search_lastname); if ($search_lastname) $param.= "&amp;search_lastname=".urlencode($search_lastname);
if ($search_firstname) $parm.= "&amp;search_firstname=".urlencode($search_firstname); if ($search_firstname) $param.= "&amp;search_firstname=".urlencode($search_firstname);
if ($search_email) $parm.= "&amp;search_email=".urlencode($search_email); if ($search_email) $param.= "&amp;search_email=".urlencode($search_email);
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$parm,$sortfield,$sortorder,"",$num,$object->nbemail,''); $cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" class="button" value="'.$langs->trans("TargetsReset").'">';
if ($page) $parm.= "&amp;page=".$page; print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,'');
if ($page) $param.= "&amp;page=".$page;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$parm,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$parm,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$parm,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$parm,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$parm,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sendinf // Date sendinf
if ($object->statut < 2) if ($object->statut < 2)
@ -406,11 +395,11 @@ if ($object->fetch($id) >= 0)
} }
else else
{ {
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$parm,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
} }
// Statut // Statut
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$parm,'','align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print '</tr>'; print '</tr>';
@ -496,7 +485,7 @@ if ($object->fetch($id) >= 0)
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="right" nowrap="nowrap">'.$langs->trans("MailingStatusNotSent"); print '<td align="right" nowrap="nowrap">'.$langs->trans("MailingStatusNotSent");
if ($user->rights->mailing->creer) { if ($user->rights->mailing->creer) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$parm.'">'.img_delete($langs->trans("RemoveRecipient")); print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
} }
print '</td>'; print '</td>';
} }

View File

@ -541,6 +541,7 @@ class Contact extends CommonObject
$this->mail = $obj->email; $this->mail = $obj->email;
$this->birthday = $this->db->jdate($obj->birthday); $this->birthday = $this->db->jdate($obj->birthday);
$this->note = $obj->note_private; // deprecated
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->default_lang = $obj->default_lang; $this->default_lang = $obj->default_lang;

View File

@ -66,6 +66,13 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForSelectType"); $mesg[]=$langs->trans("ErrorNoValueForSelectType");
$action = 'create'; $action = 'create';
} }
if (GETPOST('type')=='sellist' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
$action = 'create';
}
if (GETPOST('type')=='checkbox' && !GETPOST('param')) if (GETPOST('type')=='checkbox' && !GETPOST('param'))
{ {
$error++; $error++;
@ -82,30 +89,30 @@ if ($action == 'add')
} }
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param')) if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox') || (GETPOST('type')=='radio')) && GETPOST('param'))
{ {
// Construct array for parameter (value of select list) // Construct array for parameter (value of select list)
$parameters = GETPOST('param'); $parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters); $parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne) foreach($parameters_array as $param_ligne)
{ {
if (!empty($param_ligne)) { if (!empty($param_ligne)) {
if (preg_match_all('/,/',$param_ligne,$matches)) if (preg_match_all('/,/',$param_ligne,$matches))
{ {
if (count($matches[0])>1) { if (count($matches[0])>1) {
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'create';
}
}
else
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne); $mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'create'; $action = 'create';
} }
} }
else
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorBadFormatValueList",$param_ligne);
$action = 'create';
}
} }
}
} }
if (! $error) if (! $error)
@ -114,6 +121,7 @@ if ($action == 'add')
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname'])) if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
{ {
// Construct array for parameter (value of select list) // Construct array for parameter (value of select list)
$default_value = GETPOST('default_value');
$parameters = GETPOST('param'); $parameters = GETPOST('param');
$parameters_array = explode("\r\n",$parameters); $parameters_array = explode("\r\n",$parameters);
foreach($parameters_array as $param_ligne) foreach($parameters_array as $param_ligne)
@ -186,6 +194,13 @@ if ($action == 'update')
$mesg[]=$langs->trans("ErrorNoValueForSelectType"); $mesg[]=$langs->trans("ErrorNoValueForSelectType");
$action = 'edit'; $action = 'edit';
} }
if (GETPOST('type')=='sellist' && !GETPOST('param'))
{
$error++;
$langs->load("errors");
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
$action = 'edit';
}
if (GETPOST('type')=='checkbox' && !GETPOST('param')) if (GETPOST('type')=='checkbox' && !GETPOST('param'))
{ {
$error++; $error++;

View File

@ -252,18 +252,20 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
// Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes) // Ajout trace sur requete (eventuellement a commenter si beaucoup de requetes)
if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n"; if (! $silent) print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".dol_htmlentities($newsql,ENT_NOQUOTES)."'</td></tr>\n";
dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG); dol_syslog('Admin.lib::run_sql Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
$sqlmodified=0;
// Replace for encrypt data // Replace for encrypt data
if (preg_match_all('/__ENCRYPT\(\'([A-Za-z0-9_\"\[\]]+)\'\)__/i',$newsql,$reg)) if (preg_match_all('/__ENCRYPT\(\'([^\']+)\'\)__/i',$newsql,$reg))
{ {
$num=count($reg[0]); $num=count($reg[0]);
for($i=0;$i<$num;$i++) for($j=0;$j<$num;$j++)
{ {
$from = $reg[0][$i]; $from = $reg[0][$j];
$to = $db->encrypt($reg[1][$i],1); $to = $db->encrypt($reg[1][$j],1);
$newsql = str_replace($from,$to,$newsql); $newsql = str_replace($from,$to,$newsql);
} }
$sqlmodified++;
} }
// Replace for decrypt data // Replace for decrypt data
@ -271,12 +273,13 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
{ {
$num=count($reg[0]); $num=count($reg[0]);
for($i=0;$i<$num;$i++) for($j=0;$j<$num;$j++)
{ {
$from = $reg[0][$i]; $from = $reg[0][$j];
$to = $db->decrypt($reg[1][$i]); $to = $db->decrypt($reg[1][$j]);
$newsql = str_replace($from,$to,$newsql); $newsql = str_replace($from,$to,$newsql);
} }
$sqlmodified++;
} }
// Replace __x__ with rowid of insert nb x // Replace __x__ with rowid of insert nb x
@ -294,9 +297,11 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker
$from='__'.$cursor.'__'; $from='__'.$cursor.'__';
$to=$listofinsertedrowid[$cursor]; $to=$listofinsertedrowid[$cursor];
$newsql=str_replace($from,$to,$newsql); $newsql=str_replace($from,$to,$newsql);
dol_syslog('Admin.lib::run_sql New Request '.($i+1).' (replacing '.$from.' to '.$to.') sql='.$newsql, LOG_DEBUG); $sqlmodified++;
} }
if ($sqlmodified) dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
$result=$db->query($newsql,$usesavepoint); $result=$db->query($newsql,$usesavepoint);
if ($result) if ($result)
{ {

View File

@ -1,7 +1,6 @@
#!/usr/bin/php
<?php <?php
/* /*
* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,10 +40,11 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
* @param date $paymentdateafter Payment after date * @param date $paymentdateafter Payment after date
* @param date $paymentdatebefore Payment before date * @param date $paymentdatebefore Payment before date
* @param int $usestdout Add information onto standard output * @param int $usestdout Add information onto standard output
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template, * @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
* @param string $option Suffix to add into file name of generated PDF
* @return int Error code * @return int Error code
*/ */
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0) function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='')
{ {
$sql = "SELECT DISTINCT f.rowid, f.facnumber"; $sql = "SELECT DISTINCT f.rowid, f.facnumber";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
@ -165,8 +165,8 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if ($result <= 0) if ($result <= 0)
{ {
$error++; $error++;
if ($usestdout) print "Error: Failed to build PDF for invoice ".$fac->ref."\n"; if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
else dol_syslog("Failed to build PDF for invoice ".$fac->ref, LOG_ERR); else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
} }
$cpt++; $cpt++;
@ -193,7 +193,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$pdf->setPrintHeader(false); $pdf->setPrintHeader(false);
$pdf->setPrintFooter(false); $pdf->setPrintFooter(false);
} }
$pdf->SetFont(pdf_getPDFFont($outputlangs)); $pdf->SetFont(pdf_getPDFFont($langs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
//$pdf->SetCompression(false); //$pdf->SetCompression(false);
@ -229,16 +229,21 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$filename='mergedpdf'; $filename='mergedpdf';
if (! empty($option)) $filename.='_'.$option; if (! empty($option)) $filename.='_'.$option;
$file=$diroutputpdf.'/'.$filename.'.pdf';
if ($pagecount) if (! $error && $pagecount)
{ {
$file=$diroutputpdf.'/'.$filename.'.pdf';
$pdf->Output($file,'F'); $pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK)) if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK)); @chmod($file, octdec($conf->global->MAIN_UMASK));
} }
if ($usestdout) print "Merged PDF has been built in ".$file."\n"; if ($usestdout)
{
if (! $error) print "Merged PDF has been built in ".$file."\n";
else print "Can't build PDF ".$file."\n";
}
$result = 1; $result = 1;
} }
else else

View File

@ -71,11 +71,8 @@ class mailing_contacts1 extends MailingTargets
$statssql=array(); $statssql=array();
$statssql[0] = "SELECT '".$langs->trans("NbOfCompaniesContacts")."' as label,"; $statssql[0] = "SELECT '".$langs->trans("NbOfCompaniesContacts")."' as label,";
$statssql[0].= " count(distinct(c.email)) as nb"; $statssql[0].= " count(distinct(c.email)) as nb";
$statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $statssql[0].= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0].= " ".MAIN_DB_PREFIX."societe as s"; $statssql[0].= " WHERE c.entity IN (".getEntity('societe', 1).")";
$statssql[0].= " WHERE s.rowid = c.fk_soc";
$statssql[0].= " AND c.entity IN (".getEntity('societe', 1).")";
$statssql[0].= " AND s.client IN (1, 3)";
$statssql[0].= " AND c.email != ''"; // Note that null != '' is false $statssql[0].= " AND c.email != ''"; // Note that null != '' is false
$statssql[0].= " AND c.no_email = 0"; $statssql[0].= " AND c.no_email = 0";
@ -96,12 +93,11 @@ class mailing_contacts1 extends MailingTargets
global $conf; global $conf;
$sql = "SELECT count(distinct(c.email)) as nb"; $sql = "SELECT count(distinct(c.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE s.rowid = c.fk_soc"; $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql .= " AND c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND c.email != ''"; // Note that null != '' is false
$sql .= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.no_email = 0";
$sql .= " AND c.no_email = 0";
// La requete doit retourner un champ "nb" pour etre comprise // La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients // par parent::getNbOfRecipients
@ -203,10 +199,9 @@ class mailing_contacts1 extends MailingTargets
$sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,"; $sql = "SELECT c.rowid as id, c.email as email, c.rowid as fk_contact,";
$sql.= " c.lastname, c.firstname, c.civilite,"; $sql.= " c.lastname, c.firstname, c.civilite,";
$sql.= " s.nom as companyname"; $sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql.= " WHERE s.rowid = c.fk_soc"; $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; $sql.= " AND c.email != ''";
$sql.= " AND c.no_email = 0"; $sql.= " AND c.no_email = 0";
foreach($filtersarray as $key) foreach($filtersarray as $key)

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net> /* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
* Copyright (C) 2013 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -80,14 +81,13 @@ class mailing_contacts2 extends MailingTargets
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
$sql.= " sp.lastname, sp.firstname as firstname, sp.civilite,"; $sql.= " sp.lastname, sp.firstname as firstname, sp.civilite,";
$sql.= " s.nom as companyname"; $sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
$sql.= " WHERE s.rowid = sp.fk_soc"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.poste != ''"; //$sql.= " AND sp.poste != ''";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$filtersarray[0]."'";
$sql.= " ORDER BY sp.lastname, sp.firstname"; $sql.= " ORDER BY sp.lastname, sp.firstname";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -162,10 +162,9 @@ class mailing_contacts2 extends MailingTargets
// Number with a filter are show in the combo list for each filter. // Number with a filter are show in the combo list for each filter.
// If we want a filter "a position is defined", we must add it into formFilter // If we want a filter "a position is defined", we must add it into formFilter
$sql = "SELECT count(distinct(sp.email)) as nb"; $sql = "SELECT count(distinct(sp.email)) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
$sql.= " WHERE s.rowid = sp.fk_soc"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
//$sql.= " AND sp.poste != ''"; //$sql.= " AND sp.poste != ''";
@ -187,10 +186,8 @@ class mailing_contacts2 extends MailingTargets
$langs->load("companies"); $langs->load("companies");
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " WHERE s.rowid = sp.fk_soc";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false $sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')"; $sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";

View File

@ -79,12 +79,11 @@ class mailing_contacts3 extends MailingTargets
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,"; $sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
$sql.= " sp.lastname, sp.firstname, sp.civilite,"; $sql.= " sp.lastname, sp.firstname, sp.civilite,";
$sql.= " s.nom as companyname"; $sql.= " s.nom as companyname";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c";
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie as c,"; if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
if ($filtersarray[0] <> 'all') $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
$sql.= " WHERE s.rowid = sp.fk_soc"; $sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid"; if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
@ -168,10 +167,9 @@ class mailing_contacts3 extends MailingTargets
// Number with a filter are show in the combo list for each filter. // Number with a filter are show in the combo list for each filter.
// If we want a filter "is inside at least one category", we must add it into formFilter // If we want a filter "is inside at least one category", we must add it into formFilter
$sql = "SELECT count(distinct(c.email)) as nb"; $sql = "SELECT count(distinct(c.email)) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql.= " WHERE s.rowid = c.fk_soc"; $sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; // Note that null != '' is false $sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0"; $sql.= " AND c.no_email = 0";
/* /*
@ -205,11 +203,9 @@ class mailing_contacts3 extends MailingTargets
$sql = "SELECT c.label, count(distinct(sp.email)) AS nb"; $sql = "SELECT c.label, count(distinct(sp.email)) AS nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."categorie as c,"; $sql.= " ".MAIN_DB_PREFIX."categorie as c,";
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE s.rowid = sp.fk_soc"; $sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql.= " AND sp.no_email = 0";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")"; $sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND cs.fk_categorie = c.rowid"; $sql.= " AND cs.fk_categorie = c.rowid";

View File

@ -82,7 +82,7 @@ class mailing_pomme extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * emails from a text file, this function must return 500.
* *
* @param string $sql Requete sql de comptage * @param string $sql SQL request to use to count
* @return int Number of recipients * @return int Number of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -175,7 +175,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
* For example if this selector is used to extract 500 different * For example if this selector is used to extract 500 different
* emails from a text file, this function must return 500. * emails from a text file, this function must return 500.
* *
* @param string $sql Request * @param string $sql SQL request to use to count
* @return int Number of recipients * @return int Number of recipients
*/ */
function getNbOfRecipients($sql='') function getNbOfRecipients($sql='')

View File

@ -26,18 +26,18 @@ create table llx_adherent_type_extrafields
) ENGINE=innodb; ) ENGINE=innodb;
ALTER TABLE llx_adherent_type_extrafields ADD INDEX idx_adherent_type_extrafields (fk_object); ALTER TABLE llx_adherent_type_extrafields ADD INDEX idx_adherent_type_extrafields (fk_object);
UPDATE llx_const set value='eldy_menu.php' where value='eldy_backoffice.php'; UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_backoffice.php';
UPDATE llx_const set value='eldy_menu.php' where value='eldy_frontoffice.php'; UPDATE llx_const set value = __ENCRYPT('eldy_menu.php')__ where __DECRYPT('value')__ = 'eldy_frontoffice.php';
UPDATE llx_const set value='auguria_menu.php' where value='auguria_backoffice.php'; UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_backoffice.php';
UPDATE llx_const set value='auguria_menu.php' where value='auguria_frontoffice.php'; UPDATE llx_const set value = __ENCRYPT('auguria_menu.php')__ where __DECRYPT('value')__ = 'auguria_frontoffice.php';
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_backoffice.php'; UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_backoffice.php';
UPDATE llx_const set value='smartphone_menu.php' where value='smartphone_frontoffice.php'; UPDATE llx_const set value = __ENCRYPT('smartphone_menu.php')__ where __DECRYPT('value')__ = 'smartphone_frontoffice.php';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_ADDRESS' where name='MAIN_INFO_SOCIETE_ADRESSE'; UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ADDRESS')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_ADRESSE';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_TOWN' where name='MAIN_INFO_SOCIETE_VILLE'; UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_TOWN')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_VILLE';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_ZIP' where name='MAIN_INFO_SOCIETE_CP'; UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_ZIP')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_CP';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_COUNTRY' where name='MAIN_INFO_SOCIETE_PAYS'; UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_COUNTRY')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_PAYS';
UPDATE llx_const set name='MAIN_INFO_SOCIETE_STATE' where name='MAIN_INFO_SOCIETE_DEPARTEMENT'; UPDATE llx_const set name = __ENCRYPT('MAIN_INFO_SOCIETE_STATE')__ where __DECRYPT('name')__ = 'MAIN_INFO_SOCIETE_DEPARTEMENT';
UPDATE llx_const set name='LIVRAISON_ADDON_NUMBER' where name='LIVRAISON_ADDON'; UPDATE llx_const set name = __ENCRYPT('LIVRAISON_ADDON_NUMBER')__ where __DECRYPT('name')__ = 'LIVRAISON_ADDON';
ALTER TABLE llx_user add COLUMN fk_user integer; ALTER TABLE llx_user add COLUMN fk_user integer;

View File

@ -82,16 +82,16 @@ ActivateCheckReadKey=Key use to encrypt URL use for "Read Receipt" and "Unsubcri
EMailSentToNRecipients=EMail sent to %s recipients. EMailSentToNRecipients=EMail sent to %s recipients.
# Libelle des modules de liste de destinataires mailing # Libelle des modules de liste de destinataires mailing
MailingModuleDescContactCompanies=Contacts of all third parties (customer, prospect, supplier, ...) MailingModuleDescContactCompanies=Contacts/addresses of all third parties (customer, prospect, supplier, ...)
MailingModuleDescDolibarrUsers=Dolibarr users MailingModuleDescDolibarrUsers=Dolibarr users
MailingModuleDescFundationMembers=Foundation members with emails MailingModuleDescFundationMembers=Foundation members with emails
MailingModuleDescEmailsFromFile=EMails from a text file (email;lastname;firstname;other) MailingModuleDescEmailsFromFile=EMails from a text file (email;lastname;firstname;other)
MailingModuleDescEmailsFromUser=EMails from user input (email;lastname;firstname;other) MailingModuleDescEmailsFromUser=EMails from user input (email;lastname;firstname;other)
MailingModuleDescContactsCategories=Third parties (by category) MailingModuleDescContactsCategories=Third parties (by category)
MailingModuleDescDolibarrContractsLinesExpired=Third parties with expired contract's lines MailingModuleDescDolibarrContractsLinesExpired=Third parties with expired contract's lines
MailingModuleDescContactsByCompanyCategory=Contacts of third parties (by third parties category) MailingModuleDescContactsByCompanyCategory=Contacts/addresses of third parties (by third parties category)
MailingModuleDescMembersCategories=Foundation members (by categories) MailingModuleDescMembersCategories=Foundation members (by categories)
MailingModuleDescContactsByFunction=Contacts of third parties (by position/function) MailingModuleDescContactsByFunction=Contacts/addresses of third parties (by position/function)
LineInFile=Line %s in file LineInFile=Line %s in file
@ -100,7 +100,7 @@ MailSelectedRecipients=Selected recipients
MailingArea=EMailings area MailingArea=EMailings area
LastMailings=Last %s emailings LastMailings=Last %s emailings
TargetsStatistics=Targets statistics TargetsStatistics=Targets statistics
NbOfCompaniesContacts=Unique contacts of companies NbOfCompaniesContacts=Unique contacts/addresses
MailNoChangePossible=Recipients for validated emailing can't be changed MailNoChangePossible=Recipients for validated emailing can't be changed
SearchAMailing=Search mailing SearchAMailing=Search mailing
SendMailing=Send emailing SendMailing=Send emailing

View File

@ -99,7 +99,7 @@ MailSelectedRecipients=Destinataires sélectionnés
MailingArea=Espace emailings MailingArea=Espace emailings
LastMailings=Les %s derniers emailings LastMailings=Les %s derniers emailings
TargetsStatistics=Statistiques destinataires TargetsStatistics=Statistiques destinataires
NbOfCompaniesContacts=Contacts uniques des sociétés NbOfCompaniesContacts=Contacts/adresses uniques
MailNoChangePossible=Destinataires d'un mailing validé non modifiables MailNoChangePossible=Destinataires d'un mailing validé non modifiables
SearchAMailing=Rechercher un mailing SearchAMailing=Rechercher un mailing
SendMailing=Envoi emailing SendMailing=Envoi emailing

View File

@ -106,7 +106,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans('ThirdPartyName').'</td>'; print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>'; print '</td></tr>';

View File

@ -133,7 +133,7 @@ if ($object->id)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
// Ref // Ref
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td>'; print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>'; print '</td></tr>';

View File

@ -92,7 +92,7 @@ if ($id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>'; print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>'; print '</td></tr>';
@ -124,6 +124,7 @@ if ($id > 0)
print '<br>'; print '<br>';
$colwidth='25';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -141,7 +141,7 @@ if ($result > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
print '<tr><td width="20%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
print '</td></tr>'; print '</td></tr>';
@ -169,7 +169,7 @@ if ($result > 0)
print '</td></tr>'; print '</td></tr>';
} }
print '<tr><td width="30%">'.$langs->trans("NbOfActiveNotifications").'</td>'; print '<tr><td>'.$langs->trans("NbOfActiveNotifications").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$sql = "SELECT COUNT(n.rowid) as nb"; $sql = "SELECT COUNT(n.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n"; $sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n";

View File

@ -1465,7 +1465,7 @@ else
*/ */
// Name // Name
print '<tr><td width="20%">'.$langs->trans('ThirdPartyName').'</td>'; print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showrefnav($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); print $form->showrefnav($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '</td>'; print '</td>';

View File

@ -174,6 +174,7 @@ select.flat {
border-top:solid 1px rgba(0,0,0,.4); border-top:solid 1px rgba(0,0,0,.4);
border-bottom:solid 1px rgba(0,0,0,.2); border-bottom:solid 1px rgba(0,0,0,.2);
box-shadow:1px 1px 2px rgba(0,0,0,.2) inset; box-shadow:1px 1px 2px rgba(0,0,0,.2) inset;
background: #FDFDFD;
} }
form { form {

View File

@ -36,7 +36,6 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
// Include Dolibarr environment // Include Dolibarr environment
require_once($path."../../htdocs/master.inc.php"); require_once($path."../../htdocs/master.inc.php");
// After this $db is an opened handler to database. We close it at end of file. // After this $db is an opened handler to database. We close it at end of file.
require_once(DOL_DOCUMENT_ROOT."/cron/functions_cron.lib.php");
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/core/modules/facture/modules_facture.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
@ -179,7 +178,7 @@ if (in_array('payments',$filter) && in_array('nopayment',$filter))
// Define SQL and SQL request to select invoices // Define SQL and SQL request to select invoices
// Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore // Use $filter, $dateafterdate, datebeforedate, $paymentdateafter, $paymentdatebefore
$result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate); $result=rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, 1, $regenerate, $option);