Merge remote-tracking branch 'Dolibarr/11.0' into 11
This commit is contained in:
commit
6929efc417
@ -3,6 +3,7 @@
|
||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||
|
||||
# We use dist: trusty to have php 5.4+ available
|
||||
os: linux
|
||||
dist: trusty
|
||||
sudo: required
|
||||
|
||||
@ -42,7 +43,7 @@ env:
|
||||
global:
|
||||
# Set to true for very verbose output
|
||||
- DEBUG=false
|
||||
matrix:
|
||||
jobs:
|
||||
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
||||
#- DB=mysql
|
||||
- DB=mariadb
|
||||
@ -54,7 +55,7 @@ env:
|
||||
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
|
||||
#- WS=nginx
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
@ -46,6 +46,8 @@ $search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
||||
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||
@ -101,11 +103,9 @@ if (empty($reshook))
|
||||
$search_pcgsubtype = "";
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if (GETPOST('change_chart', 'alpha') && (GETPOST('valid_change_chart', 'int') || empty($conf->use_javascript_ajax)))
|
||||
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|
||||
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified
|
||||
{
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
if ($chartofaccounts > 0)
|
||||
{
|
||||
// Get language code for this $chartofaccounts
|
||||
@ -274,21 +274,13 @@ if ($resql)
|
||||
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<!-- Add javascript to update a flag when we select "Change plan" -->
|
||||
print '<!-- Add javascript to reload page when we click "Change plan" -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#searchFormList").on("submit", function (e) {
|
||||
//event.preventDefault();
|
||||
//var form = this;
|
||||
console.log("chartofaccounts focus = "+$("#chartofaccounts").is(":focus"));
|
||||
console.log("change_chart focus = "+$("#change_chart").is(":focus"));
|
||||
if ($("#change_chart").is(":focus"))
|
||||
{
|
||||
console.log("We set valid_change_chart to 1");
|
||||
$("#valid_change_chart").val(1);
|
||||
}
|
||||
//form.submit();
|
||||
return true;
|
||||
$("#change_chart").on("click", function (e) {
|
||||
console.log("chartofaccounts seleted = "+$("#chartofaccounts").val());
|
||||
// reload page
|
||||
window.location.href = "'.$_SERVER["PHP_SELF"].'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
@ -335,8 +327,7 @@ if ($resql)
|
||||
else dol_print_error($db);
|
||||
print "</select>";
|
||||
print ajax_combobox("chartofaccounts");
|
||||
print '<input type="submit" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
print '<input type="hidden" name="valid_change_chart" id="valid_change_chart" value="0">';
|
||||
print '<input type="'.(empty($conf->use_javascript_ajax)?'submit':'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
@ -760,7 +760,7 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (price2num($totaldebit) != price2num($totalcredit))
|
||||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
|
||||
@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Protection against a bug on line before
|
||||
if (price2num($totaldebit) != price2num($totalcredit))
|
||||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
|
||||
@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Protection against a bug on lines before
|
||||
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
|
||||
@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Protection against a bug on lines before
|
||||
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
|
||||
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
|
||||
{
|
||||
$error++;
|
||||
$errorforline++;
|
||||
|
||||
@ -66,7 +66,7 @@ llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp);
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup');
|
||||
|
||||
print $langs->trans("ClickToDialDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("ClickToDialDesc")."</span><br>\n";
|
||||
|
||||
print '<br>';
|
||||
print '<form method="post" action="clicktodial.php">';
|
||||
|
||||
@ -408,7 +408,7 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
|
||||
|
||||
// Name
|
||||
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
|
||||
// Addresse
|
||||
@ -477,36 +477,36 @@ if (!empty($conf->barcode->enabled)) {
|
||||
|
||||
// Logo
|
||||
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<div class="centpertent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
|
||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||
print '</div><div class="inline-block valignmiddle marginrightonly">';
|
||||
if (!empty($mysoc->logo_mini)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
|
||||
print ' ';
|
||||
print '</div><div class="inline-block valignmiddle">';
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
|
||||
}
|
||||
} else {
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Logo (squarred)
|
||||
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<div class="centpertent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
|
||||
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
|
||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||
print '</div><div class="inline-block valignmiddle marginrightonly">';
|
||||
if (!empty($mysoc->logo_squarred_mini)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
|
||||
print ' ';
|
||||
print '</div><div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">';
|
||||
}
|
||||
} else {
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
|
||||
@ -58,6 +58,13 @@ if (GETPOST('cancel', 'alpha'))
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
|
||||
$regs = array();
|
||||
if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
|
||||
if ($regs[1] == 'set') dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_del_const($db, $regs[2], $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
@ -81,15 +88,15 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
/*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
|
||||
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
@ -141,25 +148,27 @@ if ($action == 'update')
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["MAIN_DISABLE_JAVASCRIPT"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"], 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_SHOW_LOGO", GETPOST("MAIN_SHOW_LOGO", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
$reg = array();
|
||||
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
@ -247,7 +256,7 @@ print '</tr>';
|
||||
|
||||
// Multilingual GUI
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
|
||||
print ajax_constantonoff("MAIN_MULTILANGS");
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -266,7 +275,7 @@ print '</tr>';
|
||||
|
||||
// Disable javascript and ajax
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
|
||||
print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
|
||||
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT");
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -278,6 +278,7 @@ dol_htmloutput_errors($mesg);
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
print '<input type="hidden" name="token" value="'.newtoken().'">';
|
||||
|
||||
print '<div class="tagtable">';
|
||||
|
||||
|
||||
@ -666,7 +666,7 @@ if ($object->id > 0)
|
||||
$now = dol_now();
|
||||
|
||||
/*
|
||||
* Last proposals
|
||||
* Latest proposals
|
||||
*/
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
|
||||
{
|
||||
@ -738,7 +738,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last orders
|
||||
* Latest orders
|
||||
*/
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
@ -824,7 +824,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last shipments
|
||||
* Latest shipments
|
||||
*/
|
||||
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
@ -897,7 +897,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last linked contracts
|
||||
* Latest linked contracts
|
||||
*/
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
@ -967,7 +967,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last interventions
|
||||
* Latest interventions
|
||||
*/
|
||||
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||
{
|
||||
@ -1028,7 +1028,7 @@ if ($object->id > 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last invoices templates
|
||||
* Latest invoices templates
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
@ -1063,7 +1063,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -33,10 +33,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
@ -54,6 +51,8 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
@ -62,7 +61,6 @@ if ($user->socid) $socid = $user->socid;
|
||||
$objecttype = 'facture_rec';
|
||||
if ($action == "create" || $action == "add") $objecttype = '';
|
||||
$result = restrictedArea($user, 'facture', $id, $objecttype);
|
||||
$projectid = GETPOST('projectid', 'int');
|
||||
|
||||
$search_ref = GETPOST('search_ref');
|
||||
$search_societe = GETPOST('search_societe');
|
||||
@ -146,6 +144,13 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
if ($socid > 0) {
|
||||
$tmpthirdparty = new Societe($db);
|
||||
$res = $tmpthirdparty->fetch($socid);
|
||||
if ($res > 0) $search_societe = $tmpthirdparty->name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -218,6 +223,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
|
||||
$sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
|
||||
$sql .= " f.datec, f.tms,";
|
||||
@ -243,6 +249,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($socid) $sql .= ' AND s.rowid = '.(int) $socid;
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1);
|
||||
@ -286,7 +293,7 @@ if ($resql)
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($socid) $param .= '&socid='.urlencode($socid);
|
||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
||||
@ -299,12 +306,11 @@ if ($resql)
|
||||
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
|
||||
if ($search_montant_ttc != '') $param .= '&search_montant_ttc='.urlencode($search_montant_ttc);
|
||||
if ($search_payment_mode != '') $param .= '&search_payment_mode='.urlencode($search_payment_mode);
|
||||
if ($search_payment_type != '') $param .= '&search_payment_type='.urlencode($search_payment_type);
|
||||
if ($search_payment_term != '') $param .= '&search_payment_term='.urlencode($search_payment_term);
|
||||
if ($search_recurring != '' && $search_recurrning != '-1') $param .= '&search_recurring='.urlencode($search_recurring);
|
||||
if ($search_frequency > 0) $param .= '&search_frequency='.urlencode($search_frequency);
|
||||
if ($search_unit_frequency != '') $param .= '&search_unit_frequency='.urlencode($search_unit_frequency);
|
||||
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($option) $param .= "&option=".urlencode($option);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@ -326,12 +332,16 @@ if ($resql)
|
||||
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, 'invoicing', 0, '', '', $limit);
|
||||
$title = $langs->trans("RepeatableInvoices");
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'</span><br><br>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
@ -467,7 +477,6 @@ if ($resql)
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $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);
|
||||
|
||||
@ -455,7 +455,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
|
||||
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye";
|
||||
$sql .= ", s.nom as name";
|
||||
$sql .= ", s.rowid as socid";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
|
||||
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email";
|
||||
$sql .= ", SUM(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
@ -503,10 +503,14 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
|
||||
|
||||
$thirdpartystatic->id = $obj->socid;
|
||||
$thirdpartystatic->name = $obj->name;
|
||||
$thirdpartystatic->email = $obj->email;
|
||||
$thirdpartystatic->country_id = 0;
|
||||
$thirdpartystatic->country_code = '';
|
||||
$thirdpartystatic->client = 0;
|
||||
$thirdpartystatic->fournisseur = 1;
|
||||
//$thirdpartystatic->code_client = $obj->code_client;
|
||||
$thirdpartystatic->code_client = '';
|
||||
$thirdpartystatic->code_fournisseur = $obj->code_fournisseur;
|
||||
//$thirdpartystatic->code_compta = $obj->code_compta;
|
||||
$thirdpartystatic->code_compta = '';
|
||||
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
|
||||
|
||||
print '<tr class="oddeven nowraponall"><td>';
|
||||
|
||||
@ -277,7 +277,7 @@ if ($action == 'create')
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("BankAccount").'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"], "accountid", 0, "courant=1", 1); // Affiche liste des comptes courant
|
||||
$form->select_comptes(GETPOST("accountid", 'int'), "accountid", 0, "courant=1", 2); // List of bank account available
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -70,8 +70,7 @@ if (! $sortfield) $sortfield="name";
|
||||
$object = new Tva($db);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
|
||||
$upload_dir = $conf->tax->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='tax';
|
||||
$upload_dir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
|
||||
/*
|
||||
@ -144,7 +143,7 @@ if ($object->id)
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'tax';
|
||||
$modulepart = 'tax-vat';
|
||||
$permission = $user->rights->tax->charges->creer;
|
||||
$permtoedit = $user->rights->fournisseur->facture->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
|
||||
@ -741,7 +741,7 @@ while ($i < min($num, $limit))
|
||||
// Date
|
||||
if (!empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzuser').'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzserver').'</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
|
||||
@ -127,15 +127,17 @@ class box_task extends ModeleBoxes
|
||||
$boxcontent .= '<button type="submit" class="button">'.$langs->trans("Refresh").'</button>';
|
||||
$boxcontent .= '</form>'."\n";
|
||||
$boxcontent .= '</div>'."\n";
|
||||
$boxcontent .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery(".showiffilter'.$this->boxcode.'").toggle();
|
||||
if (! empty($conf->use_javascript_ajax)) {
|
||||
$boxcontent .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery(".showiffilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
// set cookie by js
|
||||
$boxcontent .= '<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
</script>';
|
||||
// set cookie by js
|
||||
$boxcontent .= '<script>date = new Date(); date.setTime(date.getTime()+(30*86400000)); document.cookie = "'.$cookie_name.'='.$filterValue.'; expires= " + date.toGMTString() + "; path=/ "; </script>';
|
||||
}
|
||||
$this->info_box_contents[0][] = array(
|
||||
'tr'=>'class="nohover showiffilter'.$this->boxcode.' hideobject"',
|
||||
'td' => 'class="nohover"',
|
||||
|
||||
@ -788,81 +788,84 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
{
|
||||
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
{
|
||||
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
|
||||
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||
//Add value to store price with currency
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
|
||||
$valArray=explode(',', $object->array_options['options_'.$key]);
|
||||
$output=array();
|
||||
foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
|
||||
if (in_array($keyopt, $valArray)) {
|
||||
$output[]=$valopt;
|
||||
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
{
|
||||
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
|
||||
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||
//Add value to store price with currency
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
|
||||
$valArray=explode(',', $object->array_options['options_'.$key]);
|
||||
$output=array();
|
||||
foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
|
||||
if (in_array($keyopt, $valArray)) {
|
||||
$output[]=$valopt;
|
||||
}
|
||||
}
|
||||
$object->array_options['options_'.$key] = implode(', ', $output);
|
||||
}
|
||||
$object->array_options['options_'.$key] = implode(', ', $output);
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
|
||||
{
|
||||
if (strlen($object->array_options['options_'.$key])>0)
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
|
||||
{
|
||||
$date = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->array_options['options_'.$key] = '';
|
||||
$object->array_options['options_'.$key.'_locale'] = '';
|
||||
$object->array_options['options_'.$key.'_rfc'] = '';
|
||||
}
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
|
||||
{
|
||||
$datetime = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs):''); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc'):''); // international format
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
|
||||
{
|
||||
$id = $object->array_options['options_'.$key];
|
||||
if ($id != "")
|
||||
{
|
||||
$param = $extrafields->attributes[$object->table_element]['param'][$key];
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$classname=$InfoFieldList[0];
|
||||
$classpath=$InfoFieldList[1];
|
||||
if (! empty($classpath))
|
||||
if (strlen($object->array_options['options_'.$key])>0)
|
||||
{
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($classname && class_exists($classname))
|
||||
$date = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->array_options['options_'.$key] = '';
|
||||
$object->array_options['options_'.$key.'_locale'] = '';
|
||||
$object->array_options['options_'.$key.'_rfc'] = '';
|
||||
}
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
|
||||
{
|
||||
$datetime = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs):''); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc'):''); // international format
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
|
||||
{
|
||||
$id = $object->array_options['options_'.$key];
|
||||
if ($id != "")
|
||||
{
|
||||
$param = $extrafields->attributes[$object->table_element]['param'][$key];
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$classname=$InfoFieldList[0];
|
||||
$classpath=$InfoFieldList[1];
|
||||
if (! empty($classpath))
|
||||
{
|
||||
$tmpobject = new $classname($this->db);
|
||||
$tmpobject->fetch($id);
|
||||
// completely replace the id with the linked object name
|
||||
$object->array_options['options_'.$key] = $tmpobject->name;
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($classname && class_exists($classname))
|
||||
{
|
||||
$tmpobject = new $classname($this->db);
|
||||
$tmpobject->fetch($id);
|
||||
// completely replace the id with the linked object name
|
||||
$object->array_options['options_'.$key] = $tmpobject->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
}
|
||||
|
||||
return $array_to_fill;
|
||||
|
||||
@ -604,14 +604,14 @@ class DiscountAbsolute
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id;
|
||||
$sql .= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess received
|
||||
$sql .= ' AND f.type IN (' . $invoice::TYPE_STANDARD . ', ' . $invoice::TYPE_CREDIT_NOTE . ', ' . $invoice::TYPE_SITUATION . ')'; // Find discount coming from credit note or excess received
|
||||
}
|
||||
elseif ($invoice->element == 'invoice_supplier')
|
||||
{
|
||||
$sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id;
|
||||
$sql .= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess paid
|
||||
$sql .= ' AND f.type IN (' . $invoice::TYPE_STANDARD . ', ' . $invoice::TYPE_CREDIT_NOTE . ')'; // Find discount coming from credit note or excess paid
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -455,9 +455,10 @@ class FormCompany extends Form
|
||||
* @param int $country_codeid 0=list for all countries, otherwise list only country requested
|
||||
* @param string $filter Add a SQL filter on list
|
||||
* @param string $htmlname HTML name of select
|
||||
* @param string $morecss More CSS
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code')
|
||||
public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code', $morecss = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs, $user;
|
||||
@ -479,7 +480,7 @@ class FormCompany extends Form
|
||||
if ($resql)
|
||||
{
|
||||
$out .= '<div id="particulier2" class="visible">';
|
||||
$out .= '<select class="flat minwidth200" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$out .= '<select class="flat minwidth200'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($country_codeid) $out .= '<option value="0"> </option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
@ -1099,7 +1099,7 @@ class FormFile
|
||||
if ($disablecrop == -1)
|
||||
{
|
||||
$disablecrop = 1;
|
||||
if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0;
|
||||
if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) $disablecrop = 0;
|
||||
}
|
||||
|
||||
// Define relative path used to store the file
|
||||
@ -1121,6 +1121,8 @@ class FormFile
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $upload_dir);
|
||||
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||
}
|
||||
// For example here $upload_dir = '/pathtodocuments/commande/SO2001-123/'
|
||||
// For example here $upload_dir = '/pathtodocuments/tax/vat/1'
|
||||
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
$parameters = array(
|
||||
|
||||
@ -742,7 +742,7 @@ class FormOther
|
||||
if (!is_array($arrayofcolors) || count($arrayofcolors) < 1)
|
||||
{
|
||||
$langs->load("other");
|
||||
if (empty($conf->dol_use_jmobile))
|
||||
if (empty($conf->dol_use_jmobile) && !empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$out .= '<link rel="stylesheet" media="screen" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/css/jPicker-1.1.6.css" />';
|
||||
$out .= '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jpicker/jpicker-1.1.6.js"></script>';
|
||||
@ -788,7 +788,7 @@ class FormOther
|
||||
}
|
||||
else // In most cases, this is not used. We used instead function with no specific list of colors
|
||||
{
|
||||
if (empty($conf->dol_use_jmobile))
|
||||
if (empty($conf->dol_use_jmobile) && !empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$out .= '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.css" type="text/css" media="screen" />';
|
||||
$out .= '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/colorpicker/jquery.colorpicker.js" type="text/javascript"></script>';
|
||||
|
||||
@ -282,7 +282,7 @@ class Translate
|
||||
* and split the rest until a line feed.
|
||||
* This is more efficient than fgets + explode + trim by a factor of ~2.
|
||||
*/
|
||||
while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n]"))
|
||||
while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n\r]"))
|
||||
{
|
||||
if (isset($line[1]))
|
||||
{
|
||||
|
||||
@ -2401,10 +2401,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
$original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file;
|
||||
}
|
||||
// Wrapping for taxes
|
||||
elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output))
|
||||
elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output))
|
||||
{
|
||||
if ($fuser->rights->tax->charges->{$lire}) $accessallowed=1;
|
||||
$original_file=$conf->tax->dir_output.'/'.$original_file;
|
||||
$modulepartsuffix = str_replace('tax-', '', $modulepart);
|
||||
$original_file=$conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file;
|
||||
}
|
||||
// Wrapping for events
|
||||
elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
|
||||
|
||||
@ -7804,12 +7804,11 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
}
|
||||
else // $mode=0
|
||||
{
|
||||
$textcrit = '';
|
||||
$tmpcrits = explode('|', $crit);
|
||||
$i3 = 0;
|
||||
foreach ($tmpcrits as $tmpcrit)
|
||||
{
|
||||
if (empty($tmpcrit)) continue;
|
||||
if ($tmpcrit !== '0' && empty($tmpcrit)) continue;
|
||||
|
||||
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ function vat_prepare_head($object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->tax->dir_output . "/vat/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/compta/tva/document.php?id='.$object->id;
|
||||
|
||||
@ -189,7 +189,7 @@ if ($action == 'presend')
|
||||
}
|
||||
|
||||
$formmail->withto = $liste;
|
||||
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '');
|
||||
$formmail->withtofree = (GETPOSTISSET('sendto') ? (GETPOST('sendto') ? GETPOST('sendto') : '1') : '1');
|
||||
$formmail->withtocc = $liste;
|
||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
||||
$formmail->withtopic = $topicmail;
|
||||
|
||||
@ -72,6 +72,7 @@ if ($action == 'delete')
|
||||
|
||||
$formfile=new FormFile($db);
|
||||
|
||||
|
||||
// We define var to enable the feature to add prefix of uploaded files.
|
||||
// Caller of this include can make
|
||||
// $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
|
||||
@ -93,6 +94,7 @@ if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_
|
||||
'project_task',
|
||||
'expensereport',
|
||||
'tax',
|
||||
'tax-vat',
|
||||
'produit',
|
||||
'product_batch',
|
||||
'bom',
|
||||
|
||||
@ -1841,42 +1841,52 @@ function top_menu_user()
|
||||
}
|
||||
else $appli .= " ".DOL_VERSION;
|
||||
|
||||
$btnUser = '<!-- div for user link -->
|
||||
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
|
||||
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
|
||||
'.$userImage.'
|
||||
<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
<div class="user-header">
|
||||
'.$userDropDownImage.'
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$btnUser = '<!-- div for user link -->
|
||||
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
|
||||
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
|
||||
'.$userImage.'
|
||||
<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
<!-- User image -->
|
||||
<div class="user-header">
|
||||
'.$userDropDownImage.'
|
||||
|
||||
<p>
|
||||
'.$profilName.'<br>
|
||||
<small class="classfortooltip" title="'.$langs->trans("PreviousConnexion").'" ><i class="fa fa-user-clock"></i> '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser').'</small><br>
|
||||
<small class="classfortooltip"><i class="fa fa-cog"></i> '.$langs->trans("Version").' '.$appli.'</small>
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
'.$profilName.'<br>
|
||||
<small class="classfortooltip" title="'.$langs->trans("PreviousConnexion").'" ><i class="fa fa-user-clock"></i> '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser').'</small><br>
|
||||
<small class="classfortooltip"><i class="fa fa-cog"></i> '.$langs->trans("Version").' '.$appli.'</small>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Menu Body -->
|
||||
<div class="user-body">'.$dropdownBody.'</div>
|
||||
<!-- Menu Body -->
|
||||
<div class="user-body">'.$dropdownBody.'</div>
|
||||
|
||||
<!-- Menu Footer-->
|
||||
<div class="user-footer">
|
||||
<div class="pull-left">
|
||||
'.$profilLink.'
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
'.$logoutLink.'
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<!-- Menu Footer-->
|
||||
<div class="user-footer">
|
||||
<div class="pull-left">
|
||||
'.$profilLink.'
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
'.$logoutLink.'
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>';
|
||||
</div>
|
||||
</div>';
|
||||
} else {
|
||||
$btnUser = '<!-- div for user link -->
|
||||
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
|
||||
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'">
|
||||
'.$userImage.'
|
||||
<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
|
||||
</a>
|
||||
</div>';
|
||||
}
|
||||
|
||||
if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) // This may be set by some pages that use different jquery version to avoid errors
|
||||
if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors
|
||||
{
|
||||
$btnUser .= '
|
||||
<!-- Code to show/hide the user drop-down -->
|
||||
@ -1919,7 +1929,9 @@ function top_menu_bookmark()
|
||||
$html = '';
|
||||
|
||||
// Define $bookmarks
|
||||
if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire)
|
||||
if (empty($conf->bookmark->enabled) || empty($user->rights->bookmark->lire)) return $html;
|
||||
|
||||
if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) // This may be set by some pages that use different jquery version to avoid errors
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php';
|
||||
$langs->load("bookmarks");
|
||||
|
||||
@ -36,6 +36,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
if (!empty($conf->categorie->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('stock', 'other', 'productbatch'));
|
||||
$langs->loadLangs(array('stocks', 'other', 'productbatch'));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user