Merge branch 'develop' of github.com:Dolibarr/dolibarr into new-task-list-filter-category-customer

This commit is contained in:
lvessiller 2022-05-23 11:55:07 +02:00
commit e7d165f570
172 changed files with 1800 additions and 1334 deletions

View File

@ -18,9 +18,10 @@ filter:
- dev/*
- doc/*
- documents/*
- htdocs/includes/*
- node_modules/*
- test/*
dependency_paths:
- htdocs/includes/*
paths:
- htdocs/*
- scripts/*

View File

@ -47,7 +47,8 @@ $main_option = array(
'ACCOUNTING_EXPORT_PREFIX_SPEC',
);
$configuration = AccountancyExport::getTypeConfig();
$accountancyexport = new AccountancyExport($db);
$configuration = $accountancyexport->getTypeConfig();
$listparam = $configuration['param'];
@ -117,7 +118,7 @@ if ($action == 'update') {
if (!$error) {
// reload
$configuration = AccountancyExport::getTypeConfig();
$configuration = $accountancyexport->getTypeConfig();
$listparam = $configuration['param'];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -237,7 +238,7 @@ if (!$conf->use_javascript_ajax) {
print "</td>";
} else {
print '<td>';
$listmodelcsv = AccountancyExport::getType();
$listmodelcsv = $accountancyexport->getType();
print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0, 0, 0, '', 0, 0, 0, '', '', 1);
print '</td>';

View File

@ -204,7 +204,8 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
unset($arrayfields['t.lettering_code']);
}
$listofformat = AccountancyExport::getType();
$accountancyexport = new AccountancyExport($db);
$listofformat = $accountancyexport->getType();
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
if (empty($listofformat[$formatexportset])) {
$formatexportset = 1;

View File

@ -11,6 +11,7 @@
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 André Schild <a.schild@aarboard.ch>
* Copyright (C) 2020 Guillaume Alexandre <guillaume@tag-info.fr>
* Copyright (C) 2022 Joachim Kueter <jkueter@gmx.de>
*
* 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
@ -34,6 +35,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
/**
@ -93,11 +95,13 @@ class AccountancyExport
*/
public function __construct(DoliDB $db)
{
global $conf;
global $conf, $hookmanager;
$this->db = $db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
$hookmanager->initHooks(array('accountancyexport'));
}
/**
@ -105,7 +109,7 @@ class AccountancyExport
*
* @return array of type
*/
public static function getType()
public function getType()
{
global $langs;
@ -132,6 +136,10 @@ class AccountancyExport
self::$EXPORT_TYPE_ISUITEEXPERT => 'Export iSuite Expert',
);
// allow modules to define export formats
global $hookmanager;
$reshook = $hookmanager->executeHooks('getType', $parameters, $listofexporttypes);
ksort($listofexporttypes, SORT_NUMERIC);
return $listofexporttypes;
@ -168,7 +176,12 @@ class AccountancyExport
self::$EXPORT_TYPE_ISUITEEXPERT => 'isuiteexpert',
);
return $formatcode[$type];
global $hookmanager;
$code = $formatcode[$type];
$parameters = array('type' => $type);
$reshook = $hookmanager->executeHooks('getFormatCode', $parameters, $code);
return $code;
}
/**
@ -176,11 +189,11 @@ class AccountancyExport
*
* @return array of type
*/
public static function getTypeConfig()
public function getTypeConfig()
{
global $conf, $langs;
return array(
$exporttypes = array(
'param' => array(
self::$EXPORT_TYPE_CONFIGURABLE => array(
'label' => $langs->trans('Modelcsv_configurable'),
@ -265,6 +278,11 @@ class AccountancyExport
'txt' => $langs->trans("txt")
),
);
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('getTypeConfig', $parameters, $exporttypes);
return $exporttypes;
}
@ -350,7 +368,13 @@ class AccountancyExport
$this->exportiSuiteExpert($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
global $hookmanager;
$parameters = array('format' => $formatexportset);
// file contents will be created in the hooked function via print
$reshook = $hookmanager->executeHooks('export', $parameters, $TData);
if ($reshook != 1) {
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
}
break;
}
}

View File

@ -1883,7 +1883,7 @@ class BookKeeping extends CommonObject
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;

View File

@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
}
print '</td>';
@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
print '<td class="center">';

View File

@ -121,6 +121,9 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
/** @var string string other */
public $other = array();
public $multilangs = array();

View File

@ -225,7 +225,7 @@ $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFI
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
@ -272,7 +272,7 @@ $tabsqlsort[24] = "code ASC, label ASC";
$tabsqlsort[25] = "t.module ASC, t.code ASC, t.label ASC";
//$tabsqlsort[26]="code ASC";
$tabsqlsort[27] = "code ASC";
$tabsqlsort[28] = "country ASC, code ASC";
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC";
@ -319,7 +319,7 @@ $tabfield[24] = "code,label";
$tabfield[25] = "code,label";
//$tabfield[26]= "code,label,short_label";
$tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
@ -366,7 +366,7 @@ $tabfieldvalue[24] = "code,label";
$tabfieldvalue[25] = "code,label";
//$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label";
@ -413,7 +413,7 @@ $tabfieldinsert[24] = "code,label";
$tabfieldinsert[25] = "code,label";
//$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label";
@ -585,6 +585,10 @@ complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqls
$i = 0;
foreach ($tabcomplete as $key => $value) {
$i++;
// When a dictionnary is commented
if (!isset($tabcond[$i])) {
continue;
}
$tabcomplete[$key]['id'] = $i;
$tabcomplete[$key]['cond'] = $tabcond[$i];
$tabcomplete[$key]['rowid'] = $tabrowid[$i];
@ -607,7 +611,7 @@ if (empty($sortfield)) {
$tmp1 = explode(',', empty($tabcomplete[$keytable]['sqlsort']) ? '' : $tabcomplete[$keytable]['sqlsort']);
$tmp2 = explode(' ', $tmp1[0]);
$sortfield = preg_replace('/^.*\./', '', $tmp2[0]);
$sortorder = $tmp2[1];
$sortorder = (!empty($tmp2[1]) ? $tmp2[1] : '');
//var_dump($sortfield);var_dump($sortorder);
}

View File

@ -101,9 +101,14 @@ if ($action == 'update') {
if ($mode == 'template') {
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
/*$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);*/
if (GETPOSTISSET('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);
}
}
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
if ($val == '') {

View File

@ -57,6 +57,7 @@ $langs->loadLangs($langsArray);
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$mode = GETPOST('mode', 'aZ09');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'alpha');
@ -619,15 +620,17 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
if (!empty($search) && is_array($search)) {
foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) {
foreach ($search[$key] as $skey) {
if ($skey != '') {
$param .= '&search_'.$key.'[]='.urlencode($skey);
}
}
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
} elseif ($search[$key] != '') {
$param .= '&search_'.$key.'='.urlencode($search[$key]);
}
}
if ($optioncss != '') {

View File

@ -257,7 +257,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
}
if ($execmethod == 1) {
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.(GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP') ? ' checked="checked"' : '').'" />';
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.((GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP')) ? ' checked="checked"' : '').'" />';
print '<label for="lowmemorydump">';
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
print '</label>';

View File

@ -144,6 +144,7 @@ class Asset extends CommonObject
public $fk_disposal_type;
public $disposal_depreciated;
public $disposal_subject_to_vat;
public $supplier_invoice_id;
public $note_public;
public $note_private;
public $date_creation;

View File

@ -105,7 +105,6 @@ class AssetModel extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1'),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>40, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
'fk_pays' =>array('type'=>'integer:Ccountry:core/class/ccountry.class.php', 'label'=>'Country', 'enabled'=>1, 'visible'=>1, 'position'=>50),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>300, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>301, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
@ -129,6 +128,7 @@ class AssetModel extends CommonObject
public $import_key;
public $model_pdf;
public $status;
public $asset_depreciation_options;
// /**
// * @var string Field with ID of parent key if this object has a parent

View File

@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
}
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
// Security check (enable the most restrictive one)
if ($user->socid > 0) accessforbidden();

View File

@ -80,8 +80,8 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id;
}
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
// Security check (enable the most restrictive one)
if ($user->socid > 0) accessforbidden();

View File

@ -68,9 +68,9 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))) || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $permissiontoadd; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];

View File

@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
}
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
// Security check (enable the most restrictive one)
if ($user->socid > 0) accessforbidden();

View File

