Merge remote-tracking branch 'origin/3.8' into develop
Conflicts: htdocs/accountancy/bookkeeping/list.php htdocs/accountancy/customer/list.php htdocs/accountancy/journal/bankjournal.php htdocs/core/lib/date.lib.php htdocs/core/lib/report.lib.php htdocs/langs/en_US/accountancy.lang
0
build/.gitignore
vendored
Executable file → Normal file
0
build/aps/APP-META-1.1.xml
Executable file → Normal file
0
build/aps/APP-META-1.2.xml
Executable file → Normal file
0
build/aps/README
Executable file → Normal file
1
build/aps/install.forced.php.install
Executable file → Normal file
@ -21,4 +21,3 @@ $force_install_databaserootpass='';
|
||||
$force_install_dolibarrlogin='admin';
|
||||
$force_install_nophpinfo='1';
|
||||
$force_install_lockinstall='444';
|
||||
?>
|
||||
2
build/debian/conf.php.install
Executable file → Normal file
@ -226,5 +226,3 @@ $dolibarr_main_prod='0';
|
||||
# Default value: 0 (use database value if exist)
|
||||
# Examples:
|
||||
# $dolibarr_mailing_limit_sendbyweb='0';
|
||||
|
||||
?>
|
||||
|
||||
0
build/debian/dolibarr.install
Executable file → Normal file
0
build/debian/dolibarr.lintian-overrides
Executable file → Normal file
0
build/debian/dolibarr.templates.futur
Executable file → Normal file
2
build/debian/install.forced.php.install
Executable file → Normal file
@ -42,5 +42,3 @@ $force_install_lockinstall='444';
|
||||
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
|
||||
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
|
||||
//$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf';
|
||||
|
||||
?>
|
||||
0
build/debian/po/POTFILES.in
Executable file → Normal file
0
build/debian/po/fr.po
Executable file → Normal file
0
build/doxygen/doxygen_footer.html
Executable file → Normal file
0
build/doxygen/doxygen_header.html
Executable file → Normal file
0
build/rpm/conf.php
Executable file → Normal file
0
build/rpm/dolibarr-forrpm.patch
Executable file → Normal file
0
build/rpm/dolibarr.desktop
Executable file → Normal file
0
build/rpm/file_contexts.dolibarr
Executable file → Normal file
2
build/rpm/install.forced.php.fedora
Executable file → Normal file
@ -31,5 +31,3 @@ $force_dolibarr_lib_TCPDF_PATH='';
|
||||
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
|
||||
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
|
||||
$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf';
|
||||
|
||||
?>
|
||||
1
build/rpm/install.forced.php.generic
Executable file → Normal file
@ -20,4 +20,3 @@ $force_install_lockinstall='444';
|
||||
|
||||
// Value to overwrite path to use shared libraries/fonts instead of embedded one
|
||||
// We don't force any external lib with generic package
|
||||
?>
|
||||
2
build/rpm/install.forced.php.mandriva
Executable file → Normal file
@ -31,5 +31,3 @@ $force_dolibarr_lib_TCPDF_PATH='';
|
||||
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
|
||||
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
|
||||
$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/TTF/dejavu/DejaVuSans-Bold.ttf';
|
||||
|
||||
?>
|
||||
2
build/rpm/install.forced.php.opensuse
Executable file → Normal file
@ -31,5 +31,3 @@ $force_dolibarr_lib_TCPDF_PATH='';
|
||||
//$force_dolibarr_js_JQUERY_UI='/javascript/jquery-ui';
|
||||
//$force_dolibarr_js_JQUERY_FLOT='/javascript/flot';
|
||||
$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD='/usr/share/fonts/truetype/DejaVuSans-Bold.ttf';
|
||||
|
||||
?>
|
||||
0
dev/codesniffer/README
Executable file → Normal file
0
dev/codesniffer/php.ini
Executable file → Normal file
0
dev/codesniffer/ruleset.dtd
Executable file → Normal file
0
dev/codesniffer/ruleset.xml
Executable file → Normal file
0
dev/codetemplates/README
Executable file → Normal file
0
dev/codetemplates/codetemplates.dtd
Executable file → Normal file
0
dev/codetemplates/codetemplates.xml
Executable file → Normal file
0
dev/examples/README
Executable file → Normal file
0
dev/iso-normes/GURULABS-RPM-GUIDE-v1.0.PDF
Executable file → Normal file
0
dev/iso-normes/address_format.txt
Executable file → Normal file
0
dev/iso-normes/banknumber_format.txt
Executable file → Normal file
0
dev/iso-normes/xmlexport.txt
Executable file → Normal file
0
dev/phpunit/README
Executable file → Normal file
0
dev/phpunit/eclipse_setup_for_pti_phpunit.png
Executable file → Normal file
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
0
dev/skeletons/build_webservice_from_class.php
Normal file → Executable file
0
doc/images/appicon_128.png
Executable file → Normal file
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
0
doc/images/appicon_16.ico
Executable file → Normal file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
doc/images/appicon_16.png
Executable file → Normal file
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
0
doc/images/appicon_32.png
Executable file → Normal file
|
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 867 B |
0
doc/images/appicon_48.ico
Executable file → Normal file
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
0
doc/images/appicon_64.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
doc/images/dolibarr_73x73.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
doc/images/dolibarr_logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@ -84,6 +84,19 @@ elseif ($action == 'delbookkeepingyear') {
|
||||
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
|
||||
if (! empty($delyear)) {
|
||||
$object = new BookKeeping($db);
|
||||
$result = $object->delete_by_year($delyear);
|
||||
Header("Location: list.php");
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'delbookkeepingyear') {
|
||||
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
|
||||
if (! empty($delyear)) {
|
||||
$object = new BookKeeping($db);
|
||||
$result = $object->delete_by_year($delyear);
|
||||
|
||||
@ -725,7 +725,7 @@ if ($id > 0)
|
||||
{
|
||||
$contratstatic=new Contrat($db);
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc";
|
||||
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_supplier as refsup";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql.= " AND s.rowid = ".$object->id;
|
||||
@ -742,7 +742,7 @@ if ($id > 0)
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td></tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -759,7 +759,9 @@ if ($id > 0)
|
||||
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
|
||||
print $contrat->getNomUrl(1,12);
|
||||
print "</td>\n";
|
||||
print '<td class="nowrap">'.dol_trunc($objp->refsup,12)."</td>\n";
|
||||
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
||||
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dcon),'day')."</td>\n";
|
||||
print '<td width="20"> </td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
$contrat->fetch_lines();
|
||||
|
||||
@ -554,11 +554,11 @@ class Mailing extends CommonObject
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $langs->trans($this->statut_dest[$statut]);
|
||||
return $langs->trans('MailingStatusError');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
return $langs->trans($this->statut_dest[$statut]);
|
||||
return $langs->trans('MailingStatusSent');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
|
||||
@ -115,7 +115,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
|
||||
$error=0;
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
$object->km = GETPOST('km','int');
|
||||
$object->km = price2num(GETPOST('km','alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type','alpha');
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->fk_user = GETPOST('fk_user','int');
|
||||
@ -174,7 +174,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer)
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
$object->km = GETPOST('km','int');
|
||||
$object->km = price2num(GETPOST('km','alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type','alpha');
|
||||
$object->socid = GETPOST('socid','int');
|
||||
$object->fk_user = GETPOST('fk_user','int');
|
||||
|
||||
@ -70,6 +70,11 @@ $diroutputpdf=$conf->facture->dir_output . '/unpaid/temp';
|
||||
if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
$resultmasssend='';
|
||||
if (GETPOST('buttonsendremind'))
|
||||
{
|
||||
$action='presend';
|
||||
$mode='sendmassremind';
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
|
||||
{
|
||||
@ -122,15 +127,90 @@ if ($action == 'presend' && GETPOST('sendmail'))
|
||||
$nbsent = 0;
|
||||
$nbignored = 0;
|
||||
|
||||
for ($i = 0; $i < $countToSend; $i++)
|
||||
$arrayofinvoices=GETPOST('toSend','array');
|
||||
|
||||
$thirdparty=new Societe($db);
|
||||
$invoicetmp=new Facture($db);
|
||||
$listofinvoicesid=array();
|
||||
$listofinvoicesthirdparties=array();
|
||||
$listofinvoicesref=array();
|
||||
foreach($arrayofinvoices as $invoiceid)
|
||||
{
|
||||
$object = new Facture($db);
|
||||
$result = $object->fetch($_POST['toSend'][$i]);
|
||||
|
||||
if ($result > 0) // Invoice was found
|
||||
$invoicetmp=new Facture($db); // must create new instance because instance is saved into $listofinvoicesref array for future use
|
||||
$result=$invoicetmp->fetch($invoiceid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$invoiceid]=$invoiceid;
|
||||
$thirdpartyid=$invoicetmp->fk_soc?$invoicetmp->fk_soc:$invoicetmp->socid;
|
||||
$listofinvoicesthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofinvoicesref[$thirdpartyid][$invoiceid]=$invoicetmp;
|
||||
}
|
||||
}
|
||||
//var_dump($listofinvoicesref);exit;
|
||||
|
||||
foreach ($listofinvoicesthirdparties as $thirdpartyid)
|
||||
{
|
||||
$result = $thirdparty->fetch($thirdpartyid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define recipient $sendto and $sendtocc
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
// Recipient is provided into free text
|
||||
$sendto = trim($_POST['sendto']);
|
||||
$sendtoid = 0;
|
||||
}
|
||||
elseif ($_POST['receiver'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email');
|
||||
$sendtoid = $_POST['receiver'];
|
||||
}
|
||||
}
|
||||
if (trim($_POST['sendtocc']))
|
||||
{
|
||||
$sendtocc = trim($_POST['sendtocc']);
|
||||
}
|
||||
elseif ($_POST['receivercc'] != '-1')
|
||||
{
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receivercc'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendtocc = $thirdparty->email;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($listofinvoicesref[$thirdpartyid]);
|
||||
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedinvoice=array();
|
||||
$listofqualifiedref=array();
|
||||
foreach($listofinvoicesref[$thirdpartyid] as $invoiceid => $invoice)
|
||||
{
|
||||
//var_dump($invoice);
|
||||
$object = $invoice;
|
||||
//$object = new Facture($db);
|
||||
//$result = $object->fetch();
|
||||
//var_dump($thirdpartyid.' - '.$invoiceid.' - '.$object->statut);
|
||||
|
||||
if ($object->statut != Facture::STATUS_VALIDATED)
|
||||
{
|
||||
$nbignored++;
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
@ -144,108 +224,30 @@ if ($action == 'presend' && GETPOST('sendmail'))
|
||||
|
||||
if (dol_is_file($file))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
if (empty($sendto)) $nbignored++;
|
||||
if (empty($sendto))
|
||||
{
|
||||
$nbignored++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$from = $user->getFullName($langs) . ' <' . $user->email .'>';
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject');
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
|
||||
$substitutionarray=array(
|
||||
'__ID__' => $object->id,
|
||||
'__EMAIL__' => $object->thirdparty->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
//'__LASTNAME__' => $obj2->lastname,
|
||||
//'__FIRSTNAME__' => $obj2->firstname,
|
||||
'__FACREF__' => $object->ref, // For backward compatibility
|
||||
'__REF__' => $object->ref,
|
||||
'__REFCLIENT__' => $object->thirdparty->name
|
||||
);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
$actiontypecode='AC_FAC';
|
||||
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message)
|
||||
{
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
// Create form object
|
||||
$attachedfiles=array('paths'=>array($file), 'names'=>array($filename), 'mimes'=>array($mime));
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resultmasssend.='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$resultmasssend.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
||||
|
||||
$error=0;
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = 0;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$resultmasssend.=$langs->trans("MailSent").': '.$sendto."<br>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$nbsent++;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resultmasssend.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$resultmasssend.='<br><div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultmasssend.='<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
|
||||
$listofqualifiedinvoice[$invoiceid]=$invoice;
|
||||
$listofqualifiedref[$invoiceid]=$invoice->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -253,6 +255,109 @@ if ($action == 'presend' && GETPOST('sendmail'))
|
||||
$langs->load("other");
|
||||
$resultmasssend.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
if (count($listofqualifiedinvoice) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
$from = $user->getFullName($langs) . ' <' . $user->email .'>';
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject');
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
|
||||
$substitutionarray=array(
|
||||
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
|
||||
'__EMAIL__' => $thirdparty->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||
//'__LASTNAME__' => $obj2->lastname,
|
||||
//'__FIRSTNAME__' => $obj2->firstname,
|
||||
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__REF__' => join(', ',$listofqualifiedref),
|
||||
'__REFCLIENT__' => $thirdparty->name
|
||||
);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
//var_dump($filepath);
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resultmasssend.='<div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$result=$mailfile->sendfile();
|
||||
if ($result)
|
||||
{
|
||||
$resultmasssend.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
|
||||
|
||||
$error=0;
|
||||
|
||||
foreach($listofqualifiedinvoice as $invid => $object)
|
||||
{
|
||||
$actiontypecode='AC_FAC';
|
||||
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message)
|
||||
{
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = 0;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
$object->actionmsg = $actionmsg; // Long text
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->fk_element = $invid;
|
||||
$object->elementtype = $invoice->element;
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$resultmasssend.=$langs->trans("MailSent").': '.$sendto."<br>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$nbsent++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("other");
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$resultmasssend.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
|
||||
$resultmasssend.='<br><div class="error">'.$mailfile->error.'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultmasssend.='<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -417,7 +522,6 @@ $search_societe = GETPOST("search_societe");
|
||||
$search_paymentmode = GETPOST("search_paymentmode");
|
||||
$search_montant_ht = GETPOST("search_montant_ht");
|
||||
$search_montant_ttc = GETPOST("search_montant_ttc");
|
||||
$search_status = GETPOST("search_status");
|
||||
$late = GETPOST("late");
|
||||
|
||||
// Do we click on purge search criteria ?
|
||||
@ -429,7 +533,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_paymentmode='';
|
||||
$search_montant_ht='';
|
||||
$search_montant_ttc='';
|
||||
$search_status='';
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@ -485,7 +588,6 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
|
||||
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
|
||||
if ($search_status) $sql .= " AND f.fk_statut = ".$search_status;
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0)
|
||||
@ -531,7 +633,6 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode);
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht);
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_status) $param.='&search_status='.urlencode($search_status);
|
||||
if ($late) $param.='&late='.urlencode($late);
|
||||
if ($mode) $param.='&mode='.urlencode($mode);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
@ -551,6 +652,31 @@ if ($resql)
|
||||
print load_fiche_titre($titre,$link);
|
||||
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
|
||||
|
||||
$arrayofinvoices=GETPOST('toSend','array');
|
||||
if ($action == 'presend' && count($arrayofinvoices) == 0 && ! GETPOST('cancel'))
|
||||
{
|
||||
setEventMessages($langs->trans("InvoiceNotChecked"), null, 'errors');
|
||||
$action='list';
|
||||
$mode='sendmassremind';
|
||||
}
|
||||
else
|
||||
{
|
||||
$invoicetmp=new Facture($db);
|
||||
$listofinvoicesid=array();
|
||||
$listofinvoicesthirdparties=array();
|
||||
$listofinvoicesref=array();
|
||||
foreach($arrayofinvoices as $invoiceid)
|
||||
{
|
||||
$result=$invoicetmp->fetch($invoiceid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofinvoicesid[$invoiceid]=$invoiceid;
|
||||
$thirdpartyid=$invoicetmp->fk_soc?$invoicetmp->fk_soc:$invoicetmp->socid;
|
||||
$listofinvoicesthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofinvoicesref[$thirdpartyid][$invoiceid]=$invoicetmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<form id="form_unpaid" method="POST" action="'.$_SERVER["PHP_SELF"].'?sortfield='. $sortfield .'&sortorder='. $sortorder .'">';
|
||||
|
||||
if (GETPOST('modelselected')) {
|
||||
@ -584,10 +710,25 @@ if ($resql)
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
$formmail->withto=$langs->trans("AllRecipientSelectedForRemind");
|
||||
$liste=$langs->trans("AllRecipientSelectedForRemind");
|
||||
if (count($listofinvoicesthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofinvoicesthirdparties);
|
||||
$soc=new Societe($db);
|
||||
$soc->fetch($thirdpartyid);
|
||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
||||
{
|
||||
$liste[$key]=$value;
|
||||
}
|
||||
$formmail->withtoreadonly=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$formmail->withtoreadonly=1;
|
||||
}
|
||||
$formmail->withto=$liste;
|
||||
$formmail->withtofree=0;
|
||||
$formmail->withtoreadonly=1;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
@ -606,7 +747,7 @@ if ($resql)
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid']=$object->id;
|
||||
$formmail->param['facid']=join(',',$arrayofinvoices);
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
@ -841,7 +982,9 @@ if ($resql)
|
||||
{
|
||||
// Checkbox to send remind
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($objp->email) print '<input class="flat checkforsend" type="checkbox" name="toSend[]" value="'.$objp->facid.'">';
|
||||
$selected=0;
|
||||
if (in_array($objp->facid, $arrayofinvoices)) $selected=1;
|
||||
if ($objp->email) print '<input class="flat checkforsend" type="checkbox" name="toSend[]" value="'.$objp->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||
else print img_picto($langs->trans("NoEMail"), 'warning.png');
|
||||
print '</td>' ;
|
||||
}
|
||||
@ -888,7 +1031,7 @@ if ($resql)
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=sendremind&action=presend" class="butAction" name="buttonsendremind" value="'.dol_escape_htmltag($langs->trans("SendRemind")).'">'.$langs->trans("SendRemind").'</a>';
|
||||
print '<input type="submit" class="butAction" name="buttonsendremind" value="'.dol_escape_htmltag($langs->trans("SendRemind")).'">';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
@ -830,7 +830,7 @@ class ExtraFields
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlwhere.= ' WHERE 1';
|
||||
$sqlwhere.= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
@ -1015,7 +1015,7 @@ class ExtraFields
|
||||
$sqlwhere .= ' WHERE ' . $InfoFieldList[4];
|
||||
}
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE 1';
|
||||
$sqlwhere .= ' WHERE 1=1';
|
||||
}
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
|
||||
0
htdocs/core/filemanagerdol/browser/default/browser.css
Executable file → Normal file
0
htdocs/core/filemanagerdol/browser/default/images/Folder.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
0
htdocs/core/filemanagerdol/browser/default/images/FolderUp.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/ai.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/avi.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/bmp.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 709 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/cs.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 224 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/default.icon.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 177 B After Width: | Height: | Size: 177 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/dll.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/doc.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/exe.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/fla.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 946 B After Width: | Height: | Size: 946 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/gif.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/htm.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/html.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/jpg.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/js.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/mdb.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/mp3.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/pdf.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/png.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/ppt.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/rdp.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/swf.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 725 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/swt.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 724 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/txt.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/vsd.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/xls.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/xml.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 408 B After Width: | Height: | Size: 408 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/32/zip.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 368 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/ai.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 403 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/avi.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/bmp.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 126 B After Width: | Height: | Size: 126 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/cs.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/default.icon.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 113 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/dll.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/doc.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/exe.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 109 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/fla.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/gif.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/htm.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/html.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/jpg.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/js.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/mdb.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/mp3.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/pdf.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/png.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
0
htdocs/core/filemanagerdol/browser/default/images/icons/ppt.gif
Executable file → Normal file
|
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |