Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
0e1772cf66
@ -11,9 +11,10 @@ NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The methode "cloture" on contact were renamed into "closeAll".
|
||||
|
||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||
__PROPALREF__, ...)
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
@ -366,7 +366,9 @@ if ($nboftargetok) {
|
||||
}
|
||||
else # For a maintenance release
|
||||
{
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
|
||||
}
|
||||
print "\n";
|
||||
if (! $ret)
|
||||
|
||||
@ -60,14 +60,14 @@ $db->begin();
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||
|
||||
// Create invoice object
|
||||
// Create user object
|
||||
$obj = new User($db);
|
||||
//$obj->initAsSpecimen();
|
||||
|
||||
$obj->login = 'ABCDEF';
|
||||
$obj->nom = 'ABCDEF';
|
||||
|
||||
// Create invoice
|
||||
// Create user
|
||||
$idobject=$obj->create($user);
|
||||
if ($idobject > 0)
|
||||
{
|
||||
|
||||
@ -67,7 +67,7 @@ $db->begin();
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
|
||||
// Create invoice object
|
||||
// Create contract object
|
||||
$obj = new Contrat($db);
|
||||
$obj->socid=$argv[1];
|
||||
|
||||
|
||||
@ -289,7 +289,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
@ -740,15 +740,6 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
||||
print implode(', ', $tmp);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$colspan=count($fieldlist)+3;
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -37,10 +37,10 @@ $langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
@ -53,13 +53,6 @@ $main_option = array (
|
||||
$model_option = array (
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE'
|
||||
/*
|
||||
'ACCOUNTING_EXPORT_PIECE',
|
||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
'ACCOUNTING_EXPORT_LABEL',
|
||||
'ACCOUNTING_EXPORT_AMOUNT',
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
*/
|
||||
);
|
||||
|
||||
/*
|
||||
@ -121,17 +114,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
|
||||
$head = admin_accounting_prepare_head();
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron');
|
||||
|
||||
$var = true;
|
||||
|
||||
/*
|
||||
@ -245,8 +234,6 @@ if ($num2) {
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -37,10 +37,9 @@ $langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("salaries");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin))
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -160,18 +159,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
|
||||
$head = admin_accounting_prepare_head($accounting);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron');
|
||||
|
||||
|
||||
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -287,18 +281,11 @@ foreach ($list as $key)
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>';
|
||||
|
||||
print '<br>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"]
|
||||
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'',$limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'', $limit);
|
||||
|
||||
// Reverse sort order
|
||||
if ( preg_match('/^asc/i', $sortorder) )
|
||||
@ -315,7 +315,7 @@ while ($i < min($num, $limit))
|
||||
|
||||
// Affiche un lien vers la facture client/fournisseur
|
||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||
|
||||
|
||||
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||
|
||||
@ -114,11 +114,11 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Skeleton';
|
||||
$objectlabel='Skeleton';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
$objectclass='ExpenseReport';
|
||||
$objectlabel='ExpenseReport';
|
||||
$permtoread = $user->rights->expensereport->read;
|
||||
$permtodelete = $user->rights->expensereport->delete;
|
||||
$uploaddir = $conf->expensereport->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'ventil') {
|
||||
|
||||
@ -46,6 +46,10 @@ $mesg='';
|
||||
|
||||
$adherentstatic=new Adherent($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -65,9 +69,14 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
||||
$sql.= " t.libelle as type,";
|
||||
$sql.= " c.code as country_code, c.label as country";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val)
|
||||
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
||||
$sql.= " ORDER BY d.rowid ASC";
|
||||
@ -84,9 +93,27 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
|
||||
if ($objp->country == '-') $objp->country='';
|
||||
|
||||
$adherentstatic->id=$objp->rowid;
|
||||
$adherentstatic->lastname=$objp->lastname;
|
||||
$adherentstatic->firstname=$objp->firstname;
|
||||
|
||||
// format extrafiled so they can be parsed in function complete_substitutions_array
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
$adherentstatic->array_options = array();
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$tmpkey='options_'.$key;
|
||||
if (!empty($objp->$tmpkey))
|
||||
{
|
||||
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||
}
|
||||
}
|
||||
|
||||
// List of values to scan for a replacement
|
||||
$substitutionarray = array (
|
||||
'%ID%'=>$objp->rowid,
|
||||
@ -109,7 +136,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
// For business cards
|
||||
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
||||
@ -123,7 +150,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
{
|
||||
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
|
||||
if ($nb <= 0) $nb=1; // Protection to avoid empty page
|
||||
|
||||
|
||||
for($j=0;$j<$nb;$j++)
|
||||
{
|
||||
$arrayofmembers[]=array(
|
||||
|
||||
@ -165,6 +165,8 @@ if (! empty($triggers))
|
||||
if ($module == 'shipping') $module = 'expedition_bon';
|
||||
if ($module == 'member') $module = 'adherent';
|
||||
if ($module == 'project') $module = 'projet';
|
||||
if ($module == 'proposal_supplier') $module = 'supplier_proposal';
|
||||
|
||||
//print 'module='.$module.'<br>';
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
|
||||
@ -373,11 +373,12 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_FILTER_STATUS
|
||||
// TODO Remove to use the default generic feature
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
|
||||
@ -399,7 +399,7 @@ print '</table>';
|
||||
|
||||
|
||||
|
||||
print '<br /><br />';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -162,7 +162,7 @@ foreach ($list as $key)
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '<br><br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -662,7 +662,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
|
||||
@ -286,7 +286,7 @@ class PrestaShopWebservice
|
||||
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||
* foreach ($xml->children()->children() as $attName => $attValue)
|
||||
* echo $attName.' = '.$attValue.'<br />';
|
||||
* echo $attName.' = '.$attValue.'<br>';
|
||||
* }
|
||||
* catch (PrestaShopWebserviceException $ex)
|
||||
* {
|
||||
|
||||
@ -40,41 +40,52 @@ class Dolistore
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $options Options
|
||||
*/
|
||||
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
||||
function __construct()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->start = $options['start'];
|
||||
$this->end = $options['end'];
|
||||
$this->per_page = $options['per_page'];
|
||||
$this->categorie = $options['categorie'];
|
||||
$this->search = $options['search'];
|
||||
|
||||
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
||||
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
||||
$this->vat_rate = 1.2; // 20% de TVA
|
||||
$this->debug_api = false;
|
||||
|
||||
if ($this->end == 0) {
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from remote Dolistore market place.
|
||||
* This fills ->categories
|
||||
*
|
||||
* @param array $options Options
|
||||
* @return void
|
||||
*/
|
||||
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->start = $options['start'];
|
||||
$this->end = $options['end'];
|
||||
$this->per_page = $options['per_page'];
|
||||
$this->categorie = $options['categorie'];
|
||||
$this->search = $options['search'];
|
||||
|
||||
if ($this->end == 0) {
|
||||
$this->end = $this->per_page;
|
||||
}
|
||||
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
|
||||
|
||||
try {
|
||||
try {
|
||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||
|
||||
// Here we set the option array for the Webservice : we want products resources
|
||||
$opt = array();
|
||||
$opt['resource'] = 'products';
|
||||
|
||||
// make a search to limit the id returned.
|
||||
if ($this->search != '') {
|
||||
$opt2 = array();
|
||||
@ -102,7 +113,9 @@ class Dolistore
|
||||
$opt['sort'] = 'id_desc';
|
||||
$opt['filter[active]'] = '[1]';
|
||||
$opt['limit'] = "$this->start,$this->end";
|
||||
// Call
|
||||
// $opt['filter[id]'] contais list of product id that are result of search
|
||||
|
||||
// Call API to get the detail
|
||||
$xml = $this->api->get($opt);
|
||||
$this->products = $xml->products->children();
|
||||
|
||||
@ -124,7 +137,12 @@ class Dolistore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return tree of Dolistore categories. $this->categories must have been loaded before.
|
||||
*
|
||||
* @param int $parent Id of parent category
|
||||
* @return string
|
||||
*/
|
||||
function get_categories($parent = 0)
|
||||
{
|
||||
if (!isset($this->categories)) die('not possible');
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
@ -47,7 +47,7 @@ $list = array (
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
@ -99,7 +99,7 @@ foreach ($list as $key)
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$label = $langs->trans($key);
|
||||
print '<td><label for="'.$key.'">'.$label.'</label></td>';
|
||||
|
||||
// Value
|
||||
@ -120,7 +120,7 @@ print '</tr>';
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '<br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -55,7 +55,7 @@ $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'
|
||||
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
|
||||
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
|
||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||
$dolistore = new Dolistore($options);
|
||||
$dolistore = new Dolistore();
|
||||
|
||||
|
||||
if (! $user->admin)
|
||||
@ -832,6 +832,10 @@ if ($mode == 'marketplace')
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
{
|
||||
// $options is array with filter criterias
|
||||
//var_dump($options);
|
||||
$dolistore->getRemoteData($options);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
|
||||
|
||||
$previouslink = $dolistore->get_previous_link();
|
||||
|
||||
@ -235,7 +235,7 @@ print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
@ -293,7 +293,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "<br />";
|
||||
print "<br>";
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@ $found++;
|
||||
|
||||
/*if (! $found)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -329,7 +329,7 @@ $found++;
|
||||
|
||||
/*if (! $found)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -433,7 +433,7 @@ if ($virtualdiffersfromphysical)
|
||||
}
|
||||
|
||||
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -441,7 +441,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<td>'.$langs->trans("Inventory").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="center" width="100"> </td>'."\n";
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||
@ -454,7 +454,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
||||
@ -467,7 +467,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
|
||||
@ -480,7 +480,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
@ -492,7 +492,7 @@ print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("UseDispatchStatus").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
@ -536,7 +536,7 @@ print '<br>';
|
||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||
if ($conf->global->PRODUIT_SOUSPRODUITS)
|
||||
{
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("IndependantSubProductStock").'</td>';
|
||||
|
||||
@ -37,9 +37,9 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
$DOLAPIENTITY = $_SERVER['HTTP_DOLAPIENTITY'];
|
||||
$entity=(! empty($DOLAPIENTITY) ? (int) $DOLAPIENTITY : (! empty($DOLAPIENTITY) ? (int) $DOLAPIENTITY : 1));
|
||||
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
||||
// Force entity if a value provided int HTTP header. Otherwise, will use the entity of user of token used.
|
||||
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
||||
|
||||
@ -851,7 +851,8 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all objects with filters
|
||||
* Load all objects with filters.
|
||||
* WARNING: This make a fetch on all records instead of making one request with a join.
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
* @param int $socid Filter by thirdparty
|
||||
@ -863,7 +864,7 @@ class ActionComm extends CommonObject
|
||||
* @param string $limit Limit number of answers
|
||||
* @return array or string Error string if KO, array with actions if OK
|
||||
*/
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='datep', $sortorder='DESC', $limit=0)
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='a.datep', $sortorder='DESC', $limit=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -880,7 +881,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
if (! empty($filter)) $sql.= $filter;
|
||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||
if ($limit) $sql.=$db->plimit($limit);
|
||||
$sql.=$db->plimit($limit, 0);
|
||||
|
||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@ -371,6 +371,7 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@ -382,7 +383,6 @@ if ($resql)
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
print '</td>';
|
||||
@ -395,7 +395,8 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||
@ -403,7 +404,6 @@ if ($resql)
|
||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("");
|
||||
print "</tr>\n";
|
||||
@ -437,13 +437,23 @@ if ($resql)
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action (type)
|
||||
// Ref
|
||||
print '<td>';
|
||||
print $actionstatic->getNomUrl(1,-1);
|
||||
print '</td>';
|
||||
|
||||
// Action (type)
|
||||
print '<td>';
|
||||
// User owner
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($obj->fk_user_action > 0)
|
||||
{
|
||||
$userstatic->fetch($obj->fk_user_action);
|
||||
print $userstatic->getNomUrl(-1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
print '<td class="tdoverflowmax300">';
|
||||
print $actionstatic->label;
|
||||
print '</td>';
|
||||
|
||||
@ -482,7 +492,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
|
||||
// Third party
|
||||
print '<td>';
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($obj->socid)
|
||||
{
|
||||
$societestatic->id=$obj->socid;
|
||||
@ -520,16 +530,6 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// User owner
|
||||
print '<td align="left">';
|
||||
if ($obj->fk_user_action > 0)
|
||||
{
|
||||
$userstatic->fetch($obj->fk_user_action);
|
||||
print $userstatic->getNomUrl(-1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Status/Percent
|
||||
$datep=$db->jdate($obj->datep);
|
||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';
|
||||
|
||||
@ -1224,7 +1224,6 @@ else
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
||||
|
||||
|
||||
dol_fiche_head(null, '', '', -1);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -425,7 +425,7 @@ if ($object->fetch($id) >= 0)
|
||||
if ($allowaddtarget) {
|
||||
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
|
||||
}
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
|
||||
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','', $limit);
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -125,7 +125,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action = '';
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
@ -638,16 +646,10 @@ if (empty($reshook))
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
|
||||
// Actions to send emails
|
||||
$actiontypecode='AC_OTH_AUTO';
|
||||
$trigger_name='PROPAL_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromproposal';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
||||
$trackid='pro'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -2361,123 +2363,13 @@ if ($action == 'create')
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
// Presend form
|
||||
$modelmail='propal_send';
|
||||
$defaulttopic='SendPropalRef';
|
||||
$diroutput = $conf->propal->dir_output;
|
||||
$trackid = 'pro'.$object->id;
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendPropalByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='pro'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
$liste [$key] = $value;
|
||||
$formmail->withto = GETPOST("sendto") ? GETPOST("sendto") : $liste;
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false);
|
||||
if (empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__ (__REFCLIENT__)');
|
||||
}
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility
|
||||
|
||||
// Find the good contact adress
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
||||
foreach ($contactarr as $contact) {
|
||||
if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'propal_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -96,8 +96,8 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='proposallist';
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'proposallist';
|
||||
|
||||
// Security check
|
||||
$module='propal';
|
||||
@ -238,7 +238,7 @@ llxHeader('',$langs->trans('Proposal'),$help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
@ -413,105 +413,18 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objecttmp=new Propal($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendSupplierProposalRef";
|
||||
$modelmail="supplier_proposal_send";
|
||||
$objecttmp=new Propal($db);
|
||||
$trackid='ord'.$object->id;
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$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->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
@ -813,6 +726,7 @@ if ($resql)
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->email=$obj->email;
|
||||
|
||||
// Thirdparty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
|
||||
@ -118,16 +118,11 @@ if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink' && $action != 'updateline')
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id,$ref);
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
@ -1256,13 +1251,13 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromorder';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
|
||||
$trackid='ord'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -2596,134 +2591,13 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
// Presend form
|
||||
$modelmail='order_send';
|
||||
$defaulttopic='SendOrderRef';
|
||||
$diroutput = $conf->commande->dir_output;
|
||||
$trackid = 'ord'.$object->id;
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
// Show email form
|
||||
|
||||
// By default if $action=='presend'
|
||||
$titreform='SendOrderByMail';
|
||||
$topicmail='';
|
||||
if (empty($object->ref_client)) {
|
||||
$topicmail = $outputlangs->trans('SendOrderRef', '__ORDERREF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$topicmail = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)');
|
||||
}
|
||||
$action='send';
|
||||
$modelmail='order_send';
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans($titreform));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
$liste [$key] = $value;
|
||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $topicmail;
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit ['__ORDERREF__'] = $object->ref;
|
||||
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0)
|
||||
{
|
||||
foreach ($contactarr as $contact)
|
||||
{
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['orderid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills'));
|
||||
|
||||
@ -82,6 +83,7 @@ $result = restrictedArea($user, 'commande', $id,'');
|
||||
|
||||
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@ -118,7 +120,8 @@ $checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
@ -186,6 +189,7 @@ if (empty($reshook))
|
||||
$search_deliveryday='';
|
||||
$search_deliverymonth='';
|
||||
$search_deliveryyear='';
|
||||
$search_project_ref='';
|
||||
$viewstatut='';
|
||||
$billed='';
|
||||
$toselect='';
|
||||
@ -203,7 +207,8 @@ if (empty($reshook))
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
// TODO Move this into mass action include
|
||||
if ($massaction == 'confirm_createbills') {
|
||||
@ -438,6 +443,7 @@ $formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$projectstatic=new Project($db);
|
||||
|
||||
$title=$langs->trans("Orders");
|
||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
@ -445,12 +451,13 @@ llxHeader('',$title,$help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update';
|
||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@ -465,6 +472,7 @@ $sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
@ -539,6 +547,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
@ -626,7 +635,8 @@ if ($resql)
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($billed != '') $param.='&billed='.$billed;
|
||||
// Add $param from extra fields
|
||||
@ -661,102 +671,17 @@ if ($resql)
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
// TODO Move this into an invluce
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
$objecttmp=new Commande($db);
|
||||
$trackid='ord'.$object->id;
|
||||
|
||||
if (! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objecttmp=new Commande($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$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->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
elseif ($massaction == 'createbills')
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
@ -873,6 +798,11 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Project ref
|
||||
if (! empty($arrayfields['p.project_ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
|
||||
}
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
@ -1016,6 +946,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.project_ref']['checked'])) print_liste_field_titre($arrayfields['p.project_ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||
@ -1065,27 +996,35 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
$notshippable=0;
|
||||
$warning = 0;
|
||||
$text_info='';
|
||||
$text_warning='';
|
||||
$nbprod=0;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->email=$obj->email;
|
||||
|
||||
$generic_commande->id=$obj->rowid;
|
||||
$generic_commande->ref=$obj->ref;
|
||||
$generic_commande->statut = $obj->fk_statut;
|
||||
$generic_commande->date_commande = $db->jdate($obj->date_commande);
|
||||
$generic_commande->date_livraison = $db->jdate($obj->date_delivery);
|
||||
$generic_commande->ref_client = $obj->ref_client;
|
||||
$generic_commande->total_ht = $obj->total_ht;
|
||||
$generic_commande->total_tva = $obj->total_tva;
|
||||
$generic_commande->total_ttc = $obj->total_ttc;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$generic_commande->id=$obj->rowid;
|
||||
$generic_commande->ref=$obj->ref;
|
||||
$generic_commande->statut = $obj->fk_statut;
|
||||
$generic_commande->date_commande = $db->jdate($obj->date_commande);
|
||||
$generic_commande->date_livraison = $db->jdate($obj->date_delivery);
|
||||
$generic_commande->ref_client = $obj->ref_client;
|
||||
$generic_commande->total_ht = $obj->total_ht;
|
||||
$generic_commande->total_tva = $obj->total_tva;
|
||||
$generic_commande->total_ttc = $obj->total_ttc;
|
||||
|
||||
$generic_commande->lines=array();
|
||||
$generic_commande->getLinesArray();
|
||||
|
||||
@ -1230,10 +1169,16 @@ if ($resql)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
// Project
|
||||
if (! empty($arrayfields['p.project_ref']['checked']))
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
print '<td>';
|
||||
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
|
||||
@ -145,7 +145,7 @@ if ($action == 'add')
|
||||
if ($id > 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories');
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
@ -239,7 +239,7 @@ if ($action == 'update')
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Category association
|
||||
$categories = GETPOST('categories');
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
|
||||
@ -1255,6 +1255,7 @@ class Account extends CommonObject
|
||||
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
|
||||
$label .= '<br><b>' . $langs->trans('BankAccount') . ':</b> ' . $this->label;
|
||||
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
||||
$label .= '<br><b>' . $langs->trans("AccountCurrency") . ':</b> ' . $this->currency_code;
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
@ -132,7 +132,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action='';
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -1957,20 +1965,17 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
if (empty($id)) $id=$facid;
|
||||
$trigger_name='BILL_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfrominvoice';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_INVOICE_TO';
|
||||
$trackid='inv'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
@ -2003,8 +2008,6 @@ if (empty($reshook))
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
||||
if ($action == 'addcontact') {
|
||||
$result = $object->fetch($id);
|
||||
@ -4335,143 +4338,15 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Action presend (or prerelance)
|
||||
*/
|
||||
|
||||
$object->fetch_projet();
|
||||
|
||||
// By default if $action=='presend'
|
||||
$titreform = 'SendBillByMail';
|
||||
$topicmail = 'SendBillRef';
|
||||
$modelmail = 'facture_send';
|
||||
// Presend form
|
||||
$modelmail='facture_send';
|
||||
$defaulttopic='SendBillRef';
|
||||
$diroutput = $conf->facture->dir_output;
|
||||
$trackid = 'inv'.$object->id;
|
||||
|
||||
if ($action == 'prerelance') // For backward compatibility
|
||||
{
|
||||
$titrefrom = 'SendReminderBillByMail';
|
||||
$topicmail = 'SendReminderBillRef';
|
||||
$modelmail = 'facture_relance';
|
||||
$action = 'relance';
|
||||
} else
|
||||
$action = 'send';
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('bills');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model','alpha') ? GETPOST('model','alpha') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans($titreform));
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
dol_fiche_head();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype','alpha')?GETPOST('fromtype','alpha'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='inv'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste [$key] = $value;
|
||||
}
|
||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste; // List suggested for send to
|
||||
$formmail->withtocc = $liste; // List suggested for CC
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
if (empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->transnoentities($topicmail, '__REF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->transnoentities($topicmail, '__REF__ (__REFCLIENT__)');
|
||||
}
|
||||
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object, $outputlangs);
|
||||
$formmail->substit['__INVREF__'] = $object->ref;
|
||||
|
||||
// Find the good contact adress
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
||||
foreach ($contactarr as $contact) {
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -1122,7 +1122,7 @@ if ($action == 'create')
|
||||
$disableedit=1;
|
||||
$disablemove=1;
|
||||
$disableremove=1;
|
||||
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
$ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
@ -1541,7 +1541,7 @@ else
|
||||
{
|
||||
//$disableedit=1;
|
||||
//$disablemove=1;
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
||||
$ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||
}
|
||||
|
||||
// Form to add new line
|
||||
@ -1552,7 +1552,7 @@ else
|
||||
$var = true;
|
||||
|
||||
// Add free products/services
|
||||
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice
|
||||
$object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
@ -1731,7 +1731,7 @@ else
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','', $limit);
|
||||
|
||||
print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'<br><br>';
|
||||
|
||||
|
||||
@ -110,8 +110,8 @@ if (! $sortfield) $sortfield='f.datef';
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='invoicelist';
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicelist';
|
||||
|
||||
// Security check
|
||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||
@ -345,6 +345,7 @@ $formfile = new FormFile($db);
|
||||
$bankaccountstatic=new Account($db);
|
||||
$facturestatic=new Facture($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
|
||||
@ -355,7 +356,7 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
@ -493,7 +494,7 @@ if (! $sall)
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut,';
|
||||
$sql.= ' f.datec, f.tms,';
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
|
||||
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
|
||||
$sql.= ' state.code_departement, state.nom';
|
||||
|
||||
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
||||
@ -605,106 +606,18 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objecttmp=new Facture($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="facture_send";
|
||||
$objecttmp=new Facture($db);
|
||||
$trackid='inv'.$object->id;
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='inv'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$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->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid']=join(',',$arrayofselected);
|
||||
// TODO We should use $formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
@ -1099,12 +1012,12 @@ if ($resql)
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">';
|
||||
$thirdparty=new Societe($db);
|
||||
$thirdparty->id=$obj->socid;
|
||||
$thirdparty->name=$obj->name;
|
||||
$thirdparty->client=$obj->client;
|
||||
$thirdparty->code_client=$obj->code_client;
|
||||
print $thirdparty->getNomUrl(1,'customer');
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=$obj->client;
|
||||
$thirdpartystatic->code_client=$obj->code_client;
|
||||
$thirdpartystatic->email=$obj->email;
|
||||
print $thirdpartystatic->getNomUrl(1,'customer');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -224,7 +224,7 @@ if (empty($reshook))
|
||||
$action = 'create';
|
||||
} else {
|
||||
// Categories association
|
||||
$contcats = GETPOST( 'contcats', 'array' );
|
||||
$contcats = GETPOST( 'contcats', 'array');
|
||||
$object->setCategories($contcats);
|
||||
}
|
||||
}
|
||||
@ -383,7 +383,7 @@ if (empty($reshook))
|
||||
$db->query( $sql );
|
||||
|
||||
// Then we add the associated categories
|
||||
$categories = GETPOST( 'contcats', 'array' );
|
||||
$categories = GETPOST( 'contcats', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$object->old_lastname='';
|
||||
|
||||
@ -965,6 +965,7 @@ if (empty($reshook))
|
||||
$trackid='cont'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
@ -2052,62 +2053,73 @@ else
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if ($object->statut == 0 && $nbofservices)
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
// Send
|
||||
if ($object->statut == 1) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
if ($object->statut == 0 && $nbofservices)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid">'.$langs->trans("Validate").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
if ($user->rights->contrat->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Modify").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("orders");
|
||||
if ($user->rights->commande->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
if (! empty($conf->facture->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("orders");
|
||||
if ($user->rights->commande->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->nbofservicesclosed > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
|
||||
}
|
||||
if ($object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
|
||||
//}
|
||||
}
|
||||
// Clone
|
||||
if ($user->rights->contrat->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
|
||||
if ($object->nbofservicesclosed > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
|
||||
}
|
||||
if ($object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
//if (! $numactive)
|
||||
//{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("CloseRefusedBecauseOneServiceActive").'">'.$langs->trans("Close").'</a></div>';
|
||||
//}
|
||||
}
|
||||
|
||||
// On peut supprimer entite si
|
||||
// - Droit de creer + mode brouillon (erreur creation)
|
||||
// - Droit de supprimer
|
||||
if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
@ -2193,7 +2205,7 @@ else
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendContractByMail'));
|
||||
print load_fiche_titre($langs->trans('SendByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
@ -2207,7 +2219,7 @@ else
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
$formmail->trackid='cont'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -2229,9 +2241,18 @@ else
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
// Array of substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit ['__CONTRACTREF__'] = $object->ref;
|
||||
$datenextexpiration='';
|
||||
foreach($object->lines as $line)
|
||||
{
|
||||
if ($line->statut != 4) continue;
|
||||
if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
|
||||
}
|
||||
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
|
||||
$formmail->substit['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
@ -2243,7 +2264,7 @@ else
|
||||
{
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_contract_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,9 @@
|
||||
*/
|
||||
|
||||
require ("../main.inc.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
@ -52,6 +53,7 @@ $search_state=trim(GETPOST("search_state"));
|
||||
$search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_contract=GETPOST('search_contract');
|
||||
$search_ref_customer=GETPOST('search_ref_customer','alpha');
|
||||
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
|
||||
$sall=GETPOST('sall', 'alphanohtml');
|
||||
$search_status=GETPOST('search_status');
|
||||
@ -81,6 +83,8 @@ $id=GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
$diroutputmassaction=$conf->contrat->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
$staticcontrat=new Contrat($db);
|
||||
$staticcontratligne=new ContratLigne($db);
|
||||
|
||||
@ -158,6 +162,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_contract="";
|
||||
$search_ref_customer="";
|
||||
$search_ref_supplier="";
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
@ -184,7 +189,8 @@ if (empty($reshook))
|
||||
*/
|
||||
|
||||
$now=dol_now();
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formother = new FormOther($db);
|
||||
$socstatic = new Societe($db);
|
||||
$contracttmp = new Contrat($db);
|
||||
@ -241,6 +247,7 @@ else if ($year > 0)
|
||||
}
|
||||
if ($search_name) $sql .= natural_search('s.nom', $search_name);
|
||||
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer);
|
||||
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -334,8 +341,8 @@ if ($resql)
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
@ -352,6 +359,16 @@ if ($resql)
|
||||
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendContractRef";
|
||||
$modelmail="contract";
|
||||
$objecttmp=new Contrat($db);
|
||||
$trackid='con'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
@ -417,13 +434,13 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
@ -586,6 +603,13 @@ if ($resql)
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->contrat->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
@ -750,6 +774,25 @@ if ($resql)
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
/*
|
||||
* Show list of available documents
|
||||
*/
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->contrat->lire;
|
||||
$delallowed=$user->rights->contrat->lire;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -285,7 +285,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
||||
llxHeader(null, $langs->trans("Services"));
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_contract) $param.='&search_contract='.urlencode($search_contract);
|
||||
if ($search_name) $param.='&search_name='.urlencode($search_name);
|
||||
@ -326,6 +326,7 @@ print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$title=$langs->trans("ListOfServices");
|
||||
if ($mode == "0") $title=$langs->trans("ListOfInactiveServices"); // Must use == "0"
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
// $cancel must be defined
|
||||
// $id or $ref must be defined (object is loaded in this file with fetch)
|
||||
|
||||
if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtask', 'add')))) && empty($cancel))
|
||||
if (($id > 0 || (! empty($ref) && ! in_array($action, array('create', 'createtask', 'add')))) && (empty($cancel) || $id > 0))
|
||||
{
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
|
||||
@ -52,7 +52,7 @@ if (! $error && count($toselect) > $maxformassaction)
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form
|
||||
if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form
|
||||
{
|
||||
$massaction='presend';
|
||||
}
|
||||
@ -64,35 +64,63 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
if (!$error && !isset($user->email))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
|
||||
}
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$thirdparty=new Societe($db);
|
||||
if ($objecttmp->element == 'expensereport') $thirdparty=new User($db);
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofobjectid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id;
|
||||
if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author;
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||
}
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
}
|
||||
|
||||
// Check mandatory parameters
|
||||
if (empty($user->email))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
// Loop on each thirdparty
|
||||
$receiver=$_POST['receiver'];
|
||||
if (! is_array($receiver))
|
||||
{
|
||||
if (empty($receiver) || $receiver == '-1') $receiver=array();
|
||||
else $receiver=array($receiver);
|
||||
}
|
||||
if (count($receiver) == 0 && count($listofobjectthirdparties) == 1) // if only one recipient, receiver is mandatory
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
if (! GETPOST('subject','none'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
// Loop on each recipient/thirdparty
|
||||
if (! $error)
|
||||
{
|
||||
foreach ($listofobjectthirdparties as $thirdpartyid)
|
||||
{
|
||||
$result = $thirdparty->fetch($thirdpartyid);
|
||||
@ -108,12 +136,6 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$sendtoid = array();
|
||||
|
||||
// Define $sendto
|
||||
$receiver=$_POST['receiver'];
|
||||
if (! is_array($receiver))
|
||||
{
|
||||
if ($receiver == '-1') $receiver=array();
|
||||
else $receiver=array($receiver);
|
||||
}
|
||||
$tmparray=array();
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
@ -172,74 +194,99 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedid=array();
|
||||
$listofqualifiedref=array();
|
||||
$thirdpartywithoutemail=array();
|
||||
|
||||
foreach($listofobjectref[$thirdpartyid] as $objectid => $object)
|
||||
{
|
||||
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
|
||||
|
||||
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
|
||||
if ($objectclass == 'Propal' && $object->statut == Propal::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT)
|
||||
if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read document
|
||||
// TODO Use future field $object->fullpathdoc to know where is stored default file
|
||||
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
|
||||
$filename=dol_sanitizeFileName($object->ref).'.pdf';
|
||||
$filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref);
|
||||
$file = $filedir . '/' . $filename;
|
||||
$mime = dol_mimetype($file);
|
||||
|
||||
if (dol_is_file($file))
|
||||
if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED)
|
||||
{
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$object->thirdparty->name;
|
||||
$nbignored++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
// Create form object
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
|
||||
$listofqualifiedid[$objectid]=$object;
|
||||
$listofqualifiedref[$objectid]=$object->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbignored++;
|
||||
$langs->load("errors");
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
// Test recipient
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
if ($object->element == 'expensereport')
|
||||
{
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($object->fk_user_author);
|
||||
$sendto = $fuser->email;
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$object->thirdparty->name;
|
||||
$nbignored++;
|
||||
if (empty($thirdpartywithoutemail[$object->thirdparty->id]))
|
||||
{
|
||||
$resaction.='<div class="error">'.$langs->trans('NoRecipientEmail',$object->thirdparty->name).'</div><br>';
|
||||
}
|
||||
dol_syslog('No recipient for thirdparty: '.$object->thirdparty->name, LOG_WARNING);
|
||||
$thirdpartywithoutemail[$object->thirdparty->id]=1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($_POST['addmaindocfile'])
|
||||
{
|
||||
// TODO Use future field $object->fullpathdoc to know where is stored default file
|
||||
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
|
||||
$filename=dol_sanitizeFileName($object->ref).'.pdf';
|
||||
$filedir=$uploaddir . '/' . dol_sanitizeFileName($object->ref);
|
||||
$file = $filedir . '/' . $filename;
|
||||
$mime = dol_mimetype($file);
|
||||
|
||||
if (dol_is_file($file))
|
||||
{
|
||||
// Create form object
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$nbignored++;
|
||||
$langs->load("errors");
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Object of thirdparty qualified
|
||||
$listofqualifiedid[$objectid]=$object;
|
||||
$listofqualifiedref[$objectid]=$object->ref;
|
||||
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
// Loop on each qualified objects of the thirdparty
|
||||
// Send email if there is at least one qualified record
|
||||
if (count($listofqualifiedid) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
@ -264,8 +311,8 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject');
|
||||
$message = GETPOST('message');
|
||||
$subject = GETPOST('subject','none');
|
||||
$message = GETPOST('message','none');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = '';
|
||||
if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
|
||||
@ -275,28 +322,18 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO);
|
||||
if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO);
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$objecttmp->thirdparty = $thirdparty;
|
||||
|
||||
$substitutionarray=array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => join(', ',array_keys($listofqualifiedid)),
|
||||
'__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"/>',
|
||||
'__FACREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__ORDERREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__PROPREF__' => join(', ',$listofqualifiedref), // For backward compatibility
|
||||
'__REF__' => join(', ',$listofqualifiedref),
|
||||
'__REFCLIENT__' => $thirdparty->name,
|
||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
|
||||
/* not available on all object
|
||||
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
|
||||
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
|
||||
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
|
||||
'__ADDRESS__'=>(is_object($object)?$object->address:''),
|
||||
'__ZIP__'=>(is_object($object)?$object->zip:''),
|
||||
'__TOWN_'=>(is_object($object)?$object->town:''),
|
||||
'__COUNTRY__'=>(is_object($object)?$object->country:''),
|
||||
*/
|
||||
);
|
||||
// Make substitution in email content
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp);
|
||||
$substitutionarray['__ID__'] = join(', ',array_keys($listofqualifiedid));
|
||||
$substitutionarray['__EMAIL__'] = $thirdparty->email;
|
||||
$substitutionarray['__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"/>';
|
||||
$substitutionarray['__REF__'] = join(', ',$listofqualifiedref);
|
||||
|
||||
$parameters=array('mode'=>'formemail');
|
||||
complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
@ -350,18 +387,32 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$object->fk_element = $objid;
|
||||
$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++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
$triggername = strtoupper(get_class($object)) .'_SENTBYMAIL';
|
||||
if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL';
|
||||
if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYEMAIL';
|
||||
if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYEMAIL';
|
||||
if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYEMAIL';
|
||||
if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYEMAIL';
|
||||
if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL';
|
||||
if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYEMAIL';
|
||||
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYEMAIL';
|
||||
|
||||
if ($error)
|
||||
if (! empty($trigger_name))
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
dol_syslog("Error in trigger BILL_SENTBYMAIL ".$db->lasterror(), LOG_ERR);
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name, $object, $user, $langs, $conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
dol_syslog("Error in trigger ".$trigger_name.' '.$db->lasterror(), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
$nbsent++;
|
||||
}
|
||||
}
|
||||
@ -400,14 +451,20 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
//setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file
|
||||
setEventMessages($resaction, null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
$action='list';
|
||||
$massaction='';
|
||||
$action='list';
|
||||
$massaction='';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
|
||||
{
|
||||
if (empty($diroutputmassaction))
|
||||
{
|
||||
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@ -458,15 +515,15 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
{
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
|
||||
// Save merged file
|
||||
if ($filter=='paye:0')
|
||||
{
|
||||
@ -502,7 +559,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
else {
|
||||
// Create empty PDF
|
||||
$pdf=pdf_getInstance();
|
||||
$formatarray=pdf_getFormat();
|
||||
$page_largeur = $formatarray['width'];
|
||||
$page_hauteur = $formatarray['height'];
|
||||
$format = array($page_largeur,$page_hauteur);
|
||||
|
||||
$pdf=pdf_getInstance($format);
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
@ -573,7 +636,7 @@ if ($action == 'remove_file')
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Validate records
|
||||
// Validate records
|
||||
if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
{
|
||||
if ($object->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL))
|
||||
@ -645,8 +708,19 @@ if (! $error && $massaction == 'delete' && $permtodelete)
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Refuse deletion for some status ?
|
||||
/*
|
||||
if ($objectclass == 'Facture' && $objecttmp->status == Facture::STATUS_DRAFT)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$object->ref).'</div><br>';
|
||||
continue;
|
||||
}*/
|
||||
|
||||
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
else $result = $objecttmp->delete($user);
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
// $mysoc must be defined
|
||||
// $id must be defined
|
||||
// $paramname must be defined
|
||||
// $mode must be defined
|
||||
// $mode must be defined (used to know the automatic BCC to add)
|
||||
// $trigger_name must be set (can be '')
|
||||
// $actiontypecode can be set
|
||||
// $object and $uobject may be defined
|
||||
@ -258,7 +258,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}
|
||||
|
||||
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
|
||||
$message = $_POST['message'];
|
||||
$message = GETPOST('message','none');
|
||||
$subject = GETPOST('subject','none');
|
||||
|
||||
// Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
|
||||
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||
@ -267,18 +268,17 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$message=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
|
||||
|
||||
$sendtobcc= GETPOST('sendtoccc');
|
||||
if ($mode == 'emailfromproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||
if ($mode == 'emailfromorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||
if ($mode == 'emailfrominvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO));
|
||||
if ($mode == 'emailfromsupplierproposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||
if ($mode == 'emailfromsupplierorder') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||
if ($mode == 'emailfromsupplierinvoice') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||
// Autocomplete the $sendtobcc
|
||||
// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
|
||||
if (! empty($autocopy))
|
||||
{
|
||||
$sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc?", ":"").$conf->global->$autocopy));
|
||||
}
|
||||
|
||||
$deliveryreceipt = $_POST['deliveryreceipt'];
|
||||
|
||||
if ($action == 'send' || $action == 'relance')
|
||||
{
|
||||
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
|
||||
$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
|
||||
if ($message)
|
||||
{
|
||||
@ -344,23 +344,25 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
}
|
||||
}
|
||||
|
||||
$substitutionarray=array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => (is_object($object)?$object->id:''),
|
||||
'__EMAIL__' => $sendto,
|
||||
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
|
||||
'__REF__' => (is_object($object)?$object->ref:''),
|
||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
|
||||
/* not available on all object
|
||||
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
|
||||
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),
|
||||
'__FULLNAME__'=>(is_object($object)?$object->getFullName($langs):''),
|
||||
'__ADDRESS__'=>(is_object($object)?$object->address:''),
|
||||
'__ZIP__'=>(is_object($object)?$object->zip:''),
|
||||
'__TOWN_'=>(is_object($object)?$object->town:''),
|
||||
'__COUNTRY__'=>(is_object($object)?$object->country:''),
|
||||
*/
|
||||
);
|
||||
// Make substitution in email content
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
|
||||
$substitutionarray['__EMAIL__'] = $sendto;
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
|
||||
// Add specific substitution for contracts
|
||||
if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
|
||||
{
|
||||
$datenextexpiration='';
|
||||
foreach($object->lines as $line)
|
||||
{
|
||||
if ($line->statut != 4) continue;
|
||||
if ($line->date_fin_prevue > $datenextexpiration) $datenextexpiration = $line->date_fin_prevue;
|
||||
}
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
}
|
||||
|
||||
$parameters=array('mode'=>'formemail');
|
||||
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
@ -424,7 +426,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
if ($result < 0) {
|
||||
$error++; $errors=$interface->errors;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,6 @@ class box_activity extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$totalMnt = 0;
|
||||
$totalnb = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
@ -95,8 +94,6 @@ class box_activity extends ModeleBoxes
|
||||
// compute the year limit to show
|
||||
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofperiod, "m");
|
||||
|
||||
$cumuldata = array();
|
||||
|
||||
|
||||
// list the summary of the propals
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
@ -146,11 +143,10 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data))
|
||||
{
|
||||
$j=0;
|
||||
while ($line < count($cumuldata))
|
||||
while ($j < count($data))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@ -176,7 +172,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
|
||||
@ -231,10 +226,9 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($line < count($cumuldata)) {
|
||||
while ($j < count($data)) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut,
|
||||
@ -259,7 +253,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
|
||||
@ -290,11 +283,11 @@ class box_activity extends ModeleBoxes
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=1";
|
||||
$sql.= " GROUP BY f.fk_statut";
|
||||
$sql.= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
@ -317,10 +310,9 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
while ($line < count($cumuldata)) {
|
||||
while ($j < count($data)) {
|
||||
$billurl="search_status=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@ -347,10 +339,8 @@ class box_activity extends ModeleBoxes
|
||||
);
|
||||
|
||||
// We add only for the current year
|
||||
if ($data[$j]->annee == date("Y")) {
|
||||
$totalnb += $data[$j]->nb;
|
||||
$totalMnt += $data[$j]->Mnttot;
|
||||
}
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
|
||||
@ -371,12 +361,13 @@ class box_activity extends ModeleBoxes
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND paye=0";
|
||||
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=0";
|
||||
$sql.= " GROUP BY f.fk_statut";
|
||||
$sql.= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
@ -399,11 +390,11 @@ class box_activity extends ModeleBoxes
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
$cumuldata=array_merge($cumuldata, $data);
|
||||
if (! empty($data)) {
|
||||
$j=0;
|
||||
$alreadypaid=-1;
|
||||
|
||||
while ($line < count($cumuldata)) {
|
||||
$j=0;
|
||||
while ($j < count($data)) {
|
||||
$billurl="search_status=".$data[$j]->fk_statut."&paye=0";
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'align="left" width="16"',
|
||||
@ -428,10 +419,9 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'class="right"',
|
||||
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
|
||||
);
|
||||
$totalMnt += $objp->Mnttot;
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'align="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
|
||||
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3, $alreadypaid),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
@ -441,11 +431,6 @@ class box_activity extends ModeleBoxes
|
||||
'td' => 'align="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => '',
|
||||
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
const TYPE_DEPOSIT = 3;
|
||||
|
||||
/**
|
||||
* Proforma invoice.
|
||||
* Proforma invoice.
|
||||
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
|
||||
*/
|
||||
const TYPE_PROFORMA = 4;
|
||||
@ -89,7 +89,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
*/
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return remain amount to pay. Property ->id and ->total_ttc must be set.
|
||||
* This does not include open direct debit requests.
|
||||
@ -141,7 +141,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all deposits invoices used by invoice.
|
||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||
@ -154,11 +154,11 @@ abstract class CommonInvoice extends CommonObject
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||
if ($result >= 0)
|
||||
@ -185,9 +185,9 @@ abstract class CommonInvoice extends CommonObject
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
|
||||
$discountstatic=new DiscountAbsolute($this->db);
|
||||
$result=$discountstatic->getSumCreditNotesUsed($this, $multicurrency);
|
||||
if ($result >= 0)
|
||||
@ -200,7 +200,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie tableau des ids de facture avoir issus de la facture
|
||||
*
|
||||
@ -309,7 +309,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
* @param int $paye Status field paye
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
|
||||
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, -1 otherwise)
|
||||
* @param int $type Type invoice
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
@ -418,7 +418,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
|
||||
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
|
||||
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7');
|
||||
if ($alreadypaid <= 0)
|
||||
if ($alreadypaid <= 0)
|
||||
{
|
||||
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
|
||||
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
|
||||
@ -497,13 +497,13 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
elseif($cdr_type == 2 && !empty($cdr_nbjour)) // Application de la règle, le N du mois courant ou suivant
|
||||
{
|
||||
|
||||
|
||||
$date_piece = dol_mktime(0,0,0,date('m', $this->date),date('d', $this->date),date('Y', $this->date)); // Sans les heures minutes et secondes
|
||||
$date_lim_current = dol_mktime(0,0,0,date('m', $this->date),$cdr_nbjour,date('Y', $this->date)); // Sans les heures minutes et secondes
|
||||
$date_lim_next = strtotime(date('Y-m-d', $date_lim_current).' +1month');
|
||||
|
||||
|
||||
$diff = $date_piece - $date_lim_current;
|
||||
|
||||
|
||||
if($diff < 0) $datelim = $date_lim_current;
|
||||
else $datelim = $date_lim_next;
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class Events // extends CommonObject
|
||||
var $dateevent;
|
||||
var $description;
|
||||
|
||||
// List of all events supported by triggers
|
||||
// List of all Audit/Security events supported by triggers
|
||||
var $eventstolog=array(
|
||||
array('id'=>'USER_LOGIN', 'test'=>1),
|
||||
array('id'=>'USER_LOGIN_FAILED', 'test'=>1),
|
||||
|
||||
@ -956,7 +956,7 @@ class Form
|
||||
*/
|
||||
function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0)
|
||||
{
|
||||
return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0,$limit);
|
||||
return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1082,7 +1082,7 @@ class Form
|
||||
$sql.=")";
|
||||
}
|
||||
$sql.=$this->db->order("nom","ASC");
|
||||
if ($limit > 0) $sql.=$this->db->plimit($limit);
|
||||
$sql.=$this->db->plimit($limit, 0);
|
||||
|
||||
// Build output string
|
||||
dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
|
||||
@ -1966,7 +1966,7 @@ class Form
|
||||
$sql.= ' GROUP BY'.$selectFields;
|
||||
}
|
||||
$sql.= $db->order("p.ref");
|
||||
$sql.= $db->plimit($limit);
|
||||
$sql.= $db->plimit($limit, 0);
|
||||
|
||||
// Build output string
|
||||
dol_syslog(get_class($this)."::select_produits_list search product", LOG_DEBUG);
|
||||
@ -2390,7 +2390,7 @@ class Form
|
||||
$sql.=')';
|
||||
}
|
||||
$sql.= " ORDER BY pfp.ref_fourn DESC, pfp.quantity ASC";
|
||||
$sql.= $db->plimit($limit);
|
||||
$sql.= $db->plimit($limit, 0);
|
||||
|
||||
// Build output string
|
||||
|
||||
@ -3392,7 +3392,7 @@ class Form
|
||||
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
|
||||
$bankstatic=new Account($this->db);
|
||||
$bankstatic->fetch($selected);
|
||||
print $this->textwithpicto($bankstatic->getNomUrl(1),$langs->trans("AccountCurrency").' '.$bankstatic->currency_code);
|
||||
print $bankstatic->getNomUrl(1);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
@ -5552,6 +5552,8 @@ class Form
|
||||
print '<br><!-- showLinkedObjectBlock -->';
|
||||
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder allwidth">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -5645,6 +5647,7 @@ class Form
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
return $nbofdifferenttypes;
|
||||
}
|
||||
|
||||
@ -166,7 +166,10 @@ class FormActions
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', '', '', ($max?($max+1):0));
|
||||
$sortfield='a.datep';
|
||||
$sortorder='DESC';
|
||||
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max?($max+1):0));
|
||||
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
|
||||
|
||||
$num = count($listofactions);
|
||||
@ -192,19 +195,19 @@ class FormActions
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
||||
|
||||
$page=0; $param=''; $sortfield='a.datep';
|
||||
$page=0; $param='';
|
||||
|
||||
$total = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder'.($morecss?' '.$morecss:'').'" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, 'align="center"');
|
||||
print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
|
||||
print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
|
||||
print getTitleFieldOfList('Action', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
|
||||
print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
|
||||
print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, 'align="center"', $sortfield, $sortorder, '', 1);
|
||||
print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"', $sortfield, $sortorder, '', 1);
|
||||
print '</tr>';
|
||||
print "\n";
|
||||
|
||||
@ -247,12 +250,10 @@ class FormActions
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (! empty($action->author->id))
|
||||
if (! empty($action->userownerid))
|
||||
{
|
||||
$userstatic->id = $action->author->id;
|
||||
$userstatic->firstname = $action->author->firstname;
|
||||
$userstatic->lastname = $action->author->lastname;
|
||||
print $userstatic->getNomUrl(1, '', 0, 0, 16, 0, '', '');
|
||||
$userstatic->fetch($action->userownerid); // TODO Introduce a cache on users fetched
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, '', '');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
|
||||
@ -63,6 +63,7 @@ class FormMail extends Form
|
||||
var $withtoccc;
|
||||
var $withtopic;
|
||||
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
var $withmaindocfile; // 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default)
|
||||
var $withbody;
|
||||
|
||||
var $withfromreadonly;
|
||||
@ -103,7 +104,8 @@ class FormMail extends Form
|
||||
$this->withtoccc=0;
|
||||
$this->witherrorsto=0;
|
||||
$this->withtopic=1;
|
||||
$this->withfile=0;
|
||||
$this->withfile=0; // 1=Add section "Attached files". 2=Can add files.
|
||||
$this->withmaindocfile=0; // 1=Add a checkbox "Attach also main document" for mass actions (checked by default), -1=Add checkbox (not checked by default)
|
||||
$this->withbody=1;
|
||||
|
||||
$this->withfromreadonly=1;
|
||||
@ -220,6 +222,7 @@ class FormMail extends Form
|
||||
/**
|
||||
* Show the form to input an email
|
||||
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
* this->withmaindocfile
|
||||
*
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
* @param string $removefileaction Name of action when removing file attachments
|
||||
@ -233,6 +236,7 @@ class FormMail extends Form
|
||||
/**
|
||||
* Get the form to input an email
|
||||
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
* this->withfile
|
||||
* this->param: Contains more parameteres like email templates info
|
||||
*
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
@ -296,16 +300,25 @@ class FormMail extends Form
|
||||
}
|
||||
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
|
||||
//var_dump($this->param["models"]);
|
||||
//var_dump($model_id);
|
||||
//var_dump($arraydefaultmessage);
|
||||
|
||||
$out.= "\n".'<!-- Begin form mail --><div id="mailformdiv"></div>'."\n";
|
||||
$out.= "\n".'<!-- Begin form mail type='.$this->param["models"].' --><div id="mailformdiv"></div>'."\n";
|
||||
if ($this->withform == 1)
|
||||
{
|
||||
$out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
|
||||
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
|
||||
$out.= '<a id="formmail" name="formmail"></a>';
|
||||
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
|
||||
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
$out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
|
||||
$out.= '<a id="formmail" name="formmail"></a>';
|
||||
}
|
||||
if (! empty($this->withfrom))
|
||||
{
|
||||
if (! empty($this->withfromreadonly))
|
||||
{
|
||||
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
||||
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||
}
|
||||
}
|
||||
foreach ($this->param as $key=>$value)
|
||||
{
|
||||
@ -330,7 +343,7 @@ class FormMail extends Form
|
||||
if (count($modelmail_array)>0)
|
||||
{
|
||||
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
|
||||
$out.= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
|
||||
$out.= ' ';
|
||||
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
|
||||
@ -340,7 +353,7 @@ class FormMail extends Form
|
||||
elseif (! empty($this->param['models']) && in_array($this->param['models'], array(
|
||||
'propal_send','order_send','facture_send',
|
||||
'shipping_send','fichinter_send','supplier_proposal_send','order_supplier_send',
|
||||
'invoice_supplier_send','thirdparty','all'
|
||||
'invoice_supplier_send','thirdparty','contract','all'
|
||||
)))
|
||||
{
|
||||
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
@ -357,16 +370,19 @@ class FormMail extends Form
|
||||
$out.= '<table class="border" width="100%">'."\n";
|
||||
|
||||
// Substitution array
|
||||
if (! empty($this->withsubstit))
|
||||
if (! empty($this->withsubstit)) // Unset of set ->withsubstit=0 to disable this.
|
||||
{
|
||||
$out.= '<tr><td colspan="2">';
|
||||
$out.= '<tr><td colspan="2" align="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
$help="";
|
||||
foreach($this->substit as $key => $val)
|
||||
{
|
||||
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||
$help.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
|
||||
}
|
||||
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help);
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
$out.= "</td></tr>\n";
|
||||
//$out.='</div>';
|
||||
}
|
||||
|
||||
// From
|
||||
@ -374,9 +390,7 @@ class FormMail extends Form
|
||||
{
|
||||
if (! empty($this->withfromreadonly))
|
||||
{
|
||||
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
||||
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||
$out.= '<tr><td width="180" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
|
||||
$out.= '<tr><td class="fieldrequired">'.$langs->trans("MailFrom").'</td><td>';
|
||||
|
||||
if (! ($this->fromtype === 'user' && $this->fromid > 0)
|
||||
&& ! ($this->fromtype === 'company')
|
||||
@ -429,10 +443,10 @@ class FormMail extends Form
|
||||
}
|
||||
}
|
||||
$out.= ' '.$form->selectarray('fromtype', $liste, $this->fromtype, 0, 0, 0, '', 0, 0, 0, '', '', 0, '', $disablebademails);
|
||||
//$out.= ajax_combobox('fromtype');
|
||||
}
|
||||
|
||||
$out.= "</td></tr>\n";
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -499,7 +513,7 @@ class FormMail extends Form
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$withtoselected=GETPOST("receiver"); // Array of selected value
|
||||
$withtoselected=GETPOST("receiver",'none'); // Array of selected value
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
|
||||
{
|
||||
$withtoselected = array_keys($tmparray);
|
||||
@ -632,9 +646,12 @@ class FormMail extends Form
|
||||
// Topic
|
||||
if (! empty($this->withtopic))
|
||||
{
|
||||
$defaulttopic="";
|
||||
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic'];
|
||||
elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic;
|
||||
$defaulttopic=GETPOST('subject','none');
|
||||
if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1')
|
||||
{
|
||||
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic'];
|
||||
elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic;
|
||||
}
|
||||
|
||||
$defaulttopic=make_substitutions($defaulttopic,$this->substit);
|
||||
|
||||
@ -660,9 +677,22 @@ class FormMail extends Form
|
||||
$out.= '<td width="180">'.$langs->trans("MailFile").'</td>';
|
||||
|
||||
$out.= '<td>';
|
||||
if (! empty($this->withmaindocfile))
|
||||
{
|
||||
if ($this->withmaindocfile == 1)
|
||||
{
|
||||
$out.='<input type="checkbox" name="addmaindocfile" value="1" />';
|
||||
}
|
||||
if ($this->withmaindocfile == -1)
|
||||
{
|
||||
$out.='<input type="checkbox" name="addmaindocfile" checked="checked" />';
|
||||
}
|
||||
$out.=' '.$langs->trans("JoinMainDoc").'.<br>';
|
||||
}
|
||||
|
||||
if (is_numeric($this->withfile))
|
||||
{
|
||||
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out.= '<script type="text/javascript" language="javascript">';
|
||||
$out.= 'jQuery(document).ready(function () {';
|
||||
@ -685,7 +715,7 @@ class FormMail extends Form
|
||||
$out.= '<br></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox
|
||||
{
|
||||
$out.= $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
@ -701,35 +731,46 @@ class FormMail extends Form
|
||||
{
|
||||
$out.=$this->withfile;
|
||||
}
|
||||
|
||||
$out.= "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Message
|
||||
if (! empty($this->withbody))
|
||||
{
|
||||
$defaultmessage="";
|
||||
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content'];
|
||||
elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody;
|
||||
$defaultmessage=GETPOST('message','none');
|
||||
if (! GETPOST('modelselected','alpha') || GETPOST('modelmailselected') != '-1')
|
||||
{
|
||||
if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content'];
|
||||
elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody;
|
||||
}
|
||||
|
||||
// Complete substitution array
|
||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL))
|
||||
$paymenturl='';
|
||||
if (! empty($conf->global->PAYMENT_ADD_PAYMENT_URL) // Option to enable to add online link into __PERSONALIZED__
|
||||
|| (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL))
|
||||
)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
|
||||
$langs->load('paypal');
|
||||
|
||||
// Set the paypal message and url link into __PERSONALIZED__ key
|
||||
if ($this->param["models"]=='order_send')
|
||||
if (empty($this->substit['__REF__']))
|
||||
{
|
||||
$url=getPaypalPaymentUrl(0,'order',$this->substit['__ORDERREF__']?$this->substit['__ORDERREF__']:$this->substit['__REF__']);
|
||||
$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
|
||||
//$paymenturl='LinkToPayOnlineNotAvailableInThisContext';
|
||||
$paymenturl='';
|
||||
}
|
||||
if ($this->param["models"]=='facture_send')
|
||||
else
|
||||
{
|
||||
$url=getPaypalPaymentUrl(0,'invoice',$this->substit['__REF__']);
|
||||
$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
|
||||
// Set the online payment message and url link into __PERSONALIZED__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$langs->load('paypal');
|
||||
$typeforonlinepayment='free';
|
||||
if ($this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template
|
||||
if ($this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template
|
||||
$url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
|
||||
//$paymenturl=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
|
||||
$paymenturl=$url;
|
||||
}
|
||||
}
|
||||
$this->substit['__PERSONALIZED__']=$paymenturl;
|
||||
$this->substit['__ONLINE_PAYMENT_URL__']='YY'.$paymenturl;
|
||||
|
||||
//Add lines substitution key from each line
|
||||
$lines = '';
|
||||
@ -815,7 +856,7 @@ class FormMail extends Form
|
||||
{
|
||||
$out.= '<script type="text/javascript" language="javascript">';
|
||||
$out.= 'jQuery(document).ready(function () {';
|
||||
$out.= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is calle at every key pressed ! */
|
||||
$out.= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
|
||||
var code = e.keyCode || e.which;
|
||||
if (code == 13) {
|
||||
e.preventDefault();
|
||||
@ -835,11 +876,11 @@ class FormMail extends Form
|
||||
|
||||
|
||||
/**
|
||||
* Return template of email
|
||||
* Search into table c_email_templates
|
||||
* Return templates of email with type = $type_template or type = 'all'
|
||||
* This search into table c_email_templates.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $type_template Get message for key module
|
||||
* @param string $type_template Get message for type=$type_template, type='all' also included.
|
||||
* @param string $user Use template public or limited to this user
|
||||
* @param Translate $outputlangs Output lang object
|
||||
* @param int $id Id template to find
|
||||
@ -852,9 +893,9 @@ class FormMail extends Form
|
||||
|
||||
$sql = "SELECT label, topic, content, content_lines, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$db->escape($type_template)."'";
|
||||
$sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
|
||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
if (!empty($id)) $sql.= " AND rowid=".$id;
|
||||
@ -873,7 +914,7 @@ class FormMail extends Form
|
||||
$ret['content_lines']=$obj->content_lines;
|
||||
$ret['lang']=$obj->lang;
|
||||
}
|
||||
else
|
||||
else // If there is no template at all
|
||||
{
|
||||
$defaultmessage='';
|
||||
if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||
@ -997,17 +1038,19 @@ class FormMail extends Form
|
||||
|
||||
|
||||
/**
|
||||
* Set substit array from object
|
||||
* Set substit array from object. This is call when suggesting the email template into forms to send email.
|
||||
* TODO Replace with getCommonSubstitutionArray with param onlykey = 2
|
||||
*
|
||||
* @param CommonObject $object Object to use
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @param CommonObject $object Object to use
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @return void
|
||||
* @see getCommonSubstitutionArray
|
||||
*/
|
||||
function setSubstitFromObject($object, $outputlangs=null)
|
||||
{
|
||||
global $conf, $user;
|
||||
$this->substit['__REF__'] = $object->ref;
|
||||
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : '';
|
||||
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '');
|
||||
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
|
||||
|
||||
$this->substit['__DATE_YMD__'] = isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '';
|
||||
@ -1027,7 +1070,7 @@ class FormMail extends Form
|
||||
$this->substit['__PERSONALIZED__'] = '';
|
||||
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
|
||||
|
||||
// Create dinamic tags for __EXTRAFIELD_FIELD__
|
||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals($object->id, $extralabels);
|
||||
@ -1035,7 +1078,7 @@ class FormMail extends Form
|
||||
$this->substit['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
||||
}
|
||||
|
||||
//Fill substit_lines with each object lines content
|
||||
// Fill substit_lines with each object lines content
|
||||
if (is_array($object->lines))
|
||||
{
|
||||
foreach ($object->lines as $line)
|
||||
@ -1073,13 +1116,14 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of substition keys available for emails.
|
||||
* This include the complete_substitutions_array. TODO Include the getCommonSubstitutionArray().
|
||||
* Get list of substitution keys available for emails. This is used for tooltips help.
|
||||
* This include the complete_substitutions_array.
|
||||
*
|
||||
* @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
|
||||
* @param Object $object Object if applicable
|
||||
* @return array Array of substitution values for emails.
|
||||
*/
|
||||
static function getAvailableSubstitKey($mode='formemail')
|
||||
static function getAvailableSubstitKey($mode='formemail', $object=null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -1088,20 +1132,20 @@ class FormMail extends Form
|
||||
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
|
||||
{
|
||||
$vars=array(
|
||||
'__REF__',
|
||||
'__REFCLIENT__',
|
||||
'__REFSUPPLIER__',
|
||||
'__THIRDPARTY_ID__',
|
||||
'__THIRDPARTY_NAME__',
|
||||
'__PROJECT_ID__',
|
||||
'__PROJECT_REF__',
|
||||
'__PROJECT_NAME__',
|
||||
'__CONTACTCIVNAME__',
|
||||
'__AMOUNT__',
|
||||
'__AMOUNT_WO_TAX__',
|
||||
'__AMOUNT_VAT__',
|
||||
'__PERSONALIZED__', // Paypal link will be added here in form mode
|
||||
'__SIGNATURE__',
|
||||
'__REF__'=>'__REF__',
|
||||
'__REFCLIENT__'=>'__REFCLIENT__',
|
||||
'__REFSUPPLIER__'=>'__REFSUPPLIER__',
|
||||
'__THIRDPARTY_ID__'=>'__THIRDPARTY_ID__',
|
||||
'__THIRDPARTY_NAME__'=>'__THIRDPARTY_NAME__',
|
||||
'__PROJECT_ID__'=>'__PROJECT_ID__',
|
||||
'__PROJECT_REF__'=>'__PROJECT_REF__',
|
||||
'__PROJECT_NAME__'=>'__PROJECT_NAME__',
|
||||
'__CONTACTCIVNAME__'=>'__CONTACTCIVNAME__',
|
||||
'__AMOUNT__'=>'__AMOUNT__',
|
||||
'__AMOUNT_WO_TAX__'=>'__AMOUNT_WO_TAX__',
|
||||
'__AMOUNT_VAT__'=>'__AMOUNT_VAT__',
|
||||
'__PERSONALIZED__'=>'__PERSONALIZED__', // Paypal link will be added here in form mode
|
||||
'__SIGNATURE__'=>'__SIGNATURE__',
|
||||
);
|
||||
if ($mode == 'formwithlines')
|
||||
{
|
||||
@ -1179,7 +1223,7 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
$parameters=array('mode'=>$mode);
|
||||
$tmparray=getCommonSubstitutionArray($langs);
|
||||
$tmparray=getCommonSubstitutionArray($langs, 2, null, $object);
|
||||
complete_substitutions_array($tmparray, $langs, null, $parameters);
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
|
||||
@ -130,7 +130,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
print "<table class=\"border centpercent\">\n";
|
||||
|
||||
// Substitution array
|
||||
if ($this->withsubstit)
|
||||
if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
|
||||
{
|
||||
print "<tr><td colspan=\"2\">";
|
||||
$help="";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -23,40 +23,6 @@
|
||||
* \brief Library of accountancy functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array with list of admin tabs
|
||||
*
|
||||
* @param AccountingAccount $object Object instance we show card
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function admin_accounting_prepare_head(AccountingAccount $object=null)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array ();
|
||||
|
||||
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
|
||||
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||
$head[$h][2] = 'general';
|
||||
$h ++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php';
|
||||
$head[$h][1] = $langs->trans("ExportOptions");
|
||||
$head[$h][2] = 'export';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
|
||||
@ -142,7 +142,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
print $langs->trans("Status");
|
||||
print ' </td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -618,7 +618,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
$projecttmp = new Project($db);
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -629,7 +629,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
|
||||
if ($user->rights->projet->lire && $userAccess > 0)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
@ -665,7 +664,6 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
}
|
||||
else
|
||||
{
|
||||
$var = false;
|
||||
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$db->free($result);
|
||||
@ -712,6 +710,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.lastname";
|
||||
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_status = '';
|
||||
$search_name = '';
|
||||
$search_addressphone = '';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
$i=-1;
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
@ -741,29 +747,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
$param="socid=".$object->id;
|
||||
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
|
||||
|
||||
$colspan=9;
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create))
|
||||
{
|
||||
$colspan++;
|
||||
print_liste_field_titre('');
|
||||
}
|
||||
// Edit
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,";
|
||||
$sql .= " p.civility as civility_id, p.address, p.zip, p.town";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
@ -778,43 +769,59 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$var=true;
|
||||
$colspan=9;
|
||||
|
||||
if ($num || (GETPOST('button_search','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search_x','alpha')))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Photo - Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat minwidth75" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
|
||||
// Position
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
// Address - Phone - Email
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone">';
|
||||
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
|
||||
print '</td>';
|
||||
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$colspan++;
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
|
||||
// Action
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre( $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre('');
|
||||
// Edit
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
// Photo - Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
|
||||
print '</td>';
|
||||
|
||||
// Position
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
// Address - Phone - Email
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone">';
|
||||
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
|
||||
print '</td>';
|
||||
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$colspan++;
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
// Edit
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i=0;
|
||||
$i=0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -890,11 +897,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[! $var].">";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "\n</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
@ -943,12 +951,8 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=true;
|
||||
|
||||
foreach ($addressstatic->lines as $address)
|
||||
{
|
||||
$var = !$var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>';
|
||||
@ -1115,7 +1119,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -1162,7 +1166,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
}
|
||||
|
||||
// Add also event from emailings. FIXME This should be replaced by an automatic event
|
||||
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
|
||||
if (! empty($conf->mailing->enabled) && ! empty($objcon->email))
|
||||
{
|
||||
$langs->load("mails");
|
||||
@ -1183,7 +1187,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
{
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -1304,7 +1308,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
|
||||
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
|
||||
|
||||
$out.="<tr ".$bc[$var].">";
|
||||
$out.='<tr class="oddeven">';
|
||||
|
||||
// Done or todo
|
||||
if ($donetodo)
|
||||
@ -1446,7 +1450,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
|
||||
// Status
|
||||
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).'</td>';
|
||||
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,0,$histo[$key]['datestart']).'</td>';
|
||||
|
||||
// Actions
|
||||
$out.='<td></td>';
|
||||
@ -1503,12 +1507,10 @@ function show_subsidiaries($conf,$langs,$db,$object)
|
||||
print "</tr>";
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
@ -2283,6 +2283,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
}
|
||||
$original_file=$conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
else if ($modulepart == 'massfilesarea_contract' && !empty($conf->contrat->dir_output))
|
||||
{
|
||||
if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for interventions
|
||||
else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
|
||||
@ -3353,16 +3353,16 @@ function dol_print_error_email($prefixcode, $errormessage='')
|
||||
* @param string $field Field to use for new sorting
|
||||
* @param string $begin ("" by defaut)
|
||||
* @param string $moreparam Add more parameters on sort url links ("" by default)
|
||||
* @param string $td Options of attribute td ("" by defaut, example: 'align="center"')
|
||||
* @param string $moreattrib Options of attribute td ("" by defaut, example: 'align="center"')
|
||||
* @param string $sortfield Current field used to sort
|
||||
* @param string $sortorder Current sort order
|
||||
* @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag.
|
||||
* @param string $tooltip Tooltip
|
||||
* @return void
|
||||
*/
|
||||
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $td="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
|
||||
function print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="")
|
||||
{
|
||||
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $td, $sortfield, $sortorder, $prefix, 0, $tooltip);
|
||||
print getTitleFieldOfList($name, 0, $file, $field, $begin, $moreparam, $moreattrib, $sortfield, $sortorder, $prefix, 0, $tooltip);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3414,13 +3414,13 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
|
||||
|
||||
if ($field1 != $sortfield1) // We are on another field
|
||||
{
|
||||
if (preg_match('/^DESC/', $sortorder)) $out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">';
|
||||
else $out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">';
|
||||
if (preg_match('/^DESC/', $sortorder)) $out.= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">';
|
||||
else $out.= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">';
|
||||
}
|
||||
else // We are of first sorting criteria
|
||||
{
|
||||
if (preg_match('/^ASC/', $sortorder)) $out.= '<a href="'.$file.'?sortfield='.$sortfield.'&sortorder=desc&begin='.$begin.$options.'">';
|
||||
else $out.= '<a href="'.$file.'?sortfield='.$sortfield.'&sortorder=asc&begin='.$begin.$options.'">';
|
||||
if (preg_match('/^ASC/', $sortorder)) $out.= '<a class="reposition" href="'.$file.'?sortfield='.$sortfield.'&sortorder=desc&begin='.$begin.$options.'">';
|
||||
else $out.= '<a class="reposition" href="'.$file.'?sortfield='.$sortfield.'&sortorder=asc&begin='.$begin.$options.'">';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4823,20 +4823,25 @@ function picto_required()
|
||||
|
||||
|
||||
/**
|
||||
* Clean a string from all HTML tags and entities
|
||||
* Clean a string from all HTML tags and entities.
|
||||
* This function differs from strip_tags because:
|
||||
* - <br> are replace with \n
|
||||
* - if entities are found, they are decoded before the strip
|
||||
* - you can decide to convert line feed into spaces
|
||||
*
|
||||
* @param string $StringHtml String to clean
|
||||
* @param string $stringtoclean String to clean
|
||||
* @param integer $removelinefeed 1=Replace also new lines by a space, 0=Only last one are removed
|
||||
* @param string $pagecodeto Encoding of input/output string
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag
|
||||
* @see dol_escape_htmltag strip_tags
|
||||
*/
|
||||
function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
// TODO Try to replace with strip_tags($stringtoclean)
|
||||
$pattern = "/<[^<>]+>/";
|
||||
$StringHtml = preg_replace('/<br[^>]*>/', "\n", $StringHtml);
|
||||
$temp = dol_html_entity_decode($StringHtml,ENT_COMPAT,$pagecodeto);
|
||||
$stringtoclean = preg_replace('/<br[^>]*>/', "\n", $stringtoclean);
|
||||
$temp = dol_html_entity_decode($stringtoclean,ENT_COMPAT,$pagecodeto);
|
||||
|
||||
// Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
|
||||
$temp = preg_replace($pattern,"",$temp); // pass 1
|
||||
@ -4852,8 +4857,8 @@ function dol_string_nohtmltag($StringHtml,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
$temp = str_replace(" "," ",$temp);
|
||||
}
|
||||
$CleanString = trim($temp);
|
||||
return $CleanString;
|
||||
|
||||
return trim($temp);
|
||||
}
|
||||
|
||||
|
||||
@ -5186,25 +5191,32 @@ function dol_concatdesc($text1,$text2,$forxml=false)
|
||||
|
||||
|
||||
/**
|
||||
* Return array of possible common substitutions.
|
||||
* Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user'
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $onlykey Do not calculate heavy values of keys (performance enhancement when we need only the keys)
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'objectamount', 'date', 'user', ...)
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are trunc and html sanitized (to use for help tooltip)
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @param Object $object Object for keys on object
|
||||
* @return array Array of substitutions
|
||||
* @see setSubstitFromObject
|
||||
*/
|
||||
function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
|
||||
{
|
||||
global $conf, $mysoc, $user;
|
||||
global $db, $conf, $mysoc, $user;
|
||||
|
||||
$substitutionarray=array();
|
||||
|
||||
if (empty($exclude) || ! in_array('system', $exclude))
|
||||
{
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT
|
||||
));
|
||||
}
|
||||
if (empty($exclude) || ! in_array('mycompany', $exclude))
|
||||
{
|
||||
$substitutionarray=array_merge($substitutionarray, array(
|
||||
'__MYCOMPANY_NAME__' => $mysoc->name,
|
||||
'__MYCOMPANY_EMAIL__' => $mysoc->email,
|
||||
'__MYCOMPANY_NAME__' => $mysoc->name,
|
||||
'__MYCOMPANY_EMAIL__' => $mysoc->email,
|
||||
'__MYCOMPANY_PROFID1__' => $mysoc->idprof1,
|
||||
'__MYCOMPANY_PROFID2__' => $mysoc->idprof2,
|
||||
'__MYCOMPANY_PROFID3__' => $mysoc->idprof3,
|
||||
@ -5215,17 +5227,53 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
|
||||
));
|
||||
}
|
||||
if (is_object($object) && (empty($exclude) || ! in_array('object', $exclude)))
|
||||
{
|
||||
$substitutionarray['__ID__'] = $object->id;
|
||||
$substitutionarray['__REF__'] = $object->ref;
|
||||
$substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : ''));
|
||||
$substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : '');
|
||||
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0)
|
||||
{
|
||||
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
|
||||
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
|
||||
}
|
||||
|
||||
if (is_object($object->projet) && $object->projet->id > 0)
|
||||
{
|
||||
$substitutionarray['__PROJECT_ID__'] = (is_object($object->projet)?$object->projet->id:'');
|
||||
$substitutionarray['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
|
||||
}
|
||||
|
||||
// Create dynamic tags for __EXTRAFIELD_FIELD__
|
||||
if ($object->table_element && $object->id > 0)
|
||||
{
|
||||
$extrafieldstmp = new ExtraFields($db);
|
||||
$extralabels = $extrafieldstmp->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals($object->id, $extralabels);
|
||||
foreach ($extrafieldstmp->attribute_label as $key => $label) {
|
||||
$substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
|
||||
}
|
||||
}
|
||||
|
||||
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'LinkToPayOnlineIfApplicable';
|
||||
}
|
||||
if (empty($exclude) || ! in_array('objectamount', $exclude))
|
||||
{
|
||||
if (is_object($object)) // For backward compatibility
|
||||
$substitutionarray['__DATE_YMD__'] = is_object($object)?(isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : '') : '';
|
||||
$substitutionarray['__DATE_DUE_YMD__'] = is_object($object)?(isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '') : '';
|
||||
$substitutionarray['__AMOUNT__'] = is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__AMOUNT_WO_TAX__']= is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__AMOUNT_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
// For backward compatibility
|
||||
if ($onlykey != 2)
|
||||
{
|
||||
$substitutionarray['__TOTAL_TTC__'] =is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__TOTAL_HT__'] =is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__TOTAL_VAT__'] =is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
$substitutionarray['__TOTAL_TTC__'] = is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__TOTAL_HT__'] = is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__TOTAL_VAT__'] = is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
}
|
||||
$substitutionarray['__AMOUNT__'] =is_object($object)?$object->total_ttc:'';
|
||||
$substitutionarray['__AMOUNT_WO_TAX__']=is_object($object)?$object->total_ht:'';
|
||||
$substitutionarray['__AMOUNT_VAT__'] =is_object($object)?($object->total_vat?$object->total_vat:$object->total_tva):'';
|
||||
}
|
||||
|
||||
if (empty($exclude) || ! in_array('date', $exclude))
|
||||
@ -5265,7 +5313,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
||||
'__USER_LASTNAME__' => $user->lastname,
|
||||
'__USER_FIRSTNAME__' => $user->firstname,
|
||||
'__USER_FULLNAME__' => $user->getFullName($outputlangs),
|
||||
'__USER_SUPERVISOR_ID__' => $user->fk_user
|
||||
'__USER_SUPERVISOR_ID__' => $user->fk_user,
|
||||
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
|
||||
));
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled))
|
||||
|
||||
@ -117,11 +117,11 @@ function showOnlinePaymentUrl($type,$ref)
|
||||
* @param int $mode 0=True url, 1=Url formated with colors
|
||||
* @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...)
|
||||
* @param string $ref Ref of object
|
||||
* @param int $amount Amount
|
||||
* @param int $amount Amount (required for $type='free' only)
|
||||
* @param string $freetag Free tag
|
||||
* @return string Url string
|
||||
*/
|
||||
function getOnlinePaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_free_tag')
|
||||
function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='your_free_tag')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@ -309,7 +309,7 @@ function show_stats_for_company($product,$socid)
|
||||
print '<td align="right" width="25%">'.$langs->trans("TotalQuantity").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Propals
|
||||
// Customer proposals
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@ -327,7 +327,25 @@ function show_stats_for_company($product,$socid)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Commandes clients
|
||||
// Supplier proposals
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$nblines++;
|
||||
$ret=$product->load_stats_proposal_supplier($socid);
|
||||
if ($ret < 0) dol_print_error($db);
|
||||
$langs->load("propal");
|
||||
print '<tr><td>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('','propal').' '.$langs->trans("SupplierProposals").'</a>';
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_proposal_supplier['suppliers'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_proposal_supplier['nb'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_proposal_supplier['qty'];
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Customer orders
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@ -345,7 +363,7 @@ function show_stats_for_company($product,$socid)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Commandes fournisseurs
|
||||
// Supplier orders
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@ -363,25 +381,7 @@ function show_stats_for_company($product,$socid)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Contrats
|
||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
$nblines++;
|
||||
$ret=$product->load_stats_contrat($socid);
|
||||
if ($ret < 0) dol_print_error($db);
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['customers'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['nb'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['qty'];
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Factures clients
|
||||
// Customer invoices
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@ -399,7 +399,7 @@ function show_stats_for_company($product,$socid)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Factures fournisseurs
|
||||
// Supplier invoices
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$nblines++;
|
||||
@ -418,6 +418,25 @@ function show_stats_for_company($product,$socid)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Contracts
|
||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
$nblines++;
|
||||
$ret=$product->load_stats_contrat($socid);
|
||||
if ($ret < 0) dol_print_error($db);
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('','contract').' '.$langs->trans("Contracts").'</a>';
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['customers'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['nb'];
|
||||
print '</td><td align="right">';
|
||||
print $product->stats_contrat['qty'];
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
return $nblines++;
|
||||
}
|
||||
|
||||
|
||||
@ -217,18 +217,21 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
-- Setup
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2453__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_general', 2451__+MAX_llx_menu__, '/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'General', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2463__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 54, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2463__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 55, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2464__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
|
||||
-- Accounting period
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
|
||||
-- Binding
|
||||
|
||||
@ -288,7 +288,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
{
|
||||
// url = url from host, shorturl = relative path into dolibarr sources
|
||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
|
||||
{
|
||||
$tmp=explode('?',$newTabMenu[$i]['url'],2);
|
||||
$url = $shorturl = $tmp[0];
|
||||
@ -323,7 +323,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
foreach($menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
|
||||
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url']!='#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry($menuval['enabled']);
|
||||
}
|
||||
|
||||
@ -969,37 +969,30 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
// Chart of account
|
||||
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 10);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 20);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 30);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 31);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 20);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 30);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 40);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 42);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51);
|
||||
}
|
||||
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 52);
|
||||
}
|
||||
if (! empty($conf->tax->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 53);
|
||||
}
|
||||
if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 54);
|
||||
}
|
||||
/* not required yet, already supported by default account
|
||||
if (! empty($conf->loan->enabled))
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/loan.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuLoanAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_loan', 45);
|
||||
}
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
|
||||
}*/
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 55);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60);
|
||||
|
||||
// Fiscal year
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
|
||||
@ -1083,36 +1076,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
else dol_print_error($db);
|
||||
$db->free($resql);
|
||||
|
||||
/*
|
||||
$sql = "SELECT rowid, label, accountancy_journal";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " AND clos = 0";
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$numr = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
if ($numr > 0)
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_account='.$objp->rowid,$langs->trans("Journal").' - '.dol_trunc($objp->label,10),2,$user->rights->accounting->comptarapport->lire);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
$db->free($resql);
|
||||
|
||||
// Add other journal
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal",$langs->trans("ExpenseReportsJournal"),2,$user->rights->accounting->comptarapport->lire);
|
||||
*/
|
||||
}
|
||||
|
||||
// General Ledger
|
||||
|
||||
@ -83,6 +83,7 @@ class pdf_strato extends ModelePDFContract
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$formatarray=pdf_getFormat();
|
||||
|
||||
$this->page_largeur = $formatarray['width'];
|
||||
$this->page_hauteur = $formatarray['height'];
|
||||
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||
@ -397,7 +398,7 @@ class pdf_strato extends ModelePDFContract
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -465,17 +466,20 @@ class pdf_strato extends ModelePDFContract
|
||||
|
||||
if (empty($hidebottom))
|
||||
{
|
||||
$pdf->SetXY(20,230);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
|
||||
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
|
||||
$posy = $tab_top + $tab_height + 3 + 3;
|
||||
|
||||
$pdf->SetXY(20,235);
|
||||
$pdf->MultiCell(80,25, '', 1);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
|
||||
|
||||
$pdf->SetXY(110,230);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
|
||||
$pdf->SetXY($this->marge_gauche, $posy + 5);
|
||||
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 20, '', 1);
|
||||
|
||||
$pdf->SetXY(110,235);
|
||||
$pdf->MultiCell(80,25, '', 1);
|
||||
$pdf->SetXY($posmiddle + 5, $posy);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
|
||||
|
||||
$pdf->SetXY($posmiddle + 5, $posy + 5);
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,12 +35,12 @@ class modAccounting extends DolibarrModules
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->db = $db;
|
||||
$this->numero = 50400;
|
||||
|
||||
$this->family = "financial";
|
||||
@ -60,7 +60,7 @@ class modAccounting extends DolibarrModules
|
||||
$this->dirs = array('/accounting/temp');
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array('index.php@accountancy');
|
||||
$this->config_page_url = array();
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
|
||||
@ -84,116 +84,57 @@ class modAccounting extends DolibarrModules
|
||||
"1",
|
||||
"With this constants on, bank account number is always required"
|
||||
);
|
||||
$this->const[1] = array(
|
||||
"ACCOUNTING_EXPORT_SEPARATORCSV",
|
||||
"string",
|
||||
","
|
||||
);
|
||||
$this->const[2] = array(
|
||||
$this->const[3] = array(
|
||||
"ACCOUNTING_ACCOUNT_SUSPENSE",
|
||||
"chaine",
|
||||
"471"
|
||||
);
|
||||
$this->const[3] = array(
|
||||
"ACCOUNTING_SELL_JOURNAL",
|
||||
"chaine",
|
||||
"VTE"
|
||||
);
|
||||
$this->const[4] = array(
|
||||
"ACCOUNTING_PURCHASE_JOURNAL",
|
||||
"chaine",
|
||||
"ACH"
|
||||
);
|
||||
$this->const[5] = array(
|
||||
"ACCOUNTING_SOCIAL_JOURNAL",
|
||||
"chaine",
|
||||
"SOC"
|
||||
);
|
||||
$this->const[6] = array(
|
||||
"ACCOUNTING_MISCELLANEOUS_JOURNAL",
|
||||
"chaine",
|
||||
"OD"
|
||||
);
|
||||
$this->const[7] = array(
|
||||
"ACCOUNTING_ACCOUNT_TRANSFER_CASH",
|
||||
"chaine",
|
||||
"58"
|
||||
);
|
||||
$this->const[8] = array(
|
||||
$this->const[5] = array(
|
||||
"CHARTOFACCOUNTS",
|
||||
"chaine",
|
||||
"2"
|
||||
);
|
||||
$this->const[9] = array(
|
||||
$this->const[6] = array(
|
||||
"ACCOUNTING_EXPORT_MODELCSV",
|
||||
"chaine",
|
||||
"1"
|
||||
);
|
||||
$this->const[10] = array(
|
||||
$this->const[7] = array(
|
||||
"ACCOUNTING_LENGTH_GACCOUNT",
|
||||
"chaine",
|
||||
""
|
||||
);
|
||||
$this->const[11] = array(
|
||||
$this->const[8] = array(
|
||||
"ACCOUNTING_LENGTH_AACCOUNT",
|
||||
"chaine",
|
||||
""
|
||||
);
|
||||
$this->const[13] = array(
|
||||
$this->const[9] = array(
|
||||
"ACCOUNTING_LIST_SORT_VENTILATION_TODO",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
$this->const[14] = array(
|
||||
$this->const[10] = array(
|
||||
"ACCOUNTING_LIST_SORT_VENTILATION_DONE",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
/*
|
||||
$this->const[15] = array (
|
||||
"ACCOUNTING_GROUPBYACCOUNT",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
*/
|
||||
$this->const[16] = array (
|
||||
$this->const[11] = array (
|
||||
"ACCOUNTING_EXPORT_DATE",
|
||||
"chaine",
|
||||
"%d%m%Y"
|
||||
);
|
||||
/*
|
||||
$this->const[17] = array (
|
||||
"ACCOUNTING_EXPORT_PIECE",
|
||||
"yesno",
|
||||
"1"
|
||||
$this->const[12] = array(
|
||||
"ACCOUNTING_EXPORT_SEPARATORCSV",
|
||||
"string",
|
||||
","
|
||||
);
|
||||
$this->const[18] = array (
|
||||
"ACCOUNTING_EXPORT_GLOBAL_ACCOUNT",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
$this->const[19] = array (
|
||||
"ACCOUNTING_EXPORT_LABEL",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
$this->const[20] = array (
|
||||
"ACCOUNTING_EXPORT_AMOUNT",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
$this->const[21] = array (
|
||||
"ACCOUNTING_EXPORT_DEVISE",
|
||||
"yesno",
|
||||
"1"
|
||||
);
|
||||
*/
|
||||
$this->const[22] = array(
|
||||
"ACCOUNTING_EXPENSEREPORT_JOURNAL",
|
||||
"chaine",
|
||||
"ER"
|
||||
);
|
||||
$this->const[23] = array(
|
||||
$this->const[13] = array(
|
||||
"ACCOUNTING_EXPORT_FORMAT",
|
||||
"chaine",
|
||||
"csv"
|
||||
|
||||
@ -162,7 +162,7 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
@ -170,7 +170,7 @@ class modProduct extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
|
||||
206
htdocs/core/tpl/card_presend.tpl.php
Normal file
206
htdocs/core/tpl/card_presend.tpl.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Code to ouput content when action is presend
|
||||
*
|
||||
* $trackid must be defined
|
||||
* $modelmail
|
||||
* $defaulttopic
|
||||
* $diroutput
|
||||
*/
|
||||
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
$titreform='SendMail';
|
||||
|
||||
$object->fetch_projet();
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
//
|
||||
if ($object->element == 'invoice_supplier')
|
||||
{
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
||||
}
|
||||
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
{
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
}
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
{
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
$topicmail='';
|
||||
if (empty($object->ref_client)) {
|
||||
$topicmail = $outputlangs->trans($defaulttopic, '__REF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$topicmail = $outputlangs->trans($defaulttopic, '__REF__ (__REFCLIENT__)');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans($titreform));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if ($formmail->fromtype === 'user')
|
||||
{
|
||||
$formmail->fromid = $user->id;
|
||||
}
|
||||
$formmail->trackid=$trackid;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
|
||||
$liste = array();
|
||||
if ($object->element == 'expensereport')
|
||||
{
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($object->fk_user_author);
|
||||
$liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
|
||||
}
|
||||
elseif ($object->element == 'societe')
|
||||
{
|
||||
foreach ($object->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $topicmail;
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = '';
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
// Add specific substitution for contracts
|
||||
if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
|
||||
{
|
||||
$datenextexpiration = '';
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if ($line->statut != 4)
|
||||
continue;
|
||||
if ($line->date_fin_prevue > $datenextexpiration)
|
||||
$datenextexpiration = $line->date_fin_prevue;
|
||||
}
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
}
|
||||
|
||||
// Choose one contact for the __CONTACTCIVNAME__ TODO Really not reliable.
|
||||
/*
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(-1, 'external');
|
||||
if (is_array($contactarr) && count($contactarr) > 0)
|
||||
{
|
||||
foreach ($contactarr as $contact)
|
||||
{
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}*/
|
||||
|
||||
$parameters = array(
|
||||
'mode' => 'formemail'
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters);
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit = $substitutionarray;
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
163
htdocs/core/tpl/massactions_form.tpl.php
Normal file
163
htdocs/core/tpl/massactions_form.tpl.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
// Following var must be set:
|
||||
// $arrayofselected = array of id selected
|
||||
// $object
|
||||
// $objecttmp=new Propal($db);
|
||||
// $topicmail="SendSupplierProposalRef";
|
||||
// $modelmail="supplier_proposal_send";
|
||||
// $trackid='ord'.$object->id;
|
||||
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$listofselectedid = array();
|
||||
$listofselectedthirdparties = array();
|
||||
$listofselectedref = array();
|
||||
foreach ($arrayofselected as $toselectid)
|
||||
{
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid] = $toselectid;
|
||||
$thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
|
||||
if ($objecttmp->element == 'societe')
|
||||
$thirdpartyid = $objecttmp->id;
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
$thirdpartyid = $objecttmp->fk_user_author;
|
||||
$listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform = -1;
|
||||
$formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user'));
|
||||
|
||||
if ($formmail->fromtype === 'user')
|
||||
{
|
||||
$formmail->fromid = $user->id;
|
||||
}
|
||||
$formmail->trackid = $trackid;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
$formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = $langs->trans("AllRecipientSelected", count($listofselectedthirdparties));
|
||||
if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts
|
||||
{
|
||||
$liste = array();
|
||||
$thirdpartyid = array_shift($listofselectedthirdparties);
|
||||
if ($objecttmp->element == 'expensereport')
|
||||
{
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($thirdpartyid);
|
||||
$liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">";
|
||||
}
|
||||
else
|
||||
{
|
||||
$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->withtocc = 1;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile = 1;
|
||||
// $formmail->withfile = 2; Not yet supported in mass action
|
||||
$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document"
|
||||
if ($objecttmp->element != 'societe') {
|
||||
$formmail->withfile = $langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default
|
||||
}
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
|
||||
$substitutionarray['__EMAIL__'] = $sendto;
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = '';
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
// Add specific substitution for contracts
|
||||
if (is_object($object) && $object->element == 'contrat' && is_array($object->lines))
|
||||
{
|
||||
$datenextexpiration = '';
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if ($line->statut != 4)
|
||||
continue;
|
||||
if ($line->date_fin_prevue > $datenextexpiration)
|
||||
$datenextexpiration = $line->date_fin_prevue;
|
||||
}
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
|
||||
$substitutionarray['__CONTRACT_NEXT_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'mode' => 'formemail'
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->substit = $substitutionarray;
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action'] = $action;
|
||||
$formmail->param['models'] = $modelmail;
|
||||
$formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
|
||||
$formmail->param['id'] = join(',', $arrayofselected);
|
||||
// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $formmail->get_form();
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -111,6 +111,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'CONTRACT_SENTBYMAIL')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("contract");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail",$object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
$object->actionmsg=$langs->transnoentities("ContractSentByEMail",$object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'PROPAL_VALIDATE')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
@ -334,7 +349,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$langs->load("interventions");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
$object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
@ -404,6 +422,54 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("propal");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
|
||||
$object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
|
||||
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("propal");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
|
||||
if (empty($object->actionmsg))
|
||||
{
|
||||
$object->actionmsg=$langs->transnoentities("ProposalSentByEMail",$object->ref);
|
||||
}
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("propal");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
|
||||
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("propal");
|
||||
|
||||
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
|
||||
|
||||
$object->sendtoid=0;
|
||||
}
|
||||
elseif ($action == 'ORDER_SUPPLIER_CREATE')
|
||||
{
|
||||
$langs->load("agenda");
|
||||
|
||||
@ -765,6 +765,10 @@ if (! empty($id) && $action != 'edit')
|
||||
|
||||
print $formfile->showdocuments('donation',$filename,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('don'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
74
htdocs/don/tpl/linkedobjectblock.tpl.php
Normal file
74
htdocs/don/tpl/linkedobjectblock.tpl.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Charlene Benke <cf.benke@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("donations");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$ilink++;
|
||||
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Donation"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?>
|
||||
</td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -125,9 +125,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
$action='';
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
|
||||
$fk_projet='';
|
||||
$date_start='';
|
||||
$date_end='';
|
||||
@ -137,7 +143,7 @@ if (empty($reshook))
|
||||
$value_unit='';
|
||||
$qty=1;
|
||||
$fk_c_type_fees=-1;
|
||||
}
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -1260,6 +1266,15 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='EXPENSEREPORT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_EXPENSEREPORT_TO';
|
||||
$trackid='exp'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->expensereport->dir_output;
|
||||
$permissioncreate = $user->rights->expensereport->creer;
|
||||
@ -2084,7 +2099,7 @@ else
|
||||
print '<td style="text-align:center;">';
|
||||
print '<input type="hidden" name="rowid" value="'.$line->rowid.'">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
print '<br /><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -2201,6 +2216,14 @@ if ($action != 'create' && $action != 'edit')
|
||||
$object = new ExpenseReport($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
// Send
|
||||
if ($object->fk_statut > ExpenseReport::STATUS_DRAFT) {
|
||||
//if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expensereport->expensereport_advance->send)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
//} else
|
||||
// print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
/* Si l'état est "Brouillon"
|
||||
* ET user à droit "creer/supprimer"
|
||||
@ -2354,48 +2377,65 @@ print '</div>';
|
||||
//$conf->global->DOL_URL_ROOT_DOCUMENT_PHP=dol_buildpath('/expensereport/documentwrapper.php',1);
|
||||
|
||||
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
/*
|
||||
* Generate documents
|
||||
*/
|
||||
|
||||
if($user->rights->expensereport->export && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = 1;
|
||||
$delallowed = 1;
|
||||
$var = true;
|
||||
print $formfile->showdocuments('expensereport',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action != 'create' && $action != 'edit' && ($id || $ref))
|
||||
if ($action != 'presend')
|
||||
{
|
||||
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
// Link invoice to intervention
|
||||
if (GETPOST('LinkedFichinter')) {
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->add_object_linked('fichinter', GETPOST('LinkedFichinter'));
|
||||
}
|
||||
/*
|
||||
* Generate documents
|
||||
*/
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelements=array();
|
||||
if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION))
|
||||
{
|
||||
$linktoelements[]='fichinter';
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
}
|
||||
if($user->rights->expensereport->export && $action != 'create' && $action != 'edit')
|
||||
{
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed = 1;
|
||||
$delallowed = 1;
|
||||
$var = true;
|
||||
print $formfile->showdocuments('expensereport',$filename,$filedir,$urlsource,$genallowed,$delallowed);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action != 'create' && $action != 'edit' && ($id || $ref))
|
||||
{
|
||||
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Link invoice to intervention
|
||||
if (GETPOST('LinkedFichinter')) {
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->add_object_linked('fichinter', GETPOST('LinkedFichinter'));
|
||||
}
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelements=array();
|
||||
if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION))
|
||||
{
|
||||
$linktoelements[]='fichinter';
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='expensereport';
|
||||
$defaulttopic='SendExpenseReportRef';
|
||||
$diroutput = $conf->expensereport->dir_output;
|
||||
$trackid = 'exp'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -36,14 +36,14 @@ $langs->load("companies");
|
||||
$langs->load("users");
|
||||
$langs->load("trips");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Security check
|
||||
$socid = $_GET["socid"]?$_GET["socid"]:'';
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expensereport','','');
|
||||
|
||||
@ -79,8 +79,8 @@ $optioncss = GETPOST('optioncss','alpha');
|
||||
if ($search_status == '') $search_status=-1;
|
||||
if ($search_user == '') $search_user=-1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='expensereportlist';
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'expensereportlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('expensereportlist'));
|
||||
@ -139,25 +139,31 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test must be present to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_user="";
|
||||
$search_amount_ht="";
|
||||
$search_amount_vat="";
|
||||
$search_amount_ttc="";
|
||||
$search_status="";
|
||||
$month_start="";
|
||||
$year_start="";
|
||||
$month_end="";
|
||||
$year_end="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test must be present to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_user="";
|
||||
$search_amount_ht="";
|
||||
$search_amount_vat="";
|
||||
$search_amount_ttc="";
|
||||
$search_status="";
|
||||
$month_start="";
|
||||
$year_start="";
|
||||
$month_end="";
|
||||
$year_end="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||
{
|
||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='ExpenseReport';
|
||||
$objectlabel='ExpenseReport';
|
||||
$permtoread = $user->rights->expensereport->lire;
|
||||
@ -167,7 +173,6 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -176,7 +181,8 @@ $form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
llxHeader('', $langs->trans("ListOfTrips"));
|
||||
$title = $langs->trans("ListOfTrips");
|
||||
llxHeader('', $title);
|
||||
|
||||
$max_year = 5;
|
||||
$min_year = 5;
|
||||
@ -184,7 +190,7 @@ $min_year = 5;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
|
||||
$sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,";
|
||||
$sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.statut, u.photo";
|
||||
$sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@ -267,6 +273,7 @@ $sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
@ -276,14 +283,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
//print $sql;
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$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;
|
||||
@ -303,25 +310,37 @@ if ($resql)
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
// Lines of title fields
|
||||
print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$title = $langs->trans("ListTripsAndExpenses");
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$topicmail="SendExpenseReport";
|
||||
$modelmail="expensereport";
|
||||
$objecttmp=new ExpenseReport($db);
|
||||
$trackid='int'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
@ -570,6 +589,7 @@ if ($resql)
|
||||
$usertmp->login=$obj->login;
|
||||
$usertmp->statut=$obj->statut;
|
||||
$usertmp->photo=$obj->photo;
|
||||
$usertmp->email=$obj->email;
|
||||
print $usertmp->getNomUrl(-1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
@ -714,16 +714,19 @@ if (empty($reshook))
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$paramname='id';
|
||||
$mode='emailfromintervention';
|
||||
$trigger_name='FICHINTER_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_FICHINTER_TO';
|
||||
$trackid='int'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->ficheinter->dir_output;
|
||||
$permissioncreate = $user->rights->ficheinter->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
@ -752,11 +755,6 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->ficheinter->dir_output;
|
||||
$permissioncreate = $user->rights->ficheinter->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
@ -1714,124 +1712,18 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
// Presend form
|
||||
$modelmail='fichinter_send';
|
||||
$defaulttopic='SendInterventionRef';
|
||||
$diroutput = $conf->ficheinter->dir_output;
|
||||
$trackid = 'int'.$object->id;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('interventions');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file))
|
||||
{
|
||||
$result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendInterventionByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='int'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'int'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$outputlangs->trans('SendInterventionRef','__FICHINTERREF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit['__FICHINTERREF__']=$object->ref;
|
||||
|
||||
//Find the good contact adress
|
||||
$custcontact='';
|
||||
$contactarr=array();
|
||||
$contactarr=$object->liste_contact(-1,'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr)>0) {
|
||||
foreach($contactarr as $contact) {
|
||||
if ($contact['libelle']==$langs->trans('TypeContact_fichinter_external_CUSTOMER')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactstatic=new Contact($db);
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$custcontact=$contactstatic->getFullName($langs,1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='fichinter_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['fichinter_id']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode")=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||
}
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -134,7 +134,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action='';
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -904,11 +912,21 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='ORDER_SUPPLIER_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO';
|
||||
$trackid='sor'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->fournisseur->commande->dir_output;
|
||||
$permissioncreate = $user->rights->fournisseur->commande->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
// Fill array 'array_options' with data from add form
|
||||
@ -946,9 +964,6 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* Create an order
|
||||
*/
|
||||
@ -1158,18 +1173,6 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='ORDER_SUPPLIER_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromsupplierorder';
|
||||
$trackid='sor'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$ws_url = $object->thirdparty->webservices_url;
|
||||
@ -2143,343 +2146,6 @@ elseif (! empty($object->id))
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file))
|
||||
{
|
||||
$result= $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendOrderByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='sor'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
|
||||
$formmail->withtopic=$outputlangs->trans('SendOrderRef','__REF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
|
||||
$object->fetch_projet();
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit['__ORDERREF__']=$object->ref; // For backward compatibility
|
||||
$formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier; // For backward compatibility
|
||||
$formmail->substit['__SUPPLIERORDERREF__']=$object->ref_supplier;
|
||||
|
||||
//Find the good contact adress
|
||||
$custcontact='';
|
||||
$contactarr=array();
|
||||
$contactarr=$object->liste_contact(-1,'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr)>0) {
|
||||
foreach($contactarr as $contact) {
|
||||
if ($contact['libelle']==$langs->trans('TypeContact_order_supplier_external_BILLING')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactstatic=new Contact($db);
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$custcontact=$contactstatic->getFullName($langs,1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='order_supplier_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['orderid']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode")=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
/*
|
||||
* Action webservice
|
||||
*/
|
||||
elseif ($action == 'webservice' && GETPOST('mode', 'alpha') != "send" && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
$ws_url = $object->thirdparty->webservices_url;
|
||||
$ws_key = $object->thirdparty->webservices_key;
|
||||
$ws_user = GETPOST('ws_user','alpha');
|
||||
$ws_password = GETPOST('ws_password','alpha');
|
||||
|
||||
// NS and Authentication parameters
|
||||
$ws_ns = 'http://www.dolibarr.org/ns/';
|
||||
$ws_authentication = array(
|
||||
'dolibarrkey'=>$ws_key,
|
||||
'sourceapplication'=>'DolibarrWebServiceClient',
|
||||
'login'=>$ws_user,
|
||||
'password'=>$ws_password,
|
||||
'entity'=>''
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans('CreateRemoteOrder'),'');
|
||||
|
||||
//Is everything filled?
|
||||
if (empty($ws_url) || empty($ws_key)) {
|
||||
setEventMessages($langs->trans("ErrorWebServicesFieldsRequired"), null, 'errors');
|
||||
$mode = "init";
|
||||
$error_occurred = true; //Don't allow to set the user/pass if thirdparty fields are not filled
|
||||
} else if ($mode != "init" && (empty($ws_user) || empty($ws_password))) {
|
||||
setEventMessages($langs->trans("ErrorFieldsRequired"), null, 'errors');
|
||||
$mode = "init";
|
||||
}
|
||||
|
||||
if ($mode == "init")
|
||||
{
|
||||
//Table/form header
|
||||
print '<table class="border" width="100%">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="webservice">';
|
||||
print '<input type="hidden" name="mode" value="check">';
|
||||
|
||||
if ($error_occurred)
|
||||
{
|
||||
print "<br>".$langs->trans("ErrorOccurredReviseAndRetry")."<br>";
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$textinput_size = "50";
|
||||
// Webservice url
|
||||
print '<tr><td>'.$langs->trans("WebServiceURL").'</td><td colspan="3">'.dol_print_url($ws_url).'</td></tr>';
|
||||
//Remote User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td><input size="'.$textinput_size.'" type="text" name="ws_user"></td></tr>';
|
||||
//Remote Password
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input size="'.$textinput_size.'" type="text" name="ws_password"></td></tr>';
|
||||
//Submit button
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
print '<input class="button" type="submit" id="ws_submit" name="ws_submit" value="'.$langs->trans("CreateRemoteOrder").'">';
|
||||
print ' ';
|
||||
//Cancel button
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
//End table/form
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
}
|
||||
elseif ($mode == "check")
|
||||
{
|
||||
$ws_entity = '';
|
||||
$ws_thirdparty = '';
|
||||
$error_occurred = false;
|
||||
|
||||
//Create SOAP client and connect it to user
|
||||
$soapclient_user = new nusoap_client($ws_url."/webservices/server_user.php");
|
||||
$soapclient_user->soap_defencoding='UTF-8';
|
||||
$soapclient_user->decodeUTF8(false);
|
||||
|
||||
//Get the thirdparty associated to user
|
||||
$ws_parameters = array('authentication'=>$ws_authentication, 'id' => '', 'ref'=>$ws_user);
|
||||
$result_user = $soapclient_user->call("getUser", $ws_parameters, $ws_ns, '');
|
||||
$user_status_code = $result_user["result"]["result_code"];
|
||||
|
||||
if ($user_status_code == "OK")
|
||||
{
|
||||
//Fill the variables
|
||||
$ws_entity = $result_user["user"]["entity"];
|
||||
$ws_authentication['entity'] = $ws_entity;
|
||||
$ws_thirdparty = $result_user["user"]["fk_thirdparty"];
|
||||
if (empty($ws_thirdparty))
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserMissingAssociatedSoc"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create SOAP client and connect it to product/service
|
||||
$soapclient_product = new nusoap_client($ws_url."/webservices/server_productorservice.php");
|
||||
$soapclient_product->soap_defencoding='UTF-8';
|
||||
$soapclient_product->decodeUTF8(false);
|
||||
|
||||
// Iterate each line and get the reference that uses the supplier of that product/service
|
||||
$i = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$i = $i + 1;
|
||||
$ref_supplier = $line->ref_supplier;
|
||||
$line_id = $i."º) ".$line->product_ref.": ";
|
||||
if (empty($ref_supplier)) {
|
||||
continue;
|
||||
}
|
||||
$ws_parameters = array('authentication' => $ws_authentication, 'id' => '', 'ref' => $ref_supplier);
|
||||
$result_product = $soapclient_product->call("getProductOrService", $ws_parameters, $ws_ns, '');
|
||||
if (!$result_product)
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("SOAPError")." ".$soapclient_product->error_str." - ".$soapclient_product->response, null, 'errors');
|
||||
$error_occurred = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check the result code
|
||||
$status_code = $result_product["result"]["result_code"];
|
||||
if (empty($status_code)) //No result, check error str
|
||||
{
|
||||
setEventMessages($langs->trans("SOAPError")." '".$soapclient_order->error_str."'", null, 'errors');
|
||||
}
|
||||
else if ($status_code != "OK") //Something went wrong
|
||||
{
|
||||
if ($status_code == "NOT_FOUND")
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("SupplierMissingRef")." '".$ref_supplier."'", null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("ResponseNonOK")." '".$status_code."' - '".$result_product["result"]["result_label"]."'", null, 'errors');
|
||||
$error_occurred = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ensure that price is equal and warn user if it's not
|
||||
$supplier_price = price($result_product["product"]["price_net"]); //Price of client tab in supplier dolibarr
|
||||
$local_price = NULL; //Price of supplier as stated in product suppliers tab on this dolibarr, NULL if not found
|
||||
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($line->fk_product);
|
||||
if (count($product_fourn_list)>0)
|
||||
{
|
||||
foreach($product_fourn_list as $product_fourn_line)
|
||||
{
|
||||
//Only accept the line where the supplier is the same at this order and has the same ref
|
||||
if ($product_fourn_line->fourn_id == $object->socid && $product_fourn_line->fourn_ref == $ref_supplier) {
|
||||
$local_price = price($product_fourn_line->fourn_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($local_price != NULL && $local_price != $supplier_price) {
|
||||
setEventMessages($line_id.$langs->trans("RemotePriceMismatch")." ".$supplier_price." - ".$local_price, null, 'warnings');
|
||||
}
|
||||
|
||||
// Check if is in sale
|
||||
if (empty($result_product["product"]["status_tosell"])) {
|
||||
setEventMessages($line_id.$langs->trans("ProductStatusNotOnSellShort")." '".$ref_supplier."'", null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($user_status_code == "PERMISSION_DENIED")
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserNotPermission"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
elseif ($user_status_code == "BAD_CREDENTIALS")
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserBadCredentials"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ResponseNonOK")." '".$user_status_code."'", null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
|
||||
//Form
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="webservice">';
|
||||
print '<input type="hidden" name="mode" value="send">';
|
||||
print '<input type="hidden" name="ws_user" value="'.$ws_user.'">';
|
||||
print '<input type="hidden" name="ws_password" value="'.$ws_password.'">';
|
||||
print '<input type="hidden" name="ws_entity" value="'.$ws_entity.'">';
|
||||
print '<input type="hidden" name="ws_thirdparty" value="'.$ws_thirdparty.'">';
|
||||
if ($error_occurred)
|
||||
{
|
||||
print "<br>".$langs->trans("ErrorOccurredReviseAndRetry")."<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="button" type="submit" id="ws_submit" name="ws_submit" value="'.$langs->trans("Confirm").'">';
|
||||
print ' ';
|
||||
}
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Show buttons
|
||||
*/
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Boutons actions
|
||||
*/
|
||||
@ -2700,7 +2366,7 @@ elseif (! empty($object->id))
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($user->rights->fournisseur->commande->commander && $object->statut == 2 && $action == 'makeorder')
|
||||
@ -2756,51 +2422,271 @@ elseif (! empty($object->id))
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
|
||||
{
|
||||
// Set status to received (action=livraison)
|
||||
print '<!-- form to record supplier order received -->'."\n";
|
||||
print '<form action="card.php?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="livraison">';
|
||||
print load_fiche_titre($langs->trans("Receive"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||
print $form->select_date('','',1,1,'',"commande",1,1,1);
|
||||
print "</td></tr>\n";
|
||||
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
|
||||
{
|
||||
// Set status to received (action=livraison)
|
||||
print '<!-- form to record supplier order received -->'."\n";
|
||||
print '<form action="card.php?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="livraison">';
|
||||
print load_fiche_titre($langs->trans("Receive"),'','');
|
||||
|
||||
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
|
||||
$liv = array();
|
||||
$liv[''] = ' ';
|
||||
$liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected");
|
||||
$liv['par'] = $langs->trans("PartialWoman");
|
||||
$liv['nev'] = $langs->trans("NeverReceived");
|
||||
$liv['can'] = $langs->trans("Canceled");
|
||||
print '<table class="noborder" width="100%">';
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||
print $form->select_date('','',1,1,'',"commande",1,1,1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print $form->selectarray("type",$liv);
|
||||
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
|
||||
$liv = array();
|
||||
$liv[''] = ' ';
|
||||
$liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected");
|
||||
$liv['par'] = $langs->trans("PartialWoman");
|
||||
$liv['nev'] = $langs->trans("NeverReceived");
|
||||
$liv['can'] = $langs->trans("Canceled");
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment"></td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Receive").'"></td></tr>';
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
print "<br>";
|
||||
print $form->selectarray("type",$liv);
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment"></td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Receive").'"></td></tr>';
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object,'order_supplier',$socid,1,'listaction'.($genallowed?'largetitle':''));
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object,'order_supplier',$socid,1,'listaction'.($genallowed?'largetitle':''));
|
||||
/*
|
||||
* Action webservice
|
||||
*/
|
||||
if ($action == 'webservice' && GETPOST('mode', 'alpha') != "send" && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
$ws_url = $object->thirdparty->webservices_url;
|
||||
$ws_key = $object->thirdparty->webservices_key;
|
||||
$ws_user = GETPOST('ws_user','alpha');
|
||||
$ws_password = GETPOST('ws_password','alpha');
|
||||
|
||||
// NS and Authentication parameters
|
||||
$ws_ns = 'http://www.dolibarr.org/ns/';
|
||||
$ws_authentication = array(
|
||||
'dolibarrkey'=>$ws_key,
|
||||
'sourceapplication'=>'DolibarrWebServiceClient',
|
||||
'login'=>$ws_user,
|
||||
'password'=>$ws_password,
|
||||
'entity'=>''
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans('CreateRemoteOrder'),'');
|
||||
|
||||
//Is everything filled?
|
||||
if (empty($ws_url) || empty($ws_key)) {
|
||||
setEventMessages($langs->trans("ErrorWebServicesFieldsRequired"), null, 'errors');
|
||||
$mode = "init";
|
||||
$error_occurred = true; //Don't allow to set the user/pass if thirdparty fields are not filled
|
||||
} else if ($mode != "init" && (empty($ws_user) || empty($ws_password))) {
|
||||
setEventMessages($langs->trans("ErrorFieldsRequired"), null, 'errors');
|
||||
$mode = "init";
|
||||
}
|
||||
|
||||
if ($mode == "init")
|
||||
{
|
||||
//Table/form header
|
||||
print '<table class="border" width="100%">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="webservice">';
|
||||
print '<input type="hidden" name="mode" value="check">';
|
||||
|
||||
if ($error_occurred)
|
||||
{
|
||||
print "<br>".$langs->trans("ErrorOccurredReviseAndRetry")."<br>";
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$textinput_size = "50";
|
||||
// Webservice url
|
||||
print '<tr><td>'.$langs->trans("WebServiceURL").'</td><td colspan="3">'.dol_print_url($ws_url).'</td></tr>';
|
||||
//Remote User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td><input size="'.$textinput_size.'" type="text" name="ws_user"></td></tr>';
|
||||
//Remote Password
|
||||
print '<tr><td>'.$langs->trans("Password").'</td><td><input size="'.$textinput_size.'" type="text" name="ws_password"></td></tr>';
|
||||
//Submit button
|
||||
print '<tr><td align="center" colspan="2">';
|
||||
print '<input class="button" type="submit" id="ws_submit" name="ws_submit" value="'.$langs->trans("CreateRemoteOrder").'">';
|
||||
print ' ';
|
||||
//Cancel button
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
//End table/form
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
}
|
||||
elseif ($mode == "check")
|
||||
{
|
||||
$ws_entity = '';
|
||||
$ws_thirdparty = '';
|
||||
$error_occurred = false;
|
||||
|
||||
//Create SOAP client and connect it to user
|
||||
$soapclient_user = new nusoap_client($ws_url."/webservices/server_user.php");
|
||||
$soapclient_user->soap_defencoding='UTF-8';
|
||||
$soapclient_user->decodeUTF8(false);
|
||||
|
||||
//Get the thirdparty associated to user
|
||||
$ws_parameters = array('authentication'=>$ws_authentication, 'id' => '', 'ref'=>$ws_user);
|
||||
$result_user = $soapclient_user->call("getUser", $ws_parameters, $ws_ns, '');
|
||||
$user_status_code = $result_user["result"]["result_code"];
|
||||
|
||||
if ($user_status_code == "OK")
|
||||
{
|
||||
//Fill the variables
|
||||
$ws_entity = $result_user["user"]["entity"];
|
||||
$ws_authentication['entity'] = $ws_entity;
|
||||
$ws_thirdparty = $result_user["user"]["fk_thirdparty"];
|
||||
if (empty($ws_thirdparty))
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserMissingAssociatedSoc"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Create SOAP client and connect it to product/service
|
||||
$soapclient_product = new nusoap_client($ws_url."/webservices/server_productorservice.php");
|
||||
$soapclient_product->soap_defencoding='UTF-8';
|
||||
$soapclient_product->decodeUTF8(false);
|
||||
|
||||
// Iterate each line and get the reference that uses the supplier of that product/service
|
||||
$i = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$i = $i + 1;
|
||||
$ref_supplier = $line->ref_supplier;
|
||||
$line_id = $i."º) ".$line->product_ref.": ";
|
||||
if (empty($ref_supplier)) {
|
||||
continue;
|
||||
}
|
||||
$ws_parameters = array('authentication' => $ws_authentication, 'id' => '', 'ref' => $ref_supplier);
|
||||
$result_product = $soapclient_product->call("getProductOrService", $ws_parameters, $ws_ns, '');
|
||||
if (!$result_product)
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("SOAPError")." ".$soapclient_product->error_str." - ".$soapclient_product->response, null, 'errors');
|
||||
$error_occurred = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check the result code
|
||||
$status_code = $result_product["result"]["result_code"];
|
||||
if (empty($status_code)) //No result, check error str
|
||||
{
|
||||
setEventMessages($langs->trans("SOAPError")." '".$soapclient_order->error_str."'", null, 'errors');
|
||||
}
|
||||
else if ($status_code != "OK") //Something went wrong
|
||||
{
|
||||
if ($status_code == "NOT_FOUND")
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("SupplierMissingRef")." '".$ref_supplier."'", null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($line_id.$langs->trans("ResponseNonOK")." '".$status_code."' - '".$result_product["result"]["result_label"]."'", null, 'errors');
|
||||
$error_occurred = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Ensure that price is equal and warn user if it's not
|
||||
$supplier_price = price($result_product["product"]["price_net"]); //Price of client tab in supplier dolibarr
|
||||
$local_price = NULL; //Price of supplier as stated in product suppliers tab on this dolibarr, NULL if not found
|
||||
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
$product_fourn_list = $product_fourn->list_product_fournisseur_price($line->fk_product);
|
||||
if (count($product_fourn_list)>0)
|
||||
{
|
||||
foreach($product_fourn_list as $product_fourn_line)
|
||||
{
|
||||
//Only accept the line where the supplier is the same at this order and has the same ref
|
||||
if ($product_fourn_line->fourn_id == $object->socid && $product_fourn_line->fourn_ref == $ref_supplier) {
|
||||
$local_price = price($product_fourn_line->fourn_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div></div></div>';}
|
||||
if ($local_price != NULL && $local_price != $supplier_price) {
|
||||
setEventMessages($line_id.$langs->trans("RemotePriceMismatch")." ".$supplier_price." - ".$local_price, null, 'warnings');
|
||||
}
|
||||
|
||||
// Check if is in sale
|
||||
if (empty($result_product["product"]["status_tosell"])) {
|
||||
setEventMessages($line_id.$langs->trans("ProductStatusNotOnSellShort")." '".$ref_supplier."'", null, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($user_status_code == "PERMISSION_DENIED")
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserNotPermission"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
elseif ($user_status_code == "BAD_CREDENTIALS")
|
||||
{
|
||||
setEventMessages($langs->trans("RemoteUserBadCredentials"), null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ResponseNonOK")." '".$user_status_code."'", null, 'errors');
|
||||
$error_occurred = true;
|
||||
}
|
||||
|
||||
//Form
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="webservice">';
|
||||
print '<input type="hidden" name="mode" value="send">';
|
||||
print '<input type="hidden" name="ws_user" value="'.$ws_user.'">';
|
||||
print '<input type="hidden" name="ws_password" value="'.$ws_password.'">';
|
||||
print '<input type="hidden" name="ws_entity" value="'.$ws_entity.'">';
|
||||
print '<input type="hidden" name="ws_thirdparty" value="'.$ws_thirdparty.'">';
|
||||
if ($error_occurred)
|
||||
{
|
||||
print "<br>".$langs->trans("ErrorOccurredReviseAndRetry")."<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input class="button" type="submit" id="ws_submit" name="ws_submit" value="'.$langs->trans("Confirm").'">';
|
||||
print ' ';
|
||||
}
|
||||
print '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='supplier_order_send';
|
||||
$defaulttopic='SendOrderRef';
|
||||
$diroutput = $conf->fournisseur->commande->dir_output;
|
||||
$trackid = 'sor'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -48,7 +48,7 @@ $langs->load('compta');
|
||||
$langs->load('bills');
|
||||
$langs->load('projects');
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
@ -86,10 +86,6 @@ $optioncss = GETPOST('optioncss','alpha');
|
||||
$billed = GETPOST('billed','int');
|
||||
$search_project_ref=GETPOST('search_project_ref','alpha');
|
||||
|
||||
$page = GETPOST('page','int');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
|
||||
$status=GETPOST('statut','alpha');
|
||||
$billed=GETPOST('billed','int');
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
@ -114,11 +110,11 @@ if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
if ($search_status == '') $search_status=-1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='supplierorderlist';
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
@ -173,7 +169,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -207,6 +203,7 @@ if (empty($reshook))
|
||||
$search_total_ht='';
|
||||
$search_total_vat='';
|
||||
$search_total_ttc='';
|
||||
$search_project_ref='';
|
||||
$search_status=-1;
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
@ -216,16 +213,12 @@ if (empty($reshook))
|
||||
$deliveryyear='';
|
||||
$billed='';
|
||||
$toselect='';
|
||||
$search_project_ref='';
|
||||
$search_array_options=array();
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Commande';
|
||||
$objectlabel='Orders';
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|
||||
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
|
||||
{
|
||||
$massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -581,7 +574,6 @@ if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_h
|
||||
if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
|
||||
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
@ -650,6 +642,7 @@ if ($resql)
|
||||
if ($search_total_ttc != '') $param.="&search_total_ttc=".$search_total_ttc;
|
||||
if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp;
|
||||
if ($search_status >= 0) $param.="&search_status=".$search_status;
|
||||
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
|
||||
if ($billed != '') $param.="&billed=".$billed;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
@ -663,7 +656,7 @@ if ($resql)
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
@ -678,108 +671,24 @@ if ($resql)
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
// TODO Move this into an invluce
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_supplier_send";
|
||||
$objecttmp=new CommandeFournisseur($db);
|
||||
$trackid='sord'.$object->id;
|
||||
|
||||
if (! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objecttmp=new CommandeFournisseur($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendOrderRef";
|
||||
$modelmail="order_send";
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$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->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
elseif ($massaction == 'createbills')
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
|
||||
@ -114,7 +114,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action='';
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@ -1211,14 +1219,13 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='BILL_SUPPLIER_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfromsupplierinvoice';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
|
||||
$trackid='sin'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -2823,124 +2830,18 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Show mail form
|
||||
*/
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref, preg_quote($ref,'/').'([^\-])+');
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
// Presend form
|
||||
$modelmail='supplier_order_send';
|
||||
$defaulttopic='SendBillRef';
|
||||
$diroutput = $conf->fournisseur->facture->dir_output;
|
||||
$trackid = 'sin'.$object->id;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('bills');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file))
|
||||
{
|
||||
$result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$object->error,$object->errors);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref, preg_quote($ref,'/').'([^\-])+');
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendBillByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='sin'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
$formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste;
|
||||
$formmail->withtocc=$liste;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$outputlangs->trans('SendBillRef','__REF__');
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit['__SUPPLIERINVREF__']=$object->ref;
|
||||
|
||||
//Find the good contact adress
|
||||
$custcontact='';
|
||||
$contactarr=array();
|
||||
$contactarr=$object->liste_contact(-1,'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr)>0) {
|
||||
foreach($contactarr as $contact) {
|
||||
if ($contact['libelle']==$langs->trans('TypeContact_invoice_supplier_external_BILLING')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactstatic=new Contact($db);
|
||||
$contactstatic->fetch($contact['id']);
|
||||
$custcontact=$contactstatic->getFullName($langs,1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action']='send';
|
||||
$formmail->param['models']='invoice_supplier_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['facid']=$object->id;
|
||||
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode")=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,basename($file),dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,9 +93,12 @@ $day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$filter = GETPOST('filtre','alpha');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
if ($option == 'late') {
|
||||
$filter = 'paye:0';
|
||||
}
|
||||
|
||||
$search_all = GETPOST('sall', 'alphanohtml');
|
||||
$search_label = GETPOST("search_label","alpha");
|
||||
@ -116,8 +119,8 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.datef,f.rowid";
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='supplierinvoicelist';
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierinvoicelist';
|
||||
|
||||
$diroutputmassaction=$conf->fournisseur->facture->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
@ -472,7 +475,7 @@ if ($resql)
|
||||
);
|
||||
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$i = 0;
|
||||
@ -491,102 +494,15 @@ if ($resql)
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="supplier_invoice_send";
|
||||
$objecttmp=new FactureFournisseur($db);
|
||||
$trackid='sinv'.$object->id;
|
||||
|
||||
if (! GETPOST('cancel','alpha'))
|
||||
{
|
||||
$objecttmp=new FactureFournisseur($db);
|
||||
$listofselectedid=array();
|
||||
$listofselectedthirdparties=array();
|
||||
$listofselectedref=array();
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendBillRef";
|
||||
$modelmail="supplier_invoice_send";
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->withform=-1;
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='sinv'.$object->id;
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sinv'.$object->id);
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=$langs->trans("AllRecipientSelected");
|
||||
if (count($listofselectedthirdparties) == 1)
|
||||
{
|
||||
$liste=array();
|
||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
||||
$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->withtocc=1;
|
||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param['action']=$action;
|
||||
$formmail->param['models']=$modelmail;
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['id']=join(',',$arrayofselected);
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||
}
|
||||
elseif ($massaction == 'createbills')
|
||||
|
||||
if ($massaction == 'createbills')
|
||||
{
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
|
||||
@ -823,7 +823,7 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
//print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br /><br />';
|
||||
//print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
@ -1281,14 +1281,14 @@ else
|
||||
} else {
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('ErrorUserViewCP');
|
||||
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
} else {
|
||||
print '<div class="tabBar">';
|
||||
print $langs->trans('ErrorIDFicheCP');
|
||||
print '<br /><br /><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '<br><br><input type="button" value="'.$langs->trans("ReturnCP").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ else
|
||||
print $langs->trans("InstallEasy")." ";
|
||||
print $langs->trans("ChooseYourSetupMode");
|
||||
|
||||
print '<br /><br />';
|
||||
print '<br><br>';
|
||||
|
||||
$foundrecommandedchoice=0;
|
||||
|
||||
@ -534,13 +534,13 @@ else
|
||||
|
||||
if (count($notavailable_choices)) {
|
||||
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
print '<div id="AShowChoices">';
|
||||
print '<img src="../theme/eldy/img/1downarrow.png"> <a href="#">'.$langs->trans('ShowNotAvailableOptions').'</a>';
|
||||
print '</div>';
|
||||
|
||||
print '<div id="navail_choices" style="display:none">';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
print '<table width="100%" class="listofchoices">';
|
||||
foreach ($notavailable_choices as $choice) {
|
||||
print $choice;
|
||||
|
||||
@ -50,8 +50,12 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_PAYED','Customer invoice payed','Executed when a customer invoice is payed','facture',7);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_CANCEL','Customer invoice canceled','Executed when a customer invoice is conceled','facture',8);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SENTBYMAIL','Customer invoice sent by mail','Executed when a customer invoice is sent by mail','facture',9);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',9);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10);
|
||||
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_CREATE','Supplier order created','Executed when a supplier order is created','order_supplier',11);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_VALIDATE','Supplier order validated','Executed when a supplier order is validated','order_supplier',12);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',13);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ORDER_SUPPLIER_SUBMIT','Supplier order request submited','Executed when a supplier order is approved','order_supplier',13);
|
||||
@ -65,6 +69,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_SENTBYMAIL','Supplier invoice sent by mail','Executed when a supplier invoice is sent by mail','invoice_supplier',17);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_SUPPLIER_CANCELED','Supplier invoice cancelled','Executed when a supplier invoice is cancelled','invoice_supplier',17);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_VALIDATE','Contract validated','Executed when a contract is validated','contrat',18);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_VALIDATE','Shipping validated','Executed when a shipping is validated','shipping',20);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('SHIPPING_SENTBYMAIL','Shipping sent by mail','Executed when a shipping is sent by mail','shipping',21);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_VALIDATE','Member validated','Executed when a member is validated','member',22);
|
||||
|
||||
@ -41,6 +41,12 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer;
|
||||
|
||||
-- For 7.0
|
||||
|
||||
ALTER TABLE llx_c_paiement ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
ALTER TABLE llx_c_payment_term ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_product MODIFY COLUMN seuil_stock_alerte integer DEFAULT NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_product ALTER COLUMN seuil_stock_alerte SET DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_facture_rec ADD COLUMN suspended integer DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_facture_rec MODIFY COLUMN titre VARCHAR(100);
|
||||
@ -242,6 +248,8 @@ ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
|
||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
||||
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
|
||||
|
||||
ALTER TABLE llx_actioncomm MODIFY COLUMN label varchar(255) NOT NULL;
|
||||
|
||||
ALTER TABLE llx_payment_various ADD COLUMN fk_projet integer DEFAULT NULL after accountancy_code;
|
||||
|
||||
UPDATE llx_const set name = 'ONLINE_PAYMENT_MESSAGE_OK' where name = 'PAYPAL_MESSAGE_OK';
|
||||
@ -256,6 +264,15 @@ UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'CHARGE'
|
||||
UPDATE llx_accounting_account SET pcg_type = 'INCOME' where pcg_type = 'VENTAS_E_INGRESOS';
|
||||
UPDATE llx_accounting_account SET pcg_type = 'EXPENSE' where pcg_type = 'COMPRAS_GASTOS';
|
||||
|
||||
ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(24) NOT NULL;
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_SENTBYMAIL','Contract sent by mail','Executed when a contract is sent by mail','contrat',18);
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_VALIDATE','Price request validated','Executed when a commercial proposal is validated','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_SENTBYMAIL','Price request sent by mail','Executed when a commercial proposal is sent by mail','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_SIGNED','Price request closed signed','Executed when a customer proposal is closed signed','proposal_supplier',10);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPOSAL_SUPPLIER_CLOSE_REFUSED','Price request closed refused','Executed when a customer proposal is closed refused','proposal_supplier',10);
|
||||
|
||||
|
||||
CREATE TABLE llx_projet_task_comment (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
@ -268,6 +285,19 @@ CREATE TABLE llx_projet_task_comment (
|
||||
import_key varchar(125) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
-- Accountancy - Remove old constants
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_SELL_JOURNAL')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_PURCHASE_JOURNAL')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_SOCIAL_JOURNAL')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_MISCELLANEOUS_JOURNAL')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_GROUPBYACCOUNT')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPORT_GLOBAL_ACCOUNT')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPORT_LABEL')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPORT_AMOUNT')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPORT_DEVISE')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPORT_PIECE')__;
|
||||
DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_EXPENSEREPORT_JOURNAL')__;
|
||||
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) CHARACTER SET utf8;
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY account_number VARCHAR(20) COLLATE utf8_unicode_ci;
|
||||
-- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_bookkeeping MODIFY numero_compte VARCHAR(20) CHARACTER SET utf8;
|
||||
|
||||
@ -52,17 +52,17 @@ create table llx_actioncomm
|
||||
location varchar(128),
|
||||
durationp real, -- planed duration
|
||||
|
||||
label varchar(256) NOT NULL, -- label/title of event or topic of email
|
||||
label varchar(255) NOT NULL, -- label/title of event or topic of email
|
||||
note text, -- note of event or content of email
|
||||
|
||||
email_subject varchar(256), -- when event was an email, we store here the subject. content is stored into note.
|
||||
email_msgid varchar(256), -- when event was an email, we store here the msgid
|
||||
email_from varchar(256), -- when event was an email, we store here the from
|
||||
email_sender varchar(256), -- when event was an email, we store here the sender
|
||||
email_to varchar(256), -- when event was an email, we store here the email_to
|
||||
email_tocc varchar(256), -- when event was an email, we store here the email_tocc
|
||||
email_tobcc varchar(256), -- when event was an email, we store here the email_tobcc
|
||||
errors_to varchar(256), -- when event was an email, we store here the erros_to
|
||||
email_subject varchar(255), -- when event was an email, we store here the subject. content is stored into note.
|
||||
email_msgid varchar(255), -- when event was an email, we store here the msgid
|
||||
email_from varchar(255), -- when event was an email, we store here the from
|
||||
email_sender varchar(255), -- when event was an email, we store here the sender
|
||||
email_to varchar(255), -- when event was an email, we store here the email_to
|
||||
email_tocc varchar(255), -- when event was an email, we store here the email_tocc
|
||||
email_tobcc varchar(255), -- when event was an email, we store here the email_tobcc
|
||||
errors_to varchar(255), -- when event was an email, we store here the erros_to
|
||||
|
||||
recurid varchar(128), -- used to store event id to link each other all the repeating event record
|
||||
recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO'
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
create table llx_c_action_trigger
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
elementtype varchar(16) NOT NULL,
|
||||
elementtype varchar(24) NOT NULL,
|
||||
code varchar(32) NOT NULL,
|
||||
label varchar(128) NOT NULL,
|
||||
description varchar(255),
|
||||
|
||||
@ -26,7 +26,8 @@ create table llx_c_paiement
|
||||
type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
|
||||
active tinyint DEFAULT 1 NOT NULL,
|
||||
accountancy_code varchar(32) NULL,
|
||||
module varchar(32) NULL
|
||||
module varchar(32) NULL,
|
||||
position integer NOT NULL DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
|
||||
@ -28,5 +28,6 @@ create table llx_c_payment_term
|
||||
type_cdr tinyint, -- Type of change date reckoning. 1=Payment at end of current month, 2=the Nth of next month
|
||||
nbjour smallint,
|
||||
decalage smallint,
|
||||
module varchar(32) NULL
|
||||
module varchar(32) NULL,
|
||||
position integer NOT NULL DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -60,7 +60,7 @@ create table llx_product
|
||||
tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch management (eat-by or lot management)
|
||||
fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module)
|
||||
duration varchar(6),
|
||||
seuil_stock_alerte integer DEFAULT 0,
|
||||
seuil_stock_alerte integer DEFAULT NULL,
|
||||
url varchar(255),
|
||||
barcode varchar(255) DEFAULT NULL, -- barcode
|
||||
fk_barcode_type integer DEFAULT NULL, -- barcode type
|
||||
|
||||
@ -66,7 +66,7 @@ AccountancyAreaDescAnalyze=STEP %s: Add or edit existing transactions and genera
|
||||
|
||||
AccountancyAreaDescClosePeriod=STEP %s: Close period so we can't make modification in a future.
|
||||
|
||||
TheJournalCodeIsNotDefinedOnSomeBankAccount=A mandatory step in setup was not complete (accountancy code journal not defined for all bank accounts)
|
||||
TheJournalCodeIsNotDefinedOnSomeBankAccount=A mandatory step in setup was not complete (accounting code journal not defined for all bank accounts)
|
||||
MenuAccountancy=Accountancy
|
||||
Selectchartofaccounts=Select active chart of accounts
|
||||
ChangeAndLoad=Change and load
|
||||
@ -170,7 +170,7 @@ DelBookKeeping=Delete record of the Ledger
|
||||
FinanceJournal=Finance journal
|
||||
ExpenseReportsJournal=Expense reports journal
|
||||
DescFinanceJournal=Finance journal including all the types of payments by bank account
|
||||
DescJournalOnlyBindedVisible=This is a view of record that are bound to accountancy account and can be recorded into the Ledger.
|
||||
DescJournalOnlyBindedVisible=This is a view of record that are bound to accounting account and can be recorded into the Ledger.
|
||||
VATAccountNotDefined=Account for VAT not defined
|
||||
ThirdpartyAccountNotDefined=Account for third party not defined
|
||||
ProductAccountNotDefined=Account for product not defined
|
||||
@ -256,14 +256,14 @@ ChartofaccountsId=Chart of accounts Id
|
||||
|
||||
## Tools - Init accounting account on product / service
|
||||
InitAccountancy=Init accountancy
|
||||
InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accountancy account defined for sales and purchases.
|
||||
InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accounting account defined for sales and purchases.
|
||||
DefaultBindingDesc=This page can be used to set a default account to use to link transactions record about payment salaries, donation, taxes and vat when no specific accounting account were already set.
|
||||
Options=Options
|
||||
OptionModeProductSell=Mode sales
|
||||
OptionModeProductBuy=Mode purchases
|
||||
OptionModeProductSellDesc=Show all products with accounting account for sales.
|
||||
OptionModeProductBuyDesc=Show all products with accounting account for purchases.
|
||||
CleanFixHistory=Remove accountancy code from lines that not exists into charts of account
|
||||
CleanFixHistory=Remove accounting code from lines that not exists into charts of account
|
||||
CleanHistory=Reset all bindings for selected year
|
||||
PredefinedGroups=Predefined groups
|
||||
WithoutValidAccount=Without valid dedicated account
|
||||
|
||||
@ -132,7 +132,7 @@ MaxNbOfLinesForBoxes=Max number of lines for widgets
|
||||
PositionByDefault=Default order
|
||||
Position=Position
|
||||
MenusDesc=Menu managers set content of the two menu bars (horizontal and vertical).
|
||||
MenusEditorDesc=The menu editor allows you to define custom menu entries. Use it carefully to avoid instability and permanently unreachable menu entries.<br />Some modules add menu entries (in menu <b>All</b> mostly). If you remove some of these entries by mistake, you can restore them disabling and reenabling the module.
|
||||
MenusEditorDesc=The menu editor allows you to define custom menu entries. Use it carefully to avoid instability and permanently unreachable menu entries.<br>Some modules add menu entries (in menu <b>All</b> mostly). If you remove some of these entries by mistake, you can restore them disabling and reenabling the module.
|
||||
MenuForUsers=Menu for users
|
||||
LangFile=.lang file
|
||||
System=System
|
||||
@ -313,7 +313,7 @@ SetupIsReadyForUse=Module deployment is finished. You must however enable and se
|
||||
NotExistsDirect=The alternative root directory is not defined to an existing directory.<br>
|
||||
InfDirAlt=Since version 3, it is possible to define an alternative root directory. This allows you to store, into a dedicated directory, plug-ins and custom templates.<br>Just create a directory at the root of Dolibarr (eg: custom).<br>
|
||||
InfDirExample=<br>Then declare it in the file <strong>conf.php</strong><br> $dolibarr_main_url_root_alt='/custom'<br>$dolibarr_main_document_root_alt='/path/of/dolibarr/htdocs/custom'<br>If these lines are commented with "#", to enable them, just uncomment by removing the "#" character.
|
||||
YouCanSubmitFile=For this step, you can submit your package file here :
|
||||
YouCanSubmitFile=For this step, you can submit the .zip file of module package here :
|
||||
CurrentVersion=Dolibarr current version
|
||||
CallUpdatePage=Go to the page that updates the database structure and data: %s.
|
||||
LastStableVersion=Latest stable version
|
||||
@ -441,9 +441,9 @@ DisplayCompanyInfo=Display company address
|
||||
DisplayCompanyManagers=Display manager names
|
||||
DisplayCompanyInfoAndManagers=Display company address and manager names
|
||||
EnableAndSetupModuleCron=If you want to have this recurring invoice beeing generated automatically, module *%s* must be enabled and correctly setup. Otherwise, generation of invoices must be done manually from this template with button *Create*. Note that even if you enabled automatic generation, you can still safely launch manual generation. Duplicates generation for same period are not possible.
|
||||
ModuleCompanyCodeAquarium=Return an accountancy code built by:<br>%s followed by third party supplier code for a supplier accountancy code,<br>%s followed by third party customer code for a customer accountancy code.
|
||||
ModuleCompanyCodePanicum=Return an empty accountancy code.
|
||||
ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
|
||||
ModuleCompanyCodeAquarium=Return an accounting code built by:<br>%s followed by third party supplier code for a supplier accounting code,<br>%s followed by third party customer code for a customer accounting code.
|
||||
ModuleCompanyCodePanicum=Return an empty accounting code.
|
||||
ModuleCompanyCodeDigitaria=Accounting code depends on third party code. The code is composed of the character "C" in the first position followed by the first 5 characters of the third party code.
|
||||
Use3StepsApproval=By default, Purchase Orders need to be created and approved by 2 different users (one step/user to create and one step/user to approve. Note that if user has both permission to create and approve, one step/user will be enough). You can ask with this option to introduce a third step/user approval, if amount is higher than a dedicated value (so 3 steps will be necessary: 1=validation, 2=first approval and 3=second approval if amount is enough).<br>Set this to empty if one approval (2 steps) is enough, set it to a very low value (0.1) if a second approval (3 steps) is always required.
|
||||
UseDoubleApproval=Use a 3 steps approval when amount (without tax) is higher than...
|
||||
WarningPHPMail=WARNING: Some email providers (like Yahoo) does not allow you to send an email from another server than the Yahoo server if the email address used as a sender is your Yahoo email (like myemail@yahoo.com, myemail@yahoo.fr, ...). Your current setup use the server of the application to send email, so some recipients (the one compatible with the restrictive DMARC protocol), will ask Yahoo if they can accept your email and Yahoo will respond "no" because the server is not a server owned by Yahoo, so few of your sent Emails may not be accepted.<br>If your Email provider (like Yahoo) has this restriction, you must change Email setup to choose the other method "SMTP server" and enter the SMTP server and credentials provided by your Email provider (ask your EMail provider to get SMTP credentials for your account).
|
||||
@ -1170,7 +1170,7 @@ HRMSetup=HRM module setup
|
||||
##### Company setup #####
|
||||
CompanySetup=Companies module setup
|
||||
CompanyCodeChecker=Module for third parties code generation and checking (customer or supplier)
|
||||
AccountCodeManager=Module for accountancy code generation (customer or supplier)
|
||||
AccountCodeManager=Module for accounting code generation (customer or supplier)
|
||||
NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events. Targets of notifications can be defined:
|
||||
NotificationsDescUser=* per users, one user at time.
|
||||
NotificationsDescContact=* per third parties contacts (customers or suppliers), one contact at time.
|
||||
@ -1529,7 +1529,7 @@ Buy=Buy
|
||||
Sell=Sell
|
||||
InvoiceDateUsed=Invoice date used
|
||||
YourCompanyDoesNotUseVAT=Your company has been defined to not use VAT (Home - Setup - Company/Organisation), so there is no VAT options to setup.
|
||||
AccountancyCode=Accountancy Code
|
||||
AccountancyCode=Accounting Code
|
||||
AccountancyCodeSell=Sale account. code
|
||||
AccountancyCodeBuy=Purchase account. code
|
||||
##### Agenda #####
|
||||
|
||||
@ -66,6 +66,7 @@ OrderApprovedInDolibarr=Order %s approved
|
||||
OrderRefusedInDolibarr=Order %s refused
|
||||
OrderBackToDraftInDolibarr=Order %s go back to draft status
|
||||
ProposalSentByEMail=Commercial proposal %s sent by EMail
|
||||
ContractSentByEMail=Contract %s sent by EMail
|
||||
OrderSentByEMail=Customer order %s sent by EMail
|
||||
InvoiceSentByEMail=Customer invoice %s sent by EMail
|
||||
SupplierOrderSentByEMail=Supplier order %s sent by EMail
|
||||
@ -84,6 +85,9 @@ EXPENSE_REPORT_VALIDATEInDolibarr=Expense report %s validated
|
||||
EXPENSE_REPORT_APPROVEInDolibarr=Expense report %s approved
|
||||
EXPENSE_REPORT_DELETEInDolibarr=Expense report %s deleted
|
||||
EXPENSE_REPORT_REFUSEDInDolibarr=Expense report %s refused
|
||||
PROJECT_CREATEInDolibarr=Project %s created
|
||||
PROJECT_MODIFYInDolibarr=Project %s modified
|
||||
PROJECT_DELETEInDolibarr=Project %s deleted
|
||||
##### End agenda events #####
|
||||
AgendaModelModule=Document templates for event
|
||||
DateActionStart=Start date
|
||||
|
||||
@ -331,7 +331,7 @@ ListOfNextSituationInvoices=List of next situation invoices
|
||||
FrequencyPer_d=Every %s days
|
||||
FrequencyPer_m=Every %s months
|
||||
FrequencyPer_y=Every %s years
|
||||
toolTipFrequency=Examples:<br /><b>Set 7, Day</b>: give a new invoice every 7 days<br /><b>Set 3, Month</b>: give a new invoice every 3 month
|
||||
toolTipFrequency=Examples:<br><b>Set 7, Day</b>: give a new invoice every 7 days<br><b>Set 3, Month</b>: give a new invoice every 3 month
|
||||
NextDateToExecution=Date for next invoice generation
|
||||
DateLastGeneration=Date of latest generation
|
||||
MaxPeriodNumber=Max nb of invoice generation
|
||||
|
||||
@ -106,8 +106,8 @@ SocialContributionsPayments=Social/fiscal taxes payments
|
||||
ShowVatPayment=Show VAT payment
|
||||
TotalToPay=Total to pay
|
||||
BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account
|
||||
CustomerAccountancyCode=Customer accountancy code
|
||||
SupplierAccountancyCode=Supplier accountancy code
|
||||
CustomerAccountancyCode=Customer accounting code
|
||||
SupplierAccountancyCode=Supplier accounting code
|
||||
CustomerAccountancyCodeShort=Cust. account. code
|
||||
SupplierAccountancyCodeShort=Sup. account. code
|
||||
AccountNumber=Account number
|
||||
@ -210,7 +210,7 @@ CalculationRuleDesc=To calculate total VAT, there is two methods:<br>Method 1 is
|
||||
CalculationRuleDescSupplier=According to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier.
|
||||
TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a <b>cash accountancy</b> mode is not relevant. This report is only available when using <b>engagement accountancy</b> mode (see setup of accountancy module).
|
||||
CalculationMode=Calculation mode
|
||||
AccountancyJournal=Accountancy code journal
|
||||
AccountancyJournal=Accounting code journal
|
||||
ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for collecting VAT - VAT on sales (used if not defined on VAT dictionary setup)
|
||||
ACCOUNTING_VAT_BUY_ACCOUNT=Accounting account by default for recovered VAT - VAT on purchases (used if not defined on VAT dictionary setup)
|
||||
ACCOUNTING_VAT_PAY_ACCOUNT=Accounting account by default for paying VAT
|
||||
|
||||
@ -220,4 +220,5 @@ WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice
|
||||
WarningTooManyDataPleaseUseMoreFilters=Too many data (more than %s lines). Please use more filters or set the constant %s to a higher limit.
|
||||
WarningSomeLinesWithNullHourlyRate=Some times were recorded by some users while their hourly rate was not defined. A value of 0 %s per hour was used but this may result in wrong valuation of time spent.
|
||||
WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security purpose you will have to login with your new login before next action.
|
||||
WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
|
||||
WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language
|
||||
WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to <b>%s</b> when using the bulk actions on lists
|
||||
@ -49,6 +49,7 @@ NbOfUniqueEMails=Nb of unique emails
|
||||
NbOfEMails=Nb of EMails
|
||||
TotalNbOfDistinctRecipients=Number of distinct recipients
|
||||
NoTargetYet=No recipients defined yet (Go on tab 'Recipients')
|
||||
NoRecipientEmail=No recipient email for %s
|
||||
RemoveRecipient=Remove recipient
|
||||
YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/core/modules/mailings/README.
|
||||
EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values
|
||||
@ -68,8 +69,8 @@ ActivateCheckReadKey=Key used to encrypt URL used for "Read Receipt" and "Unsubc
|
||||
EMailSentToNRecipients=EMail sent to %s recipients.
|
||||
EMailSentForNElements=EMail sent for %s elements.
|
||||
XTargetsAdded=<b>%s</b> recipients added into target list
|
||||
OnlyPDFattachmentSupported=If the PDF document was already generated for the object to send, it will be attached to email. If not, no email will be sent (also, note that only pdf documents are supported as attachment in mass sending in this version).
|
||||
AllRecipientSelected=All thirdparties selected and if an email is set.
|
||||
OnlyPDFattachmentSupported=If the PDF documents were already generated for the objects to send, they will be attached to email. If not, no email will be sent (also, note that only pdf documents are supported as attachment in mass sending in this version).
|
||||
AllRecipientSelected=The %s unique recipients selected (1 email per recipient), and if an email is set.
|
||||
ResultOfMailSending=Result of mass EMail sending
|
||||
NbSelected=Nb selected
|
||||
NbIgnored=Nb ignored
|
||||
|
||||
@ -540,6 +540,7 @@ MonthShort10=Oct
|
||||
MonthShort11=Nov
|
||||
MonthShort12=Dec
|
||||
AttachedFiles=Attached files and documents
|
||||
JoinMainDoc=Join main document
|
||||
DateFormatYYYYMM=YYYY-MM
|
||||
DateFormatYYYYMMDD=YYYY-MM-DD
|
||||
DateFormatYYYYMMDDHHMM=YYYY-MM-DD HH:SS
|
||||
@ -746,7 +747,7 @@ SaveUploadedFileWithMask=Save file on server with name "<strong>%s</strong>" (ot
|
||||
OriginFileName=Original filename
|
||||
SetDemandReason=Set source
|
||||
SetBankAccount=Define Bank Account
|
||||
AccountCurrency=Account Currency
|
||||
AccountCurrency=Account currency
|
||||
ViewPrivateNote=View notes
|
||||
XMoreLines=%s line(s) hidden
|
||||
ShowMoreLines=Show more lines
|
||||
@ -844,7 +845,7 @@ Select2NotFound=No result found
|
||||
Select2Enter=Enter
|
||||
Select2MoreCharacter=or more character
|
||||
Select2MoreCharacters=or more characters
|
||||
Select2MoreCharactersMore=<strong>Search syntax:</strong><br /><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br /><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br />
|
||||
Select2MoreCharactersMore=<strong>Search syntax:</strong><br><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br />
|
||||
Select2LoadingMoreResults=Loading more results...
|
||||
Select2SearchInProgress=Search in progress...
|
||||
SearchIntoThirdparties=Thirdparties
|
||||
|
||||
@ -7,7 +7,7 @@ multicurrency_syncronize_error=Synchronisation error: %s
|
||||
MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Use date of document to find currency rate, instead of using latest known rate
|
||||
multicurrency_useOriginTx=When an object is created from another, keep the original rate of source object (otherwise use the latest known rate)
|
||||
CurrencyLayerAccount=CurrencyLayer API
|
||||
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br />Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
|
||||
CurrencyLayerAccount_help_to_synchronize=You sould create an account on their website to use this functionnality<br>Get your <b>API key</b><br />If you use a free account you can't change the <b>currency source</b> (USD by default)<br />But if your main currency isn't USD you can use the <b>alternate currency source</b> to force you main currency<br /><br />You are limited at 1000 synchronizations per month
|
||||
multicurrency_appId=API key
|
||||
multicurrency_appCurrencySource=Currency source
|
||||
multicurrency_alternateCurrencySource=Alternate currency source
|
||||
|
||||
@ -3,7 +3,7 @@ SecurityCode=Security code
|
||||
NumberingShort=N°
|
||||
Tools=Tools
|
||||
TMenuTools=Tools
|
||||
ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br /><br />All the tools can be reached in the left menu.
|
||||
ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br><br>All the tools can be reached in the left menu.
|
||||
Birthday=Birthday
|
||||
BirthdayDate=Birthday date
|
||||
DateToBirth=Date of birth
|
||||
@ -162,9 +162,9 @@ SizeUnitinch=inch
|
||||
SizeUnitfoot=foot
|
||||
SizeUnitpoint=point
|
||||
BugTracker=Bug tracker
|
||||
SendNewPasswordDesc=This form allows you to request a new password. It will be sent to your email address.<br />Change will become effective once you click on the confirmation link in the email.<br />Check your inbox.
|
||||
SendNewPasswordDesc=This form allows you to request a new password. It will be sent to your email address.<br>Change will become effective once you click on the confirmation link in the email.<br />Check your inbox.
|
||||
BackToLoginPage=Back to login page
|
||||
AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br />In this mode, Dolibarr can't know nor change your password.<br />Contact your system administrator if you want to change your password.
|
||||
AuthenticationDoesNotAllowSendNewPassword=Authentication mode is <b>%s</b>.<br>In this mode, Dolibarr can't know nor change your password.<br />Contact your system administrator if you want to change your password.
|
||||
EnableGDLibraryDesc=Install or enable GD library on your PHP installation to use this option.
|
||||
ProfIdShortDesc=<b>Prof Id %s</b> is an information depending on third party country.<br>For example, for country <b>%s</b>, it's code <b>%s</b>.
|
||||
DolibarrDemo=Dolibarr ERP/CRM demo
|
||||
|
||||
@ -20,8 +20,8 @@ ProductVatMassChange=Mass VAT change
|
||||
ProductVatMassChangeDesc=This page can be used to modify a VAT rate defined on products or services from a value to another. Warning, this change is done on all database.
|
||||
MassBarcodeInit=Mass barcode init
|
||||
MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete.
|
||||
ProductAccountancyBuyCode=Accountancy code (purchase)
|
||||
ProductAccountancySellCode=Accountancy code (sale)
|
||||
ProductAccountancyBuyCode=Accounting code (purchase)
|
||||
ProductAccountancySellCode=Accounting code (sale)
|
||||
ProductOrService=Product or Service
|
||||
ProductsAndServices=Products and Services
|
||||
ProductsOrServices=Products or Services
|
||||
|
||||
@ -49,7 +49,7 @@ EnhancedValue=Value
|
||||
PMPValue=Weighted average price
|
||||
PMPValueShort=WAP
|
||||
EnhancedValueOfWarehouses=Warehouses value
|
||||
UserWarehouseAutoCreate=Create a warehouse automatically when creating a user
|
||||
UserWarehouseAutoCreate=Create a user warehouse automatically when creating a user
|
||||
AllowAddLimitStockByWarehouse=Allow to add limit and desired stock per couple (product, warehouse) instead of per product
|
||||
IndependantSubProductStock=Product stock and subproduct stock are independant
|
||||
QtyDispatched=Quantity dispatched
|
||||
@ -71,7 +71,7 @@ NoPredefinedProductToDispatch=No predefined products for this object. So no disp
|
||||
DispatchVerb=Dispatch
|
||||
StockLimitShort=Limit for alert
|
||||
StockLimit=Stock limit for alert
|
||||
StockLimitDesc="" (empty) default value means no alert. <br>"0" can be used with 'Stock can be negative' configuration.
|
||||
StockLimitDesc=(empty) means no warning.<br>0 can be used for a warning as soon as stock is empty.
|
||||
PhysicalStock=Physical stock
|
||||
RealStock=Real Stock
|
||||
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.
|
||||
@ -175,7 +175,7 @@ SelectFournisseur=Supplier filter
|
||||
inventoryOnDate=Inventory
|
||||
INVENTORY_DISABLE_VIRTUAL=Allow to not destock child product from a kit on inventory
|
||||
INVENTORY_USE_MIN_PA_IF_NO_LAST_PA=Use the buy price if no last buy price can be found
|
||||
INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT=Stock mouvment have date of inventory
|
||||
INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT=Stock movement have date of inventory
|
||||
inventoryChangePMPPermission=Allow to change PMP value for a product
|
||||
ColumnNewPMP=New unit PMP
|
||||
OnlyProdsInStock=Do not add product without stock
|
||||
|
||||
@ -99,7 +99,7 @@ LoginUsingOpenID=Use OpenID to login
|
||||
WeeklyHours=Weekly hours
|
||||
ColorUser=Color of the user
|
||||
DisabledInMonoUserMode=Disabled in maintenance mode
|
||||
UserAccountancyCode=User accountancy code
|
||||
UserAccountancyCode=User accounting code
|
||||
UserLogoff=User logout
|
||||
UserLogged=User logged
|
||||
DateEmployment=Date of Employment
|
||||
@ -114,13 +114,11 @@ if (empty($reshook))
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink')
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||
$action='';
|
||||
}
|
||||
|
||||
@ -215,6 +213,15 @@ if (empty($reshook))
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MYOBJECT_SENTBYMAIL';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
|
||||
$trackid='myobject'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -510,127 +517,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='myobject';
|
||||
$defaulttopic='Information';
|
||||
$diroutput = $conf->mymodule->dir_output;
|
||||
$trackid = 'myobject'.$object->id;
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
/*
|
||||
if ($action == 'presend')
|
||||
{
|
||||
$object->fetch_projet();
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('commercial');
|
||||
}
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit();
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||
$file = $fileparams['fullname'];
|
||||
}
|
||||
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans('SendMyObjectByMail'));
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
|
||||
if($formmail->fromtype === 'user'){
|
||||
$formmail->fromid = $user->id;
|
||||
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
$liste [$key] = $value;
|
||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
if (empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendMyObjectRef', '__REF__');
|
||||
} else if (! empty($object->ref_client)) {
|
||||
$formmail->withtopic = $outputlangs->trans('SendMyObjectRef', '__REF__ (__REFCLIENT__)');
|
||||
}
|
||||
$formmail->withfile = 2;
|
||||
$formmail->withbody = 1;
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
// Tableau des substitutions
|
||||
$formmail->setSubstitFromObject($object);
|
||||
$formmail->substit ['__REF__'] = $object->ref;
|
||||
|
||||
$custcontact = '';
|
||||
$contactarr = array();
|
||||
$contactarr = $object->liste_contact(- 1, 'external');
|
||||
|
||||
if (is_array($contactarr) && count($contactarr) > 0)
|
||||
{
|
||||
foreach ($contactarr as $contact)
|
||||
{
|
||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->fetch($contact ['id']);
|
||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($custcontact)) {
|
||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
||||
}
|
||||
}
|
||||
|
||||
// Tableau des parametres complementaires
|
||||
$formmail->param['action'] = 'send';
|
||||
$formmail->param['models'] = 'myobject_send';
|
||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
||||
$formmail->param['myobjectid'] = $object->id;
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
dol_fiche_end();
|
||||
}*/
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -293,13 +293,13 @@ jQuery(document).ready(function() {
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user