@ -121,9 +121,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write)));
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->delete)));
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
$permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete)));
// Security check
if (empty($conf->asset->enabled)) {
@ -131,15 +131,18 @@ if (empty($conf->asset->enabled)) {
}
// Security check (enable the most restrictive one)
if ($user->socid > 0) accessforbidden();
$socid = 0; if ($user->socid > 0) $socid = $user->socid;
if ($user->socid > 0) {
accessforbidden();
}
$socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->asset->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
* Actions
*/
@ -300,19 +303,20 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
*/
/* The slow method does not consume memory on mysql (not tested on pgsql) */
/*$resql = $db->query($sql, 0, 'auto', 1);
while ($db->fetch_object($resql)) {
$nbtotalofrecords++;
}*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;

View File

@ -50,8 +50,8 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
}
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
$permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
$permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php
$permissionnote = $permissiontoadd; // Used by the include of actions_setnotes.inc.php
// Security check (enable the most restrictive one)

View File

@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
$morehtmlref = "";
llxHeader('', $title, $help_url);

View File

@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');

View File

@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php

View File

@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
if (empty($TNetNeeds[$line->fk_product])) {
$TNetNeeds[$line->fk_product] = 0;
}
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}

View File

@ -113,7 +113,7 @@ class Categorie extends CommonObject
*
* @todo Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_FK = array(
public $MAP_CAT_FK = array(
'customer' => 'soc',
'supplier' => 'soc',
'contact' => 'socpeople',
@ -125,7 +125,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_CAT_TABLE = array(
public $MAP_CAT_TABLE = array(
'customer' => 'societe',
'supplier' => 'fournisseur',
'bank_account'=> 'account',
@ -136,7 +136,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_CLASS = array(
public $MAP_OBJ_CLASS = array(
'product' => 'Product',
'customer' => 'Societe',
'supplier' => 'Fournisseur',
@ -178,7 +178,7 @@ class Categorie extends CommonObject
*
* @note Move to const array when PHP 5.6 will be our minimum target
*/
protected $MAP_OBJ_TABLE = array(
public static $MAP_OBJ_TABLE = array(
'customer' => 'societe',
'supplier' => 'societe',
'member' => 'adherent',
@ -258,6 +258,12 @@ class Categorie extends CommonObject
*/
public $motherof = array();
/**
* @var array Childs
*/
public $childs = array();
/**
* Constructor
*

View File

@ -1241,7 +1241,7 @@ if ($action == 'create') {
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container">';
print img_picto('', 'project', 'class="pictofixedwidth"');
print $formproject->select_projects((empty($societe->id) ? '' : $societe->id), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
print $formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
print '&nbsp;<a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.(empty($societe->id) ? '' : $societe->id).'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">';
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';

View File

@ -1220,11 +1220,14 @@ class ActionComm extends CommonObject
if (!empty($this->socpeopleassigned)) {
$already_inserted = array();
foreach (array_keys($this->socpeopleassigned) as $id) {
foreach (array_keys($this->socpeopleassigned) as $key => $val) {
if (!is_array($val)) { // For backward compatibility when val=id
$val = array('id'=>$val);
}
if (!empty($already_inserted[$val['id']])) continue;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $id).", 0, 0, 0)";
$sql .= " VALUES(".((int) $this->id).", 'socpeople', ".((int) $val['id']).", 0, 0, 0)";
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -183,7 +183,8 @@ if ($user->socid && $socid) {
*/
if (GETPOST('cancel', 'alpha')) {
$mode = 'list'; $massaction = '';
$mode = 'list';
$massaction = '';
}
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) {
@ -268,13 +269,17 @@ if (empty($reshook)) {
}
/*
* View
* View
*/
$form = new Form($db);
$userstatic = new User($db);
$formactions = new FormActions($db);
$actionstatic = new ActionComm($db);
$societestatic = new Societe($db);
$contactstatic = new Contact($db);
$nav = '';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
@ -282,7 +287,8 @@ $nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$
$now = dol_now();
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('', $langs->trans("Agenda"), $help_url);
$title = $langs->trans("Agenda");
llxHeader('', $title, $help_url);
// Define list of all external calendars
$listofextcals = array();
@ -570,11 +576,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords++;
}*/
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
$resql = $db->query($sqlforcount);
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
$page = 0;
$offset = 0;
}
@ -595,12 +601,6 @@ if (!$resql) {
$num = $db->num_rows($resql);
$actionstatic = new ActionComm($db);
$societestatic = new Societe($db);
$num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array();
// Local calendar
@ -804,44 +804,57 @@ print '<td class="liste_titre" align="middle">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">';
if (!empty($arrayfields['a.id']['checked'])) {
print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['owner']['checked'])) {
print_liste_field_titre($arrayfields['owner']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['c.libelle']['checked'])) {
print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.label']['checked'])) {
print_liste_field_titre($arrayfields['a.label']['label'], $_SERVER["PHP_SELF"], "a.label", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.note']['checked'])) {
print_liste_field_titre($arrayfields['a.note']['label'], $_SERVER["PHP_SELF"], "a.note", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
if (!empty($arrayfields['a.datep']['checked'])) {
print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.datep2']['checked'])) {
print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.fk_contact']['checked'])) {
print_liste_field_titre($arrayfields['a.fk_contact']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.fk_element']['checked'])) {
print_liste_field_titre($arrayfields['a.fk_element']['label'], $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
$totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
@ -849,18 +862,21 @@ print $hookmanager->resPrint;
if (!empty($arrayfields['a.datec']['checked'])) {
print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.tms']['checked'])) {
print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['a.percent']['checked'])) {
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
$totalarray['nbfield']++;
print "</tr>\n";
$contactstatic = new Contact($db);
$now = dol_now();
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
@ -869,8 +885,20 @@ $caction = new CActionComm($db);
$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
$contactListCache = array();
while ($i < min($num, $limit)) {
// Loop on record
// --------------------------------------------------------------------
$i = 0;
//$savnbfield = $totalarray['nbfield'];
//$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
if (empty($obj)) {
break; // Should not happen
}
// Store properties in $object
$object->setVarsFromFetchObj($obj);
// Discard auto action if option is on
if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') {
@ -1087,12 +1115,20 @@ while ($i < min($num, $limit)) {
}
print '</td>';
print "</tr>\n";
print '</tr>'."\n";
$i++;
}
print "</table>";
print '</div>';
print '</form>';
// If no record found
if ($num == 0) {
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'."\n";
print '</div>'."\n";
print '</form>'."\n";
$db->free($resql);

View File

@ -185,6 +185,11 @@ class Mailing extends CommonObject
*/
public $substitutionarray;
/**
* @var array substitutionarrayfortest
*/
public $substitutionarrayfortest;
/**
* Constructor

View File

@ -901,7 +901,7 @@ if (empty($reshook)) {
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free') {
$idprod = 0;
$tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0);
$tva_tx = (GETPOST('tva_tx') ? price2num(preg_replace('/\s*\(.*\)/', '', GETPOST('tva_tx'))) : 0);
} else {
$idprod = GETPOST('idprod', 'int');
$tva_tx = '';
@ -1644,7 +1644,7 @@ if ($action == 'create') {
// Ref customer
print '<tr class="field_ref_client"><td class="titlefieldcreate">'.$langs->trans('RefCustomer').'</td><td class="valuefieldcreate">';
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
print '<input type="text" name="ref_client" value="'.(!empty($ref_client)?$ref_client:GETPOST('ref_client')).'"></td>';
print '</tr>';
// Third party

View File

@ -135,8 +135,13 @@ class Proposals extends DolibarrApi
}
// Add external contacts ids.
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->propal->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->propal->contacts_ids = $tmparray;
}
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
@ -228,7 +233,10 @@ class Proposals extends DolibarrApi
$proposal_static = new Propal($this->db);
if ($proposal_static->fetch($obj->rowid)) {
// Add external contacts ids
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
$tmparray = $proposal_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$proposal_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
}
$i++;

View File

@ -296,8 +296,8 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>24),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@ -317,7 +317,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
@ -327,7 +327,7 @@ class Propal extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>191),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>191),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
@ -1517,6 +1517,7 @@ class Propal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht";
$sql .= ", p.datec";
$sql .= ", p.date_signature as dates";
$sql .= ", p.date_valid as datev";
$sql .= ", p.datep as dp";
$sql .= ", p.fin_validite as dfv";
@ -1600,6 +1601,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation date
$this->date_modification = $this->db->jdate($obj->date_modification); // tms
$this->date_signature = $this->db->jdate($obj->dates); // Signature date
$this->date = $this->db->jdate($obj->dp); // Proposal date
$this->datep = $this->db->jdate($obj->dp); // deprecated
$this->fin_validite = $this->db->jdate($obj->dfv);

View File

@ -236,7 +236,7 @@ $arrayfields = array(
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1),
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),

View File

@ -1697,8 +1697,8 @@ if ($action == 'create' && $usercancreate) {
if ($socid > 0) {
// Contacts (ask contact only if thirdparty already defined).
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
print img_picto('', 'contact');
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1);
print img_picto('', 'contact', 'class="pictofixedwidth"');
print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, $srccontactslist, '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
// Ligne info remises tiers
@ -1755,7 +1755,7 @@ if ($action == 'create' && $usercancreate) {
// Shipping Method
if (!empty($conf->expedition->enabled)) {
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"');
print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>';
}

View File

@ -133,7 +133,10 @@ class Orders extends DolibarrApi
}
// Add external contacts ids
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->commande->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->commande->contacts_ids = $tmparray;
}
$this->commande->fetchObjectLinked();
// Add online_payment_url, cf #20477
@ -234,7 +237,10 @@ class Orders extends DolibarrApi
$commande_static = new Commande($this->db);
if ($commande_static->fetch($obj->rowid)) {
// Add external contacts ids
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
$tmparray = $commande_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$commande_static->contacts_ids = $tmparray;
}
// Add online_payment_url, cf #20477
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);

View File

@ -313,8 +313,8 @@ class Commande extends CommonOrder
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>25),
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@ -334,14 +334,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@ -359,7 +359,7 @@ class Commande extends CommonOrder
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>300),
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>302),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>304),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>304),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>306),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>400),
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
@ -4443,7 +4443,7 @@ class OrderLine extends CommonOrderLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end,';
$sql .= ' fk_unit';
@ -4466,7 +4466,6 @@ class OrderLine extends CommonOrderLine
$sql .= " '".price2num($this->remise_percent)."',";
$sql .= " ".(price2num($this->subprice) !== '' ?price2num($this->subprice) : "null").",";
$sql .= " ".($this->price != '' ? "'".price2num($this->price)."'" : "null").",";
$sql .= " '".price2num($this->remise)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= ' '.((int) $this->special_code).',';
$sql .= ' '.((int) $this->rang).',';

View File

@ -190,7 +190,7 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),

View File

@ -32,14 +32,15 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
@ -54,6 +55,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills", "categories", "companies", "margins", "salaries", "loan", "donations", "trips", "members", "compta", "accountancy"));
@ -99,6 +101,7 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
$search_fk_bordereau = GETPOST("search_fk_bordereau", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$toselect = GETPOST('toselect', 'array');
$num_releve = GETPOST("num_releve", "alpha");
@ -157,20 +160,21 @@ $extrafields->fetch_name_optionals_label('banktransaction');
$search_array_options = $extrafields->getOptionalsFromPost('banktransaction', '', 'search_');
$arrayfields = array(
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
'b.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1,'position'=>10),
'b.label'=>array('label'=>$langs->trans("Description"), 'checked'=>1,'position'=>20),
'b.dateo'=>array('label'=>$langs->trans("DateOperationShort"), 'checked'=>1,'position'=>30),
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1,'position'=>40),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1,'position'=>50),
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1,'position'=>60),
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>70),
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>80),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>90),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>100),
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>110),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130),
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140),
'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150),
);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -178,7 +182,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
@ -214,6 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
$search_fk_bordereau = '';
$toselect = array();
$search_account = "";
@ -390,8 +394,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->ba
}
}
/*
* View
*/
@ -421,6 +423,7 @@ $paymentvariousstatic = new PaymentVarious($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$bankstatic = new Account($db);
$banklinestatic = new AccountLine($db);
$bordereaustatic = new RemiseCheque($db);
$now = dol_now();
@ -465,6 +468,9 @@ if (!empty($search_num_releve)) {
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
}
if ($search_fk_bordereau > 0) {
$param .= '$&search_fk_bordereau='.urlencode($search_fk_bordereau);
}
if ($search_bid > 0) {
$param .= '&search_bid='.urlencode($search_bid);
}
@ -568,8 +574,9 @@ if ($id > 0 || !empty($ref)) {
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
}
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql .= " b.fk_account, b.fk_type,";
$sql .= " b.fk_account, b.fk_type, b.fk_bordereau,";
$sql .= " ba.rowid as bankid, ba.ref as bankref";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -621,6 +628,9 @@ if ($search_num_releve) {
if ($search_conciliated != '' && $search_conciliated != '-1') {
$sql .= " AND b.rappro = ".((int) $search_conciliated);
}
if ($search_fk_bordereau > 0) {
$sql .= " AND b.fk_bordereau = " . ((int) $search_fk_bordereau);
}
if ($search_thirdparty_user) {
$sql.= " AND (b.rowid IN ";
$sql.= " ( SELECT bu.fk_bank FROM ".MAIN_DB_PREFIX."bank_url AS bu";
@ -737,6 +747,9 @@ if ($search_conciliated != '' && $search_conciliated != '-1') {
if (!empty($search_num_releve)) {
$mode_balance_ok = false;
}
if (!empty($search_fk_bordereau)) {
$mode_balance_ok = false;
}
$sql .= $db->plimit($limit + 1, $offset);
//print $sql;
@ -1067,34 +1080,40 @@ if ($resql) {
$form->select_types_paiements(empty($search_type) ? '' : $search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100');
print '</td>';
}
// Numero
if (!empty($arrayfields['b.num_chq']['checked'])) {
// Numero
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
}
// Checked
if (!empty($arrayfields['bu.label']['checked'])) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth75" name="search_thirdparty" value="'.dol_escape_htmltag($search_thirdparty_user).'"></td>';
}
// Ref
if (!empty($arrayfields['ba.ref']['checked'])) {
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1, ($id > 0 || !empty($ref) ? ' disabled="disabled"' : ''), 0, 'maxwidth100');
print '</td>';
}
// Debit
if (!empty($arrayfields['b.debit']['checked'])) {
print '<td class="liste_titre right">';
print '<input type="text" class="flat width50" name="search_debit" value="'.dol_escape_htmltag($search_debit).'">';
print '</td>';
}
// Credit
if (!empty($arrayfields['b.credit']['checked'])) {
print '<td class="liste_titre right">';
print '<input type="text" class="flat width50" name="search_credit" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>';
}
// Balance before
if (!empty($arrayfields['balancebefore']['checked'])) {
print '<td class="liste_titre right">';
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>';
}
// Balance
if (!empty($arrayfields['balance']['checked'])) {
print '<td class="liste_titre right">';
$htmltext = $langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
@ -1111,6 +1130,11 @@ if ($resql) {
print $form->selectyesno('search_conciliated', $search_conciliated, 1, false, 1, 1);
print '</td>';
}
// Bordereau
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).'" size="3"></td>';
}
// Actions and select
print '<td class="liste_titre" align="middle">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@ -1162,6 +1186,10 @@ if ($resql) {
if (!empty($arrayfields['b.conciliated']['checked'])) {
print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
}
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -1673,6 +1701,16 @@ if ($resql) {
}
}
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
$bordereaustatic->fetch($objp->fk_bordereau);
print '<td class="nowraponall" align="center">';
print $bordereaustatic->getNomUrl();
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action edit/delete and select
print '<td class="nowraponall" align="center">';
// Transaction reconciliated or edit link

View File

@ -153,7 +153,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT c.id, c.libelle as label,";
$sql .= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
@ -185,7 +185,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -239,15 +239,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
print price($obj->totalpaye);
if ($obj->totalpaid) {
print price($obj->totalpaid);
}
print '</td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
@ -258,7 +258,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
if (!empty($conf->banque->enabled)) {
print '<td></td>';
}
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print "</tr>";
} else {
dol_print_error($db);

View File

@ -142,9 +142,9 @@ if (!empty($conf->global->INVOICE_DISALLOW_REOPEN)) {
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
$usercancreatemargin = $user->rights->margins->creer;
$usercanreadallmargin = $user->rights->margins->liretous;
$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
$usercancreatemargin = (!empty($user->rights->margins->creer) ? $user->rights->margins->creer : 0);
$usercanreadallmargin = (!empty($user->rights->margins->liretous) ? $user->rights->margins->liretous : 0);
$usercancreatewithdrarequest = (!empty($user->rights->prelevement->bons->creer) ? $user->rights->prelevement->bons->creer : 0);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@ -725,14 +725,14 @@ if (empty($reshook)) {
while ($i < $num) {
$objp = $db->fetch_object($result);
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
dol_print_error($db, '');
}
$resteapayer = $object->total_ttc - $totalpaye;
$resteapayer = $object->total_ttc - $totalpaid;
// We check that invlice lines are transferred into accountancy
$ventilExportCompta = $object->getVentilExportCompta();
@ -1255,10 +1255,10 @@ if (empty($reshook)) {
if (GETPOST('invoiceAvoirWithPaymentRestAmount', 'int') == 1 && $id > 0) {
if ($facture_source->fetch($object->fk_facture_source) > 0) {
$totalpaye = $facture_source->getSommePaiement();
$totalpaid = $facture_source->getSommePaiement();
$totalcreditnotes = $facture_source->getSumCreditNotesUsed();
$totaldeposits = $facture_source->getSumDepositsUsed();
$remain_to_pay = abs($facture_source->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits);
$remain_to_pay = abs($facture_source->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits);
$object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, 0, 0, 0, 0, 0, '', '', 'TTC');
}
@ -3899,24 +3899,24 @@ if ($action == 'create') {
}
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits."
// selleruserrevenuestamp=".$selleruserevenustamp;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency
if (!empty($conf->multicurrency->enabled)) {
$multicurrency_totalpaye = $object->getSommePaiement(1);
$multicurrency_totalpaid = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaid - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
// Code to fix case of corrupted data
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
@ -4317,7 +4317,7 @@ if ($action == 'create') {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
@ -4926,7 +4926,7 @@ if ($action == 'create') {
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$totalpaid = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
@ -4939,7 +4939,7 @@ if ($action == 'create') {
}
print '<td class="right"><span class="amount">'.price($next_invoice->total_ht).'</span></td>';
print '<td class="right"><span class="amount">'.price($next_invoice->total_ttc).'</span></td>';
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
print '<td class="right">'.$next_invoice->getLibStatut(3, $totalpaid).'</td>';
print '</tr>';
}
@ -5072,7 +5072,7 @@ if ($action == 'create') {
} else {
print $langs->trans('AlreadyPaid');
}
print '</span></td><td class="right'.(($totalpaye > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaye).'</td><td>&nbsp;</td></tr>';
print '</span></td><td class="right'.(($totalpaid > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaid).'</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
@ -5125,7 +5125,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Discount"), $langs->trans("HelpEscompte"), - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5135,7 +5135,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $langs->trans("HelpAbandonBadCustomer"), - 1);
print '</span>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</td><td>&nbsp;</td></tr>';
print '</td><td class="right">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</td><td>&nbsp;</td></tr>';
// $resteapayeraffiche=0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5145,7 +5145,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("ProductReturned"), $langs->trans("HelpAbandonProductReturned"), - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5159,7 +5159,7 @@ if ($action == 'create') {
print '<span class="opacitymedium">';
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
print '</span>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
@ -5220,7 +5220,7 @@ if ($action == 'create') {
// Total already paid back
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">'.$langs->trans('AlreadyPaidBack').'</span>';
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaye).'</span></td><td>&nbsp;</td></tr>';
print '</td><td class="right"><span class="amount">'.price($sign * $totalpaid).'</span></td><td>&nbsp;</td></tr>';
// Billed
print '<tr><td colspan="'.$nbcols.'" class="right"><span class="opacitymedium">'.$langs->trans("Billed").'</span></td><td class="right">'.price($sign * $object->total_ttc).'</td><td>&nbsp;</td></tr>';
@ -5498,8 +5498,8 @@ if ($action == 'create') {
}
}
$sumofpayment = $totalpaye;
$sumofpaymentall = $totalpaye + $totalcreditnotes + $totaldeposits;
$sumofpayment = $totalpaid;
$sumofpaymentall = $totalpaid + $totalcreditnotes + $totaldeposits;
// Reverse back money or convert to reduction
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
@ -5551,7 +5551,7 @@ if ($action == 'create') {
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_SET_PAID_EVEN_IF_PARTIALLY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
if ($totalpaid > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
} else {
@ -5575,7 +5575,7 @@ if ($action == 'create') {
// For situation invoice with excess received
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& ($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits) > 0
&& $usercancreate
&& !$objectidnext
&& $object->is_last_in_cycle()

View File

@ -148,7 +148,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->invoice->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->invoice->contacts_ids = $tmparray;
}
}
$this->invoice->fetchObjectLinked();
@ -267,8 +270,10 @@ class Invoices extends DolibarrApi
$invoice_static->remaintopay = price2num($invoice_static->total_ttc - $invoice_static->totalpaid - $invoice_static->totalcreditnotes - $invoice_static->totaldeposits, 'MT');
// Add external contacts ids
$invoice_static->contacts_ids = $invoice_static->liste_contact(-1, 'external', 1);
$tmparray = $invoice_static->liste_contact(-1, 'external', 1);
if (is_array($tmparray)) {
$invoice_static->contacts_ids = $tmparray;
}
$obj_ret[] = $this->_cleanObjectDatas($invoice_static);
}
$i++;
@ -1420,10 +1425,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
$totalpaye = $this->invoice->getSommePaiement();
$totalpaid = $this->invoice->getSommePaiement();
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed();
$totaldeposits = $this->invoice->getSumDepositsUsed();
$resteapayer = price2num($this->invoice->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($this->invoice->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
$this->db->begin();
@ -1562,10 +1567,10 @@ class Invoices extends DolibarrApi
}
// Calculate amount to pay
$totalpaye = $this->invoice->getSommePaiement($is_multicurrency);
$totalpaid = $this->invoice->getSommePaiement($is_multicurrency);
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed($is_multicurrency);
$totaldeposits = $this->invoice->getSumDepositsUsed($is_multicurrency);
$remainstopay = $amount = price2num($total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$remainstopay = $amount = price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if (!$is_multicurrency && $amountarray["amount"] != 'remain') {
$amount = price2num($amountarray["amount"], 'MT');
@ -1768,7 +1773,10 @@ class Invoices extends DolibarrApi
// Add external contacts ids
if ($contact_list > -1) {
$this->template_invoice->contacts_ids = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
$tmparray = $this->template_invoice->liste_contact(-1, 'external', $contact_list);
if (is_array($tmparray)) {
$this->template_invoice->contacts_ids = $tmparray;
}
}
$this->template_invoice->fetchObjectLinked();

View File

@ -169,7 +169,7 @@ class FactureRec extends CommonInvoice
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>25),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>85),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
@ -199,7 +199,7 @@ class FactureRec extends CommonInvoice
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175),
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
@ -1333,6 +1333,11 @@ class FactureRec extends CommonInvoice
$facture->status = self::STATUS_DRAFT;
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
$facture->socid = $facturerec->socid;
if (!empty($facturerec->fk_multicurrency)) {
$facture->fk_multicurrency = $facturerec->fk_multicurrency;
$facture->multicurrency_code = $facturerec->multicurrency_code;
$facture->multicurrency_tx = $facturerec->multicurrency_tx;
}
$invoiceidgenerated = $facture->create($user);
if ($invoiceidgenerated <= 0) {

View File

@ -5214,13 +5214,13 @@ class Facture extends CommonInvoice
$hasDelay = $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
if ($hasDelay && !empty($this->retained_warranty) && !empty($this->retained_warranty_date_limit)) {
$totalpaye = $this->getSommePaiement();
$totalpaye = floatval($totalpaye);
$totalpaid = $this->getSommePaiement();
$totalpaid = floatval($totalpaid);
$RetainedWarrantyAmount = $this->getRetainedWarrantyAmount();
if ($totalpaye >= 0 && $RetainedWarrantyAmount >= 0) {
if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
if ($totalpaid >= 0 && $RetainedWarrantyAmount >= 0) {
if (($totalpaid < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
} elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
} elseif ($totalpaid < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) {
$hasDelay = 1;
} else {
$hasDelay = 0;

View File

@ -52,7 +52,7 @@ if ($user->socid) {
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$result = restrictedArea($user, 'facture', $object->id);
@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'contact', $langs->trans('InvoiceCustomer'), -1, 'bill');
@ -171,7 +171,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);

View File

@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer'), -1, 'bill');
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
@ -172,7 +172,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -47,7 +47,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
if ($id > 0 || !empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
// Security check
@ -84,7 +84,7 @@ $object->info($object->id);
$head = facture_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill');
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Invoice content
@ -131,7 +131,7 @@ if (!empty($conf->projet->enabled)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
@ -140,7 +140,7 @@ print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>';
print '<table class="centpercent"><tr><td>';
dol_print_object_info($object);
print '</td></tr></table>';

View File

@ -245,7 +245,7 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
@ -472,10 +472,10 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement)
$objecttmp = new Facture($db);
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$totalpaye = $objecttmp->getSommePaiement();
$totalpaid = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($objecttmp->statut == Facture::STATUS_DRAFT) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
@ -1112,7 +1112,7 @@ if ($resql) {
if (!empty($user->rights->facture->paiement)) {
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
}
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
if (!empty($conf->prelevement->enabled) && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
}

View File

@ -44,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
$object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
}
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
@ -99,7 +99,7 @@ if ($id > 0 || !empty($ref)) {
$head = facture_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
print dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill');
@ -148,7 +148,7 @@ if ($id > 0 || !empty($ref)) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);

View File

@ -236,16 +236,16 @@ llxHeader('', $title, $helpurl);
if ($object->id > 0) {
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
$totalcreditnotes = $object->getSumCreditNotesUsed();
$totaldeposits = $object->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($object->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
if ($object->paye) {
$resteapayer = 0;
@ -281,8 +281,8 @@ if ($object->id > 0) {
}
$author = new User($db);
if ($object->user_author) {
$author->fetch($object->user_author);
if ($object->fk_user_author) {
$author->fetch($object->fk_user_author);
}
if ($type == 'bank-transfer') {
@ -384,7 +384,7 @@ if ($object->id > 0) {
}
$morehtmlref .= '</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $moreparam, 0, '', '');
@ -667,7 +667,7 @@ if ($object->id > 0) {
// Total with tax
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td class="nowrap">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// TODO Replace this by an include with same code to show already done payment visible in invoice card
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td class="nowrap">'.price($resteapayer, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';

View File

@ -102,11 +102,9 @@ print load_fiche_titre($langs->trans("AccountancyTreasuryArea"), '', 'bill');
print '<div class="fichecenter"><div class="fichethirdleft">';
//print getCustomerInvoicePieChart($socid);
print getNumberInvoicesPieChart('customers');
print '<br>';
print getNumberInvoicesPieChart('fourn');
//print getPurchaseInvoicePieChart($socid);
print '<br>';
print getCustomerInvoiceDraftTable($max, $socid);
print '<br>';

View File

@ -293,7 +293,7 @@ $mend = $tmp['mon'];
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@ -536,7 +536,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<td class="nowrap right">'.price(price2num($x_paye_sum, 'MT')).'</td>';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@ -552,12 +552,12 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m / 3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotalpaid, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtotal, 'MT')).'</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
}
}

View File

@ -109,6 +109,16 @@ class Paiement extends CommonObject
*/
public $ext_payment_id;
/**
* @var string Id of prelevement
*/
public $id_prelevement;
/**
* @var string num_prelevement
*/
public $num_prelevement;
/**
* @var string Name of external payment mode
*/

View File

@ -291,7 +291,7 @@ if ($action == 'create') {
print "</tr>\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
$totalrecu += $objp->am;
$totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {

View File

@ -290,7 +290,7 @@ if ($action == 'create') {
print "</tr>\n";
$total += $objp->total;
$total_ttc += $objp->total_ttc;
$totalrecu += $objp->am;
$totalrecu += $objp->amount;
$i++;
}
if ($i > 1) {

View File

@ -394,10 +394,10 @@ class BonPrelevement extends CommonObject
$amounts[$fac->id] = $facs[$i][1];
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
$totalpaye = $fac->getSommePaiement();
$totalpaid = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
$alreadypayed = $totalpaid + $totalcreditnotes + $totaldeposits;
// @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {

View File

@ -158,7 +158,7 @@ if ($id > 0) {
print $fac->error."<br>";
continue;
}
$totalpaye = $fac->getSommePaiement();
$totalpaid = $fac->getSommePaiement();
$userstatic->id = $objf->userid;
$userstatic->login = $objf->login;
@ -168,7 +168,7 @@ if ($id > 0) {
'date' => $fac->date,
'datefieldforsort' => $fac->date.'-'.$fac->ref,
'link' => $fac->getNomUrl(1),
'status' => $fac->getLibStatut(2, $totalpaye),
'status' => $fac->getLibStatut(2, $totalpaid),
'amount' => $fac->total_ttc,
'author' => $userstatic->getLoginUrl(1)
);

View File

@ -166,8 +166,8 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
// Delete social contribution
if ($action == 'confirm_delete' && $confirm == 'yes') {
$object->fetch($id);
$totalpaye = $object->getSommePaiement();
if (empty($totalpaye)) {
$totalpaid = $object->getSommePaiement();
if (empty($totalpaid)) {
$result = $object->delete($user);
if ($result > 0) {
header("Location: list.php");
@ -454,7 +454,7 @@ if ($id > 0) {
if ($result > 0) {
$head = tax_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@ -576,7 +576,7 @@ if ($id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@ -690,7 +690,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$totalpaye = 0;
$totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@ -748,7 +748,7 @@ if ($id > 0) {
}
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -757,10 +757,10 @@ if ($id > 0) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid").' :</td><td class="right">'.price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected").' :</td><td class="right">'.price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
@ -820,7 +820,7 @@ if ($id > 0) {
}
// Delete
if ($user->rights->tax->charges->supprimer && empty($totalpaye)) {
if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';

View File

@ -113,6 +113,12 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
/**
* @var double total
*/
public $total;
public $totalpaid;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;

View File

@ -100,6 +100,22 @@ class PaymentSocialContribution extends CommonObject
*/
public $fk_user_modif;
/**
* @var int ID
*/
public $chid;
/**
* @var integer|string datepaye
*/
public $datepaye;
/**
* @var integer|string paiementtype
*/
public $paiementtype;
/**
* Constructor
*

View File

@ -139,7 +139,9 @@ if ($object->id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -81,6 +81,8 @@ $object->info($id);
$head = tax_prepare_head($object);
$alreadypayed = $object->getSommePaiement();
print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1, $object->picto);
$morehtmlref = '<div class="refidno">';
@ -106,8 +108,9 @@ $morehtmlref .= '</div>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $alreadypayed; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';

View File

@ -113,7 +113,9 @@ if ($id > 0 || !empty($ref)) {
// ------------------------------------------------------------
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
//$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
//$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);

View File

@ -137,7 +137,7 @@ print '<input type="hidden" name="page" value="'.$page.'">';
$sql = "SELECT c.id, c.libelle as type_label,";
$sql .= " cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
$sql .= " pct.code as payment_code,";
$sql .= " u.rowid uid, u.lastname, u.firstname, u.email, u.login, u.admin,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos";
@ -253,7 +253,7 @@ if (!$resql) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -346,8 +346,8 @@ while ($i < min($num, $limit)) {
// Paid
print '<td class="right">';
if ($obj->totalpaye) {
print '<span class="amount">'.price($obj->totalpaye).'</span>';
if ($obj->totalpaid) {
print '<span class="amount">'.price($obj->totalpaid).'</span>';
}
print '</td>';
@ -357,7 +357,7 @@ while ($i < min($num, $limit)) {
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@ -373,7 +373,7 @@ if (!empty($conf->banque->enabled)) {
print '<td></td>';
print '<td></td>';
}
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print '<td></td>';
print "</tr>";

View File

@ -273,9 +273,9 @@ if ($action == 'add' && !$cancel) {
if ($action == 'confirm_delete' && $confirm == 'yes') {
$result = $object->fetch($id);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
if (empty($totalpaye)) {
if (empty($totalpaid)) {
$db->begin();
$ret = $object->delete($user);
@ -540,7 +540,7 @@ if ($action == 'create') {
if ($id > 0) {
$head = vat_prepare_head($object);
$totalpaye = $object->getSommePaiement();
$totalpaid = $object->getSommePaiement();
// Clone confirmation
if ($action === 'clone') {
@ -580,7 +580,7 @@ if ($id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', '');
@ -683,7 +683,7 @@ if ($id > 0) {
//print $sql;
$resql = $db->query($sql);
if ($resql) {
$totalpaye = 0;
$totalpaid = 0;
$num = $db->num_rows($resql);
$i = 0;
@ -735,7 +735,7 @@ if ($id > 0) {
}
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$totalpaid += $objp->amount;
$i++;
}
} else {
@ -744,10 +744,10 @@ if ($id > 0) {
print '</tr>';
}
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaye)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AlreadyPaid")." :</td><td class=\"right\">".price($totalpaid)."</td></tr>\n";
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("AmountExpected")." :</td><td class=\"right\">".price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye;
$resteapayer = $object->amount - $totalpaid;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print '<tr><td colspan="'.$nbcols.'" class="right">'.$langs->trans("RemainderToPay")." :</td>";
@ -810,7 +810,7 @@ if ($id > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&token='.newToken().'&action=clone">'.$langs->trans("ToClone")."</a></div>";
}
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) {
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';

View File

@ -96,6 +96,28 @@ class PaymentVAT extends CommonObject
*/
public $fk_user_modif;
/**
* @var int ID
*/
public $chid;
/**
* @var string lib
* @deprecated
* @see $label
*/
public $lib;
/**
* @var integer|string datepaye
*/
public $datepaye;
/**
* @var integer|string paiementtype
*/
public $paiementtype;
/**
* Constructor
*

View File

@ -49,6 +49,12 @@ class Tva extends CommonObject
*/
public $picto = 'payment';
/**
* @deprecated
* @see $amount
*/
public $total;
public $tms;
public $datep;
public $datev;
@ -56,6 +62,11 @@ class Tva extends CommonObject
public $type_payment;
public $num_payment;
/**
* @var integer|string totalpaid
*/
public $totalpaid;
/**
* @var string label
*/
@ -81,6 +92,11 @@ class Tva extends CommonObject
*/
public $fk_user_modif;
/**
* @var integer|string paiementtype
*/
public $paiementtype;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;

View File

@ -125,8 +125,9 @@ if ($object->id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
$morehtmlright = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';

View File

@ -255,7 +255,7 @@ if ($refresh === true) {
//var_dump($m);
$total = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
$i = 0;
$mcursor = 0;
@ -481,7 +481,7 @@ if ($refresh === true) {
print '<td class="nowrap right"><span class="amount">' . price(price2num($x_paye_sum, 'MT')) . '</span></td>';
$subtotalcoll = $subtotalcoll + $x_coll_sum;
$subtotalpaye = $subtotalpaye + $x_paye_sum;
$subtotalpaid = $subtotalpaid + $x_paye_sum;
$diff = $x_coll_sum - $x_paye_sum;
$total = $total + $diff;
@ -498,12 +498,12 @@ if ($refresh === true) {
print '<tr class="liste_total">';
print '<td class="right"><a href="quadri_detail.php?leftmenu=tax_vat&q=' . round($m / 3) . '&year=' . $y . '">' . $langs->trans("SubTotal") . '</a>:</td>';
print '<td class="nowrap right">' . price(price2num($subtotalcoll, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotalpaye, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotalpaid, 'MT')) . '</td>';
print '<td class="nowrap right">' . price(price2num($subtotal, 'MT')) . '</td>';
print '<td>&nbsp;</td></tr>';
$i = 0;
$subtotalcoll = 0;
$subtotalpaye = 0;
$subtotalpaid = 0;
$subtotal = 0;
}
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
*
* 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
@ -141,7 +141,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaye, ptva.num_paiement as num_payment,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
@ -175,11 +175,15 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
$i = 0;
$total = 0;
$totalnb = 0;
$totalpaye = 0;
$totalpaid = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
$tva->id = $obj->rowid;
$tva->ref = $obj->rowid;
$tva->label = $obj->label;
$payment_vat_static->id = $obj->pid;
$payment_vat_static->ref = $obj->pid;
@ -190,31 +194,32 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
// VAT
print '<td>';
$tva->id = $obj->rowid;
$tva->ref = $obj->rowid;
$tva->label = $obj->label;
print $tva->getNomUrl(1, '20');
print '</td>';
// Label
print '<td>'.$obj->label.'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
// Date
$date = $obj->datev;
print '<td>'.dol_print_date($date, 'day').'</td>';
$date = $db->jdate($obj->datev);
print '<td class="center nowraponall">'.dol_print_date($date, 'day').'</td>';
// Date payment
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day').'</td>';
$datep = $db->jdate($obj->datep);
print '<td class="center nowraponalls">'.dol_print_date($datep, 'day').'</td>';
// Type payment
print '<td>';
$labelpaymenttype = '';
if ($obj->payment_code) {
print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
$labelpaymenttype = $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
}
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelpaymenttype).'">';
print dol_escape_htmltag($labelpaymenttype);
print '</td>';
// Chq number
print '<td>'.$obj->num_payment.'</td>';
print '<td>'.dol_escape_htmltag($obj->num_payment).'</td>';
if (!empty($conf->banque->enabled)) {
// Bank transaction
@ -231,21 +236,20 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '</td>';
}
// Type
//print '<td><a href="../tva/list.php?filtre=tva.fk_type:'.$obj->type.'">'.$obj->type_label.'</a></td>';
// Expected to pay
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
// Paid
print '<td class="right"><span class="amount">';
if ($obj->totalpaye) {
print price($obj->totalpaye);
if ($obj->totalpaid) {
print price($obj->totalpaid);
}
print '</span></td>';
print '</tr>';
$total = $total + $obj->total;
$totalnb = $totalnb + $obj->nb;
$totalpaye = $totalpaye + $obj->totalpaye;
$totalpaid = $totalpaid + $obj->totalpaid;
$i++;
}
@ -260,7 +264,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
}
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price($totalpaye)."</td>";
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print "</tr>";
} else {
dol_print_error($db);

View File

@ -316,8 +316,9 @@ if (empty($reshook)) {
$result = $object->delete(); // TODO Add $user as first param
if ($result > 0) {
if ($backtopage) {
header("Location: ".$backtopage);
setEventMessages("RecordDeleted", null, 'mesgs');
if ($backurlforlist) {
header("Location: ".$backurlforlist);
exit;
} else {
header("Location: ".DOL_URL_ROOT.'/contact/list.php');

View File

@ -130,6 +130,13 @@ class Contact extends CommonObject
public $civility_code;
public $civility;
/**
* @var string The civilite code, not an integer
* @deprecated
* @see $civility_code
*/
public $civilite;
/**
* @var string Address
*/

View File

@ -232,8 +232,8 @@ class Contrat extends CommonObject
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->projet->enabled', 'visible'=>-1, 'position'=>75),
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),

View File

@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
$object->$key = '(PROV)';
}
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}

View File

@ -1468,6 +1468,7 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $
$trackid = 'leav'.$objecttmp->id;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email

View File

@ -0,0 +1,122 @@
<?php
/* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Cyrille de Lambert <info@auguria.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 <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/ajaxcompanies.php
* \brief File to return Ajax response on third parties request
*/
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
require '../../main.inc.php';
/*
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
dol_syslog(join(',', $_GET));
// Generation liste des societes
if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) {
$return_arr = array();
// Define filter on text typed
$socid = $_GET['newcompany'] ? $_GET['newcompany'] : '';
if (!$socid) $socid = $_GET['socid'] ? $_GET['socid'] : '';
if (!$socid) $socid = $_GET['id_fourn'] ? $_GET['id_fourn'] : '';
$sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.client, s.fournisseur, s.datec, s.logo";
$sql .= " , c.label as country, d.nom as departement";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON d.rowid = s.fk_departement";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
if ($socid) {
$sql .= " AND (";
// Add criteria on name/code
if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index
$sql .= "s.nom LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '".$db->escape($socid)."%'";
} else {
$sql .= "s.nom LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_client LIKE '%".$db->escape($socid)."%'";
$sql .= " OR s.code_fournisseur LIKE '%".$db->escape($socid)."%'";
}
if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) $sql .= " OR s.rowid = '".$db->escape($socid)."'";
$sql .= ")";
}
//if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters
$sql .= " ORDER BY s.nom ASC";
//dol_syslog("ajaxcompanies", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
while ($row = $db->fetch_array($resql)) {
$label = $row['nom'];
if ($socid) $label = $label;
$row_array['label'] = $label;
$row_array['value'] = $row['nom'];
$row_array['key'] = $row['rowid'];
$row_array['name_alias'] = $row['name_alias'];
$row_array['code_client'] = $row['code_client'];
$row_array['code_fournisseur'] = $row['code_fournisseur'];
$row_array['address'] = $row['address'];
$row_array['zip'] = $row['zip'];
$row_array['town'] = $row['town'];
$row_array['email'] = $row['email'];
$row_array['siren'] = $row['siren'];
$row_array['siret'] = $row['siret'];
$row_array['ape'] = $row['ape'];
$row_array['idprof4'] = $row['idprof4'];
$row_array['client'] = $row['client'];
$row_array['fournisseur'] = $row['fournisseur'];
$row_array['datec'] = $row['datec'];
$row_array['logo'] = $row['logo'];
$row_array['country'] = $row['country'];
$row_array['departement'] = $row['departement'];
array_push($return_arr, $row_array);
}
echo json_encode($return_arr);
} else {
echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error'));
}
} else {
echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter'));
}

View File

@ -129,8 +129,12 @@ if ($action == "importSignature") {
$pdf->AddPage();
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf"); // original PDF
$tppl = $pdf->importPage(1);
$pdf->useTemplate($tppl);
for ($i=1;$i<($pagecount+1);$i++) {
if ($i>1) $pdf->AddPage();
$tppl=$pdf->importPage($i);
$pdf->useTemplate($tppl);
}
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15); // FIXME Position will be wrong with non A4 format. Use a value from width and height of page minus relative offset.
$pdf->Close();
$pdf->Output($newpdffilename, "F");

View File

@ -329,7 +329,7 @@ class box_activity extends ModeleBoxes
if (!empty($data)) {
$j = 0;
while ($j < count($data)) {
$billurl = "search_status=2&amp;paye=1&amp;year=".$data[$j]->annee;
$billurl = "search_status=2&amp;paye=1";
$this->info_box_contents[$line][0] = array(
'td' => 'class="left" width="16"',
'tooltip' => $langs->trans('Bills').'&nbsp;'.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
@ -339,7 +339,7 @@ class box_activity extends ModeleBoxes
$this->info_box_contents[$line][1] = array(
'td' => '',
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
'text' => $langs->trans("Bills")."&nbsp;".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
);
$this->info_box_contents[$line][2] = array(

View File

@ -597,7 +597,7 @@ class CMailFile
}
$sendingmode = $this->sendmode;
if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';

View File

@ -742,17 +742,17 @@ abstract class CommonInvoice extends CommonObject
if ($row[0] == 0) {
$now = dol_now();
$totalpaye = $this->getSommePaiement();
$totalpaid = $this->getSommePaiement();
$totalcreditnotes = $this->getSumCreditNotesUsed();
$totaldeposits = $this->getSumDepositsUsed();
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
//print "totalpaid=".$totalpaid." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
// We can also use bcadd to avoid pb with floating points
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($this->total_ttc,$totalpaid,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
if (empty($amount)) {
$amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
$amount = price2num($this->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
}
if (is_numeric($amount) && $amount != 0) {
@ -848,7 +848,7 @@ abstract class CommonInvoice extends CommonObject
*/
public function buildZATCAQRString()
{
global $conf;
global $conf, $mysoc;
$tmplang = new Translate('', $conf);
$tmplang->setDefaultLang('en_US');
@ -885,8 +885,8 @@ abstract class CommonInvoice extends CommonObject
*/
// Using TLV format
$s = pack('C1', 1).pack('C1', strlen($this->thirdparty->name)).$this->thirdparty->name;
$s .= pack('C1', 2).pack('C1', strlen($this->thirdparty->tva_intra)).$this->thirdparty->tva_intra;
$s = pack('C1', 1).pack('C1', strlen($mysoc->name)).$mysoc->name;
$s .= pack('C1', 2).pack('C1', strlen($mysoc->tva_intra)).$mysoc->tva_intra;
$s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring;
$s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring;
$s .= pack('C1', 5).pack('C1', strlen($pricetaxstring)).$pricetaxstring;

View File

@ -116,7 +116,7 @@ abstract class CommonObject
public $array_languages = null; // Value is array() when load already tried
/**
* @var array To sotre result of ->liste_contact()
* @var array To store result of ->liste_contact()
*/
public $contacts_ids;
@ -4889,7 +4889,7 @@ abstract class CommonObject
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook
$text = $product_static->getNomUrl(1);
@ -4925,7 +4925,7 @@ abstract class CommonObject
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
}
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
$line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
@ -6847,7 +6847,7 @@ abstract class CommonObject
if ((string) $key == '') {
continue;
}
list($val, $parent) = explode('|', $val);
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
$out .= '<option value="'.$key.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
@ -8819,7 +8819,7 @@ abstract class CommonObject
}
}
} else {
$this->{$field} = $obj->{$field};
$this->{$field} = !empty($obj->{$field}) ? $obj->{$field} : null;
}
}

View File

@ -51,6 +51,12 @@ class Cstate // extends CommonObject
public $code_departement;
public $code;
/**
* @var string name
*/
public $name = '';
/**
* @var string
* @deprecated
@ -58,10 +64,7 @@ class Cstate // extends CommonObject
*/
public $nom = '';
/**
* @var string name
*/
public $name = '';
public $label;
public $active;
@ -88,7 +91,6 @@ class Cstate // extends CommonObject
*/
public function create($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
// Clean parameters
@ -155,7 +157,6 @@ class Cstate // extends CommonObject
*/
public function fetch($id, $code = '')
{
global $langs;
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.code_departement,";

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2022 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -216,7 +216,7 @@ class FileUpload
/**
* Set delete url
*
* @param string $file Filename
* @param object $file Filename
* @return void
*/
protected function setFileDeleteUrl($file)
@ -301,7 +301,7 @@ class FileUpload
* Enter description here ...
*
* @param string $uploaded_file Uploade file
* @param string $file File
* @param object $file File
* @param string $error Error
* @param string $index Index
* @return boolean True if OK, False if KO
@ -538,7 +538,7 @@ class FileUpload
/**
* Delete uploaded file
*
* @return void
* @return string
*/
public function delete()
{

View File

@ -1279,7 +1279,6 @@ class Form
// mode 1
$urloption = 'htmlname='.urlencode(str_replace('.', '_', $htmlname)).'&outjson=1&filter='.urlencode($filter).(empty($excludeids) ? '' : '&excludeids='.join(',', $excludeids)).($showtype ? '&showtype='.urlencode($showtype) : '');
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out .= '<style type="text/css">.ui-autocomplete { z-index: 1003; }</style>';
if (empty($hidelabel)) {
@ -1294,6 +1293,8 @@ class Form
if ($hidelabel == 3) {
$out .= img_picto($langs->trans("Search"), 'search');
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
} else {
// Immediate load of all database
$out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids);
@ -3508,7 +3509,7 @@ class Form
$opt .= ' disabled';
}
if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'"';
$opt .= ' data-product-id="'.$objp->rowid.'" data-price-id="'.$objp->idprodfournprice.'" data-qty="'.$objp->quantity.'" data-up="'.$objp->unitprice.'" data-discount="'.$outdiscount.'" data-tvatx="'.$objp->tva_tx.'"';
}
$opt .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
$opt .= ' data-html="'.dol_escape_htmltag($optlabel).'"';
@ -8629,10 +8630,26 @@ class Form
}
$possiblelinks = array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'propal'=>array(
'enabled'=>$conf->propal->enabled,
'perms'=>1,
'label'=>'LinkToProposal',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array(
'enabled'=>$conf->commande->enabled,
'perms'=>1,
'label'=>'LinkToOrder',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array(
'enabled'=>$conf->facture->enabled,
'perms'=>1,
'label'=>'LinkToInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'invoice_template'=>array(
'enabled'=>$conf->facture->enabled,
'perms'=>1,
'label'=>'LinkToTemplateInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
'contrat'=>array(
'enabled'=>$conf->contrat->enabled,
'perms'=>1,
@ -8640,12 +8657,35 @@ class Form
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht
FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."contrat as t, ".$this->db->prefix()."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
),
'fichinter'=>array('enabled'=>!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMo', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
'fichinter'=>array(
'enabled'=>(!empty($conf->ficheinter->enabled) ? $conf->ficheinter->enabled : 0),
'perms'=>1,
'label'=>'LinkToIntervention',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
'supplier_proposal'=>array(
'enabled'=>(!empty($conf->supplier_proposal->enabled) ? $conf->supplier_proposal->enabled : 0),
'perms'=>1,
'label'=>'LinkToSupplierProposal',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
'order_supplier'=>array(
'enabled'=>(!empty($conf->supplier_order->enabled) ? $conf->supplier_order->enabled : 0),
'perms'=>1,
'label'=>'LinkToSupplierOrder',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
'invoice_supplier'=>array(
'enabled'=>(!empty($conf->supplier_invoice->enabled) ? $conf->supplier_invoice->enabled : 0),
'perms'=>1, 'label'=>'LinkToSupplierInvoice',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'),
'ticket'=>array(
'enabled'=>(!empty($conf->ticket->enabled) ? $conf->ticket->enabled : 0),
'perms'=>1,
'label'=>'LinkToTicket',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'),
'mo'=>array(
'enabled'=>(!empty($conf->mrp->enabled) ? $conf->mrp->enabled : 0),
'perms'=>1,
'label'=>'LinkToMo',
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".$this->db->prefix()."societe as s INNER JOIN ".$this->db->prefix()."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')')
);
}
@ -9396,7 +9436,6 @@ class Form
if ($resql) {
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
@ -9438,6 +9477,8 @@ class Form
$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
}
$out .= '</select>';
$out .= ajax_combobox($htmlname);
} else {
dol_print_error($this->db);
}

View File

@ -1330,7 +1330,7 @@ class FormFile
if ($file['name'] != '.'
&& $file['name'] != '..'
&& !preg_match('/\.meta$/i', $file['name'])) {
if ($filearray[$key]['rowid'] > 0) {
if (array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) {
$lastrowid = $filearray[$key]['rowid'];
}
$filepath = $relativepath.$file['name'];
@ -1339,8 +1339,9 @@ class FormFile
$nboflines++;
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
// Do we have entry into database ?
print '<!-- In database: position='.$filearray[$key]['position'].' -->'."\n";
print '<tr class="oddeven" id="row-'.($filearray[$key]['rowid'] > 0 ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
print '<!-- In database: position='.(array_key_exists('position', $filearray[$key]) ? $filearray[$key]['position'] : 0).' -->'."\n";
print '<tr class="oddeven" id="row-'.((array_key_exists('rowid', $filearray[$key]) && $filearray[$key]['rowid'] > 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1)).'">';
// File name
print '<td class="minwith200 tdoverflowmax500">';

View File

@ -191,14 +191,9 @@ class FormProjets
$resql = $this->db->query($sql);
if ($resql) {
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
$out .= $comboenhancement;
$morecss .= ' minwidth100';
}
if (empty($option_only)) {
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlid.'" name="'.$htmlname.'">';
}
@ -284,6 +279,15 @@ class FormProjets
if (empty($option_only)) {
$out .= '</select>';
}
// Use select2 selector
if (!empty($conf->use_javascript_ajax)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
$out .= $comboenhancement;
$morecss .= ' minwidth100';
}
if (empty($nooutput)) {
print $out;
return '';

View File

@ -240,10 +240,24 @@ class FormSetup
* saveConfFromPost
*
* @param bool $noMessageInUpdate display event message on errors and success
* @return void|null
* @return int -1 if KO, 1 if OK
*/
public function saveConfFromPost($noMessageInUpdate = false)
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (empty($this->items)) {
return null;
}
@ -265,11 +279,13 @@ class FormSetup
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupSaved"), null);
}
return 1;
} else {
$this->db->rollback();
if (empty($noMessageInUpdate)) {
setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
}
return -1;
}
}
@ -406,7 +422,7 @@ class FormSetup
if (!array($this->items)) { return false; }
foreach ($this->items as $item) {
$item->reloadValueFromConf();
$item->loadValueFromConf();
}
return true;
@ -571,8 +587,11 @@ class FormSetupItem
/** @var string $fieldValue */
public $fieldValue;
/** @var string $defaultFieldValue */
public $defaultFieldValue = null;
/** @var array $fieldAttr fields attribute only for compatible fields like input text */
public $fieldAttr;
public $fieldAttr = array();
/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
public $fieldOverride = false;
@ -632,17 +651,33 @@ class FormSetupItem
$this->entity = $conf->entity;
$this->confKey = $confKey;
$this->fieldValue = $conf->global->{$this->confKey};
$this->loadValueFromConf();
}
/**
* reload conf value from databases
* @return null
* load conf value from databases
* @return bool
*/
public function loadValueFromConf()
{
global $conf;
if (isset($conf->global->{$this->confKey})) {
$this->fieldValue = $conf->global->{$this->confKey};
return true;
} else {
$this->fieldValue = null;
return false;
}
}
/**
* reload conf value from databases is an aliase of loadValueFromConf
* @deprecated
* @return bool
*/
public function reloadValueFromConf()
{
global $conf;
$this->fieldValue = $conf->global->{$this->confKey};
return $this->loadValueFromConf();
}
@ -652,8 +687,22 @@ class FormSetupItem
*/
public function saveConfValue()
{
global $hookmanager;
$parameters = array();
$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->setErrors($hookmanager->errors);
return -1;
}
if ($reshook > 0) {
return $reshook;
}
if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
return call_user_func($this->saveCallBack);
return call_user_func($this->saveCallBack, $this);
}
// Modify constant only if key was posted (avoid resetting key to the null value)
@ -761,6 +810,12 @@ class FormSetupItem
return $this->fieldInputOverride;
}
// Set default value
if (is_null($this->fieldValue)) {
$this->fieldValue = $this->defaultFieldValue;
}
$this->fieldAttr['name'] = $this->confKey;
$this->fieldAttr['id'] = 'setup-'.$this->confKey;
$this->fieldAttr['value'] = $this->fieldValue;
@ -777,6 +832,8 @@ class FormSetupItem
$out.= $this->generateInputFieldTextarea();
} elseif ($this->type== 'html') {
$out.= $this->generateInputFieldHtml();
} elseif ($this->type== 'color') {
$out.= $this->generateInputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@ -795,14 +852,22 @@ class FormSetupItem
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} else {
if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
$out.= '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
$out.= $this->generateInputFieldText();
}
return $out;
}
/**
* generatec default input field
* @return string
*/
public function generateInputFieldText()
{
if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
}
/**
* generate input field for textarea
* @return string
@ -999,6 +1064,8 @@ class FormSetupItem
$out.= $this->generateOutputFieldSelect();
} elseif ($this->type== 'html') {
$out.= $this->fieldValue;
} elseif ($this->type== 'color') {
$out.= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
$out.= ajax_constantonoff($this->confKey);
} elseif (preg_match('/emailtemplate:/', $this->type)) {
@ -1013,6 +1080,7 @@ class FormSetupItem
}
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$result = $c->fetch($this->fieldValue);
if ($result < 0) {
@ -1071,6 +1139,22 @@ class FormSetupItem
return $outPut;
}
/**
* @return string
*/
public function generateOutputFieldColor()
{
$this->fieldAttr['disabled']=null;
return $this->generateInputField();
}
/**
* @return string
*/
public function generateInputFieldColor()
{
$this->fieldAttr['type']= 'color';
return $this->generateInputFieldText();
}
/**
* @return string
@ -1099,6 +1183,16 @@ class FormSetupItem
return $this;
}
/**
* Set type of input as color
* @return self
*/
public function setAsColor()
{
$this->type = 'color';
return $this;
}
/**
* Set type of input as textarea
* @return self

View File

@ -1274,7 +1274,7 @@ class FormTicket
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) {
$this->add_attached_files($file, basename($file), dol_mimetype($file));
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
}
}
}

View File

@ -71,25 +71,24 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if ($canedit) {
print '<div class="divsearchfield">';
// Type
$multiselect = 0;
if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list"
$multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE));
}
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500');
print img_picto($langs->trans("ActionType"), 'square', 'class="pictofixedwidth inline-block" style="color: #ddd;"');
print $formactions->select_type_actions($actioncode, "search_actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 0, $multiselect, 0, 'maxwidth500 widthcentpercentminusx');
print '</div>';
// Assigned to user
print '<div class="divsearchfield">';
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="pictofixedwidth inline-block"');
print $form->select_dolusers($filtert, 'search_filtert', 1, '', !$canedit, '', '', 0, 0, 0, '', 0, '', 'minwidth150 maxwidth500 widthcentpercentminusxx');
print '</div>';
// Assigned to user group
print '<div class="divsearchfield">';
print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("ToUserOfGroup"), 'object_group', 'class="pictofixedwidth inline-block"');
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', !$canedit, '', '', '0', false, 'minwidth100 maxwidth500 widthcentpercentminusxx');
print '</div>';
@ -99,7 +98,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
// Resource
print '<div class="divsearchfield">';
print img_picto($langs->trans("Resource"), 'object_resource', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("Resource"), 'object_resource', 'class="pictofixedwidth inline-block"');
print $formresource->select_resource_list($resourceid, "search_resourceid", '', 1, 0, 0, null, '', 2, 0, 'maxwidth500');
print '</div>';
}
@ -107,7 +106,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
print '<div class="divsearchfield">';
print img_picto($langs->trans("ThirdParty"), 'company', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("ThirdParty"), 'company', 'class="pictofixedwidth inline-block"');
print $form->select_company($socid, 'search_socid', '', '&nbsp;', 0, 0, null, 0, 'minwidth100 maxwidth500');
print '</div>';
}
@ -117,7 +116,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
$formproject = new FormProjets($db);
print '<div class="divsearchfield">';
print img_picto($langs->trans("Project"), 'project', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth inline-block"');
print $formproject->select_projects($socid ? $socid : -1, $pid, 'search_projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500');
print '</div>';
}
@ -125,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
if ($canedit && !preg_match('/list/', $_SERVER["PHP_SELF"])) {
// Status
print '<div class="divsearchfield">';
print img_picto($langs->trans("Status"), 'setup', 'class="fawidth30 inline-block"');
print img_picto($langs->trans("Status"), 'setup', 'class="pictofixedwidth inline-block"');
$formactions->form_select_status_action('formaction', $status, 1, 'search_status', 1, 2, 'minwidth100');
print '</div>';
}

View File

@ -272,7 +272,8 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
"cover" => $obj->cover,
"position" => (int) $obj->position,
"acl" => $obj->acl,
"share" => $obj->share
"share" => $obj->share,
"description" => $obj->description
);
}
$i++;
@ -2801,7 +2802,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
if ($fuser->societe_id > 0) {
if ($fuser->socid > 0) {
$original_file = $conf->facture->dir_output.'/payments/private/'.$fuser->id.'/'.$original_file;
} else {
$original_file = $conf->facture->dir_output.'/payments/'.$original_file;

View File

@ -2115,9 +2115,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(6, 1).'</span>';
}
} elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva', 'salary'))) {
$tmptxt = $object->getLibStatut(6, $object->totalpaye);
$tmptxt = $object->getLibStatut(6, $object->totalpaid);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5, $object->totalpaye);
$tmptxt = $object->getLibStatut(5, $object->totalpaid);
}
$morehtmlstatus .= $tmptxt;
} elseif ($object->element == 'contrat' || $object->element == 'contract') {
@ -2959,7 +2959,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
} else {
if (!empty($dictsocialnetworks[$type]['url'])) {
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
$htmllink .= '&nbsp;<a href="'.$link.'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
$htmllink .= '&nbsp;<a href="'.dol_sanitizeUrl($link).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
} else {
$htmllink .= dol_escape_htmltag($value);
}

View File

@ -245,246 +245,6 @@ function supplier_invoice_rec_prepare_head($object)
return $head;
}
/**
* Return a HTML table that contains a pie chart of customer invoices
*
* @param int $socid (Optional) Show only results from the customer with this id
* @return string A HTML table that contains a pie chart of customer invoices
*/
function getCustomerInvoicePieChart($socid = 0)
{
global $conf, $db, $langs, $user;
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) {
return '';
}
$sql = "SELECT count(f.rowid), f.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity IN (".getEntity('facture').")";
if ($user->socid) {
$sql .= ' AND f.fk_soc = '.((int) $user->socid);
}
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " GROUP BY f.fk_statut";
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
return '';
}
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$vals = array();
while ($i < $num) {
$row = $db->fetch_row($resql);
if ($row) {
$vals[$row[1]] = $row[0];
$total += $row[0];
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$result = '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder nohover centpercent">';
$result .= '<tr class="liste_titre">';
$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomerInvoice").'</td>';
$result .= '</tr>';
$objectstatic = new Facture($db);
$array = array(Facture::STATUS_DRAFT, Facture::STATUS_VALIDATED, Facture::STATUS_CLOSED, Facture::STATUS_ABANDONED);
$dataseries = array();
foreach ($array as $status) {
$objectstatic->statut = $status;
$objectstatic->paye = $status == Facture::STATUS_CLOSED ? -1 : 0;
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == Facture::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == Facture::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == Facture::STATUS_CLOSED) {
$colorseries[$status] = $badgeStatus9;
}
if ($status == Facture::STATUS_ABANDONED) {
$colorseries[$status] = $badgeStatus6;
}
if (!$conf->use_javascript_ajax) {
$result .= '<tr class="oddeven">';
$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
$result .= '</tr>';
}
}
if ($conf->use_javascript_ajax) {
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphcustomerinvoices');
$result .= '<tr>';
$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
$result .= '</tr>';
}
$result .= '<tr class="liste_total">';
$result .= '<td>'.$langs->trans("Total").'</td>';
$result .= '<td class="right">'.$total.'</td>';
$result .= '</tr>';
$result .= '</table>';
$result .= '</div>';
return $result;
}
/**
* Return a HTML table that contains a pie chart of supplier invoices
*
* @param int $socid (Optional) Show only results from the supplier with this id
* @return string A HTML table that contains a pie chart of supplier invoices
*/
function getPurchaseInvoicePieChart($socid = 0)
{
global $conf, $db, $langs, $user;
if (!((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) {
return '';
}
$sql = "SELECT count(f.rowid), f.fk_statut";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
if ($user->socid) {
$sql .= ' AND f.fk_soc = '.((int) $user->socid);
}
if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " GROUP BY f.fk_statut";
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
return '';
}
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
$vals = array();
while ($i < $num) {
$row = $db->fetch_row($resql);
if ($row) {
$vals[$row[1]] = $row[0];
$total += $row[0];
}
$i++;
}
$db->free($resql);
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
$result = '<div class="div-table-responsive-no-min">';
$result .= '<table class="noborder nohover centpercent">';
$result .= '<tr class="liste_titre">';
$result .= '<td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SupplierInvoice").'</td>';
$result .= '</tr>';
$objectstatic = new FactureFournisseur($db);
$array = array(FactureFournisseur::STATUS_DRAFT, FactureFournisseur::STATUS_VALIDATED, FactureFournisseur::STATUS_CLOSED, FactureFournisseur::STATUS_ABANDONED);
$dataseries = array();
foreach ($array as $status) {
$objectstatic->statut = $status;
$objectstatic->paye = $status == FactureFournisseur::STATUS_CLOSED ? -1 : 0;
$dataseries[] = array($objectstatic->getLibStatut(1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
if ($status == FactureFournisseur::STATUS_DRAFT) {
$colorseries[$status] = '-'.$badgeStatus0;
}
if ($status == FactureFournisseur::STATUS_VALIDATED) {
$colorseries[$status] = $badgeStatus1;
}
if ($status == FactureFournisseur::STATUS_CLOSED) {
$colorseries[$status] = $badgeStatus9;
}
if ($status == FactureFournisseur::STATUS_ABANDONED) {
$colorseries[$status] = $badgeStatus6;
}
if (!$conf->use_javascript_ajax) {
$result .= '<tr class="oddeven">';
$result .= '<td>'.$objectstatic->getLibStatut(0).'</td>';
$result .= '<td class="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status]) ? $vals[$status] : 0).'</a></td>';
$result .= '</tr>';
}
}
if ($conf->use_javascript_ajax) {
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']);
$dolgraph->setHeight('150');
$dolgraph->setWidth('300');
$dolgraph->draw('idgraphpurchaseinvoices');
$result .= '<tr>';
$result .= '<td align="center" colspan="2">'.$dolgraph->show($total ? 0 : 1).'</td>';
$result .= '</tr>';
}
$result .= '<tr class="liste_total">';
$result .= '<td>'.$langs->trans("Total").'</td>';
$result .= '<td class="right">'.$total.'</td>';
$result .= '</tr>';
$result .= '</table>';
$result .= '</div>';
return $result;
}
/**
* Return an HTML table that contains a pie chart of the number of customers or supplier invoices
*

View File

@ -128,46 +128,46 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert .= " 'position'=>".($val['position'] !== '' ? $val['position'] : 50).",";
$texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).",";
$texttoinsert .= " 'visible'=>".($val['visible'] !== '' ? $val['visible'] : -1).",";
if ($val['noteditable']) {
if (!empty($val['noteditable'])) {
$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
}
if ($val['default'] || $val['default'] === '0') {
if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) {
$texttoinsert .= " 'default'=>'".$val['default']."',";
}
if ($val['index']) {
if (!empty($val['index'])) {
$texttoinsert .= " 'index'=>".$val['index'].",";
}
if ($val['foreignkey']) {
if (!empty($val['foreignkey'])) {
$texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',";
}
if ($val['searchall']) {
if (!empty($val['searchall'])) {
$texttoinsert .= " 'searchall'=>".$val['searchall'].",";
}
if ($val['isameasure']) {
if (!empty($val['isameasure'])) {
$texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',";
}
if ($val['css']) {
if (!empty($val['css'])) {
$texttoinsert .= " 'css'=>'".$val['css']."',";
}
if ($val['cssview']) {
if (!empty($val['cssview'])) {
$texttoinsert .= " 'cssview'=>'".$val['cssview']."',";
}
if ($val['csslist']) {
if (!empty($val['csslist'])) {
$texttoinsert .= " 'csslist'=>'".$val['csslist']."',";
}
if ($val['help']) {
if (!empty($val['help'])) {
$texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
}
if ($val['showoncombobox']) {
if (!empty($val['showoncombobox'])) {
$texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',";
}
if ($val['disabled']) {
if (!empty($val['disabled'])) {
$texttoinsert .= " 'disabled'=>'".$val['disabled']."',";
}
if ($val['autofocusoncreate']) {
if (!empty($val['autofocusoncreate'])) {
$texttoinsert .= " 'autofocusoncreate'=>'".$val['autofocusoncreate']."',";
}
if ($val['arrayofkeyval']) {
if (!empty($val['arrayofkeyval'])) {
$texttoinsert .= " 'arrayofkeyval'=>array(";
$i = 0;
foreach ($val['arrayofkeyval'] as $key2 => $val2) {
@ -179,10 +179,10 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
}
$texttoinsert .= "),";
}
if ($val['validate']) {
if (!empty($val['validate'])) {
$texttoinsert .= " 'validate'=>'".$val['validate']."',";
}
if ($val['comment']) {
if (!empty($val['comment'])) {
$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
}
@ -314,7 +314,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($key == 'entity') {
$texttoinsert .= ' DEFAULT 1';
} else {
if ($val['default'] != '') {
if (!empty($val['default'])) {
if (preg_match('/^null$/i', $val['default'])) {
$texttoinsert .= " DEFAULT NULL";
} elseif (preg_match('/varchar/', $type)) {

View File

@ -971,13 +971,15 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
* @param Societe $fromcompany Object company
* @param int $marge_basse Margin bottom we use for the autobreak
* @param int $marge_gauche Margin left (no more used)
* @param int $page_hauteur Page height (no more used)
* @param int $page_hauteur Page height
* @param Object $object Object shown in PDF
* @param int $showdetails Show company adress details into footer (0=Nothing, 1=Show address, 2=Show managers, 3=Both)
* @param int $hidefreetext 1=Hide free text, 0=Show free text
* @param int $page_largeur Page width
* @param int $watermark Watermark text to print on page
* @return int Return height of bottom margin including footer text
*/
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0)
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark = '')
{
global $conf, $user, $mysoc, $hookmanager;
@ -1275,6 +1277,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
}
// Show Draft Watermark
if (!empty($watermark)) {
pdf_watermark($pdf, $outputlangs, $page_hauteur, $page_largeur, 'mm', $watermark);
}
return $marginwithfooter;
}

View File

@ -450,26 +450,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
}
// Show logo
if ($foruserprofile) {
// Nothing
} else {
// Show logo
print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td><td>';
if ($edit) {
print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
//print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
} else {
print yn($conf->global->MAIN_SHOW_LOGO);
}
print '</td>';
print '</tr>';
/*
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
print "</tr>";*/
}
// TopMenuDisableImages
if ($foruserprofile) {
/*
@ -493,26 +473,51 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';*/
} else {
$default = $langs->trans('No');
$listoftopmenumodes = array(
'0' => $langs->transnoentitiesnoconv("IconAndText"),
'1' => $langs->transnoentitiesnoconv("TextOnly"),
'2' => $langs->transnoentitiesnoconv("IconOnlyAllTextsOnHover"),
'3' => $langs->transnoentitiesnoconv("IconOnlyTextOnHover"),
'4' => $langs->transnoentitiesnoconv("IconOnly"),
);
print '<tr class="oddeven">';
print '<td>'.$langs->trans("TopMenuDisableImages").'</td>';
print '<td colspan="'.($colspan - 1).'">';
if ($edit) {
print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
//print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1);
//print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1);
print $form->selectarray('THEME_TOPMENU_DISABLE_IMAGE', $listoftopmenumodes, $conf->global->THEME_TOPMENU_DISABLE_IMAGE);
} else {
print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
$listoftopmenumodes[$conf->global->THEME_TOPMENU_DISABLE_IMAGE];
//print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE);
}
print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
print '</td>';
print '</tr>';
}
// Show logo
if ($foruserprofile) {
// Nothing
} else {
// Show logo
print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("EnableShowLogo").'</td><td>';
if ($edit) {
print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1);
//print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1);
} else {
print yn($conf->global->MAIN_SHOW_LOGO);
}
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
print '</td>';
print '</tr>';
/*
print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
print "</tr>";*/
}
// BorderTableActive
if ($foruserprofile) {
} else {
$default = $langs->trans('No');
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseBorderOnTable").'</td>';
print '<td colspan="'.($colspan - 1).'">';
@ -522,8 +527,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
} else {
print yn($conf->global->THEME_ELDY_USEBORDERONTABLE);
}
print ' &nbsp; <span class="nowraponall opacitymedium">'.$langs->trans("Default").'</span>: <strong>'.$default.'</strong> ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes"));
print '</td>';
print '</tr>';
}

View File

@ -365,9 +365,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
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->asset->enabled', __HANDLER__, 'left', 3000__+MAX_llx_menu__, 'accountancy', 'asset', 9__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&amp;leftmenu=asset', 'MenuAssets', 1, 'assets', '$user->rights->asset->read', '', 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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3001__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/card.php?mainmenu=accountancy&amp;leftmenu=asset&amp;action=create', 'MenuNewAsset', 2, 'assets', '$user->rights->asset->write', '', 0, 21, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3003__+MAX_llx_menu__, 'asset', '', 3000__+MAX_llx_menu__, '/asset/list.php?mainmenu=accountancy&amp;leftmenu=asset', 'MenuListAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 22, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&amp;leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '$user->rights->asset->read', '', 0, 23, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&amp;action=create', 'MenuNewTypeAssets', 3, 'assets', '$user->rights->asset->setup_advance', '', 0, 24, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '$user->rights->asset->read', '', 0, 25, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3004__+MAX_llx_menu__, 'asset', 'asset_type', 3000__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&amp;leftmenu=asset', 'MenuTypeAssets', 2, 'assets', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->asset->model_advance->read:$user->rights->asset->read)', '', 0, 23, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3005__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy&amp;action=create', 'MenuNewTypeAssets', 3, 'assets', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->asset->model_advance->write:$user->rights->asset->write)', '', 0, 24, __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->asset->enabled && $leftmenu=="asset"', __HANDLER__, 'left', 3006__+MAX_llx_menu__, 'asset', '', 3004__+MAX_llx_menu__, '/asset/type.php?mainmenu=accountancy', 'MenuListTypeAssets', 3, 'assets', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->asset->model_advance->read:$user->rights->asset->read)', '', 0, 25, __ENTITY__);
-- Check deposit
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?mainmenu=bank&amp;leftmenu=checks', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);

View File

@ -1879,10 +1879,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/asset/card.php?leftmenu=asset&amp;action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)), '', $mainmenu, 'asset_model');
$newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)), '', $mainmenu, 'asset_model');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) {
$newmenu->add("/asset/model/card.php?leftmenu=asset_model&amp;action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->write)));
$newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->setup_advance->read)));
$newmenu->add("/asset/model/card.php?leftmenu=asset_model&amp;action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write)));
$newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)));
}
}
}

View File

@ -1465,6 +1465,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if ($command) {
$sql .= " AND command = '".$this->db->escape($command)."'";
}
if ($parameters) {
$sql .= " AND params = '".$this->db->escape($parameters)."'";
}
$sql .= " AND entity = ".((int) $entity); // Must be exact entity
$now = dol_now();

View File

@ -133,7 +133,7 @@ class CommActionRapport
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products"));
$dir = $conf->agenda->dir_temp."/";
$file = $dir."actions-".$this->month."-".$this->year.".pdf";
$file = $dir."actions-".sprintf("%02d", $this->month)."-".sprintf("%04d", $this->year).".pdf";
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {

View File

@ -163,6 +163,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->watermark = '';
// Get source company
$this->emetteur = $mysoc;
@ -235,6 +236,11 @@ class pdf_einstein extends ModelePDFCommandes
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
// Show Draft Watermark
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) {
$this->watermark = $conf->global->COMMANDE_DRAFT_WATERMARK;
}
global $outputlangsbis;
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
@ -1284,11 +1290,6 @@ class pdf_einstein extends ModelePDFCommandes
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1533,6 +1534,6 @@ class pdf_einstein extends ModelePDFCommandes
// phpcs:enable
global $conf;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
}
}

View File

@ -168,6 +168,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->watermark = '';
// Get source company
$this->emetteur = $mysoc;
@ -219,6 +220,11 @@ class pdf_eratosthene extends ModelePDFCommandes
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
// Show Draft Watermark
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) {
$this->watermark = $conf->global->COMMANDE_DRAFT_WATERMARK;
}
global $outputlangsbis;
$outputlangsbis = null;
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && $outputlangs->defaultlang != $conf->global->PDF_USE_ALSO_LANGUAGE_CODE) {
@ -1451,11 +1457,6 @@ class pdf_eratosthene extends ModelePDFCommandes
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size + 3);
@ -1718,7 +1719,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// phpcs:enable
global $conf;
$showdetails = empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS) ? 0 : $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext, $this->page_largeur, $this->watermark);
}

Some files were not shown because too many files have changed in this diff Show More