Merge remote-tracking branch 'upstream/develop' into 16a12_assets_sql

This commit is contained in:
Alexandre SPANGARO 2022-05-22 05:53:23 +02:00
commit 709208abfb
58 changed files with 764 additions and 381 deletions

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

@ -122,12 +122,10 @@ class AdherentType extends CommonObject
public $members = array();
/** @var string string other */
public $other;
public $other = array();
public $multilangs = array();
public $other = array();
/**
* Constructor

View File

@ -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

@ -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

@ -129,6 +129,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

@ -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',

View File

@ -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

@ -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

@ -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

@ -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

@ -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
@ -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 = $totalpaye; // 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

@ -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++;
@ -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

@ -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);
@ -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 = $totalpaye; // 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

@ -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 = $totalpaye; // 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
@ -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 = $totalpaye; // 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)),
@ -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
@ -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 = $totalpaye; // 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

@ -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 = $totalpaye; // 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, '', '');

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

@ -113,6 +113,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_user;
/**
* @var double total
*/
public $total;
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

@ -96,6 +96,21 @@ class PaymentVAT 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

@ -49,6 +49,12 @@ class Tva extends CommonObject
*/
public $picto = 'payment';
/**
* @deprecated
* @see $amount
*/
public $total;
public $tms;
public $datep;
public $datev;
@ -81,6 +87,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

@ -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;
@ -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

@ -8629,10 +8629,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 +8656,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').')')
);
}

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,8 @@ 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) : 0) ? $filearray[$key]['rowid'] : 'AFTER'.$lastrowid.'POS'.($i + 1).'">';
// File name
print '<td class="minwith200 tdoverflowmax500">';

View File

@ -422,7 +422,7 @@ class FormSetup
if (!array($this->items)) { return false; }
foreach ($this->items as $item) {
$item->reloadValueFromConf();
$item->loadValueFromConf();
}
return true;
@ -587,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;
@ -648,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();
}
@ -791,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;
@ -807,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)) {
@ -825,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
@ -1029,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)) {
@ -1102,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
@ -1130,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

@ -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++;

View File

@ -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

@ -612,6 +612,14 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R');
if (!empty($object->ref_client)) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer") . " : " . dol_trunc($outputlangs->convToOutputCharset($object->ref_client), 65), '', 'R');
}
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);

View File

@ -709,15 +709,37 @@ class ImportCsv extends ModeleImports
}
// Define $listfields and $listvalues to build SQL request
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) {
$listvalues[] = "''";
if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) {
if (!in_array("socialnetworks", $listfields)) {
$listfields[] = "socialnetworks";
}
if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) {
$socialkey = array_search("socialnetworks", $listfields);
if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
$socialnetwork = explode("_", $fieldname)[1];
$json = new stdClass();
$json->$socialnetwork = $newval;
$newvalue = json_encode($json);
$listvalues[$socialkey] = "'".$this->db->escape($newvalue)."'";
} else {
$socialnetwork = explode("_", $fieldname)[1];
$jsondata = $listvalues[$socialkey];
$jsondata = str_replace("'", "", $jsondata);
$json = json_decode($jsondata);
$json->$socialnetwork = $newval;
$listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'";
}
}
} else {
$listvalues[] = "'".$this->db->escape($newval)."'";
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) {
$listvalues[] = "''";
} else {
$listvalues[] = "'".$this->db->escape($newval)."'";
}
}
}
$i++;

View File

@ -363,6 +363,8 @@ class ImportXlsx extends ModeleImports
$warning = 0;
$this->errors = array();
$this->warnings = array();
$this->nbinsert = 0;
$this->nbupdate = 0;
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
@ -750,15 +752,38 @@ class ImportXlsx extends ModeleImports
}
// Define $listfields and $listvalues to build SQL request
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) {
$listvalues[] = "''";
if ($conf->socialnetworks->enabled && strpos($fieldname, "socialnetworks") !== false) {
if (!in_array("socialnetworks", $listfields)) {
$listfields[] = "socialnetworks";
}
if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) {
$socialkey = array_search("socialnetworks", $listfields);
if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
$socialnetwork = explode("_", $fieldname)[1];
$json = new stdClass();
$json->$socialnetwork = $newval;
$newvalue = json_encode($json);
$listvalues[$socialkey] = $newvalue;
} else {
$socialnetwork = explode("_", $fieldname)[1];
$jsondata = $listvalues[$socialkey];
$jsondata = str_replace("'", "", $jsondata);
$json = json_decode($jsondata);
$json->$socialnetwork = $this->db->escape($newval);
$listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'";
}
}
} else {
$listvalues[] = "'" . $this->db->escape($newval) . "'";
$listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key)]['type'] < 0) {
$listvalues[] = ($newval == '0' ? $newval : "null");
} elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) {
$listvalues[] = "''";
} else {
$listvalues[] = "'" . $this->db->escape($newval) . "'";
}
}
}
$i++;

View File

@ -519,6 +519,16 @@ class modSociete extends DolibarrModules
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
}
// Add social networks fields
if (!empty($conf->socialnetworks->enabled)) {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1";
$resql = $this->db->query($sql);
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 's.socialnetworks_'.$obj->code;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel;
}
}
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);
@ -718,6 +728,16 @@ class modSociete extends DolibarrModules
's.note_private' => "NotePrivate",
's.note_public' => "NotePublic"
);
// Add social networks fields
if (!empty($conf->socialnetworks->enabled)) {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_socialnetworks WHERE active = 1";
$resql = $this->db->query($sql);
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 's.socialnetworks_'.$obj->code;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel;
}
}
// Add extra fields
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
$resql = $this->db->query($sql);

View File

@ -145,6 +145,8 @@ class mod_codeproduct_elephant extends ModeleProductCode
*/
public function getExample($langs, $objproduct = 0, $type = -1)
{
$exampleproduct = $exampleservice = '';
if ($type == 0 || $type == -1) {
$exampleproduct = $this->getNextValue($objproduct, 0);
if (!$exampleproduct) {

View File

@ -55,6 +55,7 @@ $langs->loadLangs(array('bills', 'companies', 'interventions', 'stocks'));
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$ref_client = GETPOST('ref_client', 'alpha');
$socid = (int) GETPOST('socid', 'int');
$contratid = (int) GETPOST('contratid', 'int');
$action = GETPOST('action', 'alpha');
@ -222,6 +223,7 @@ if (empty($reshook)) {
$object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref;
$object->ref_client = $ref_client;
$object->model_pdf = GETPOST('model', 'alpha');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
@ -432,6 +434,7 @@ if (empty($reshook)) {
$object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref;
$object->ref_client = $ref_client;
$result = $object->update($user);
if ($result < 0) {
@ -449,6 +452,12 @@ if (empty($reshook)) {
if ($result < 0) {
dol_print_error($db, $object->error);
}
} elseif ($action == 'setref_client' && $user->rights->ficheinter->creer) {
// Positionne ref client
$result = $object->setRefClient($user, GETPOST('ref_client', 'alpha'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->ficheinter->supprimer) {
$result = $object->delete($user);
if ($result < 0) {
@ -879,6 +888,11 @@ if ($action == 'create') {
// Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
// 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 '</tr>';
// Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
@ -1134,10 +1148,10 @@ if ($action == 'create') {
$morehtmlref = '<div class="refidno">';
// Ref customer
//$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', 0, 1);
//$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->fichinter->creer, 'string', '', null, null, '', 1);
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->ficheinter->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
$morehtmlref .= '<br><span class="hideonsmartphone">'.$langs->trans('ThirdParty').' : </span>'.$object->thirdparty->getNomUrl(1, 'customer');
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");

View File

@ -44,6 +44,7 @@ class Fichinter extends CommonObject
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25),
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>36),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>45),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
@ -146,6 +147,12 @@ class Fichinter extends CommonObject
*/
public $fk_project = 0;
/**
* Customer Ref
* @var string
*/
public $ref_client;
/**
* @var array extraparams
*/
@ -253,6 +260,9 @@ class Fichinter extends CommonObject
if (!is_numeric($this->duration)) {
$this->duration = 0;
}
if (isset($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
if ($this->socid <= 0) {
$this->error = 'ErrorFicheinterCompanyDoesNotExist';
@ -271,6 +281,7 @@ class Fichinter extends CommonObject
$sql .= "fk_soc";
$sql .= ", datec";
$sql .= ", ref";
$sql .= ", ref_client";
$sql .= ", entity";
$sql .= ", fk_user_author";
$sql .= ", fk_user_modif";
@ -286,6 +297,7 @@ class Fichinter extends CommonObject
$sql .= $this->socid;
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".((int) $user->id);
$sql .= ", ".((int) $user->id);
@ -372,6 +384,9 @@ class Fichinter extends CommonObject
if (!dol_strlen($this->fk_project)) {
$this->fk_project = 0;
}
if (isset($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
$error = 0;
@ -380,6 +395,7 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
$sql .= "description = '".$this->db->escape($this->description)."'";
$sql .= ", duree = ".((int) $this->duration);
$sql .= ", ref_client = ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null");
$sql .= ", fk_projet = ".((int) $this->fk_project);
$sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
$sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
@ -422,7 +438,7 @@ class Fichinter extends CommonObject
*/
public function fetch($rowid, $ref = '')
{
$sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,";
$sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut,";
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
@ -443,6 +459,7 @@ class Fichinter extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->description = $obj->description;
$this->socid = $obj->fk_soc;
$this->statut = $obj->fk_statut;
@ -1289,6 +1306,7 @@ class Fichinter extends CommonObject
// Initialise parametres
$this->id = 0;
$this->ref = 'SPECIMEN';
$this->ref_client = 'SPECIMEN CLIENT';
$this->specimen = 1;
$this->socid = 1;
$this->datec = $now;
@ -1376,6 +1394,62 @@ class Fichinter extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
/**
* Set customer reference number
*
* @param User $user Object user that modify
* @param string $ref_client Customer reference
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
public function setRefClient($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
if (!empty($user->rights->ficheinter->creer)) {
$error = 0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref_client = ".(empty($ref_client) ? 'NULL' : "'".$this->db->escape($ref_client)."'");
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->error();
$error++;
}
if (!$error) {
$this->oldcopy = clone $this;
$this->ref_client = $ref_client;
}
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('FICHINTER_MODIFY', $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;
} else {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
}
} else {
return -1;
}
}
}
/**

View File

@ -58,6 +58,7 @@ $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'interventionlist';
$search_ref = GETPOST('search_ref') ?GETPOST('search_ref', 'alpha') : GETPOST('search_inter', 'alpha');
$search_ref_client = GETPOST('search_ref_client', 'alpha');
$search_company = GETPOST('search_company', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_projet_ref = GETPOST('search_projet_ref', 'alpha');
@ -122,6 +123,7 @@ if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
// Definition of fields for list
$arrayfields = array(
'f.ref'=>array('label'=>'Ref', 'checked'=>1),
'f.ref_client'=>array('label'=>'RefCustomer', 'checked'=>1),
's.nom'=>array('label'=>'ThirdParty', 'checked'=>1),
'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled) ? 0 : 1)),
'c.ref'=>array('label'=>'Contract', 'checked'=>1, 'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)),
@ -166,6 +168,7 @@ if (empty($reshook)) {
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_ref = "";
$search_ref_client = "";
$search_company = "";
$search_projet_ref = "";
$search_contrat_ref = "";
@ -218,7 +221,7 @@ foreach ($arrayfields as $tmpkey => $tmpval) {
}
$sql = "SELECT";
$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,";
$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
$sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
}
@ -267,6 +270,9 @@ $sql .= " AND f.fk_soc = s.rowid";
if ($search_ref) {
$sql .= natural_search('f.ref', $search_ref);
}
if ($search_ref_client) {
$sql .= natural_search('f.ref_client', $search_ref_client);
}
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
@ -351,6 +357,9 @@ if ($resql) {
if ($search_ref) {
$param .= "&search_ref=".urlencode($search_ref);
}
if ($search_ref_client) {
$param .= "&search_ref_client=".urlencode($search_ref_client);
}
if ($search_company) {
$param .= "&search_company=".urlencode($search_company);
}
@ -447,6 +456,11 @@ if ($resql) {
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
print '</td>';
}
if (!empty($arrayfields['f.ref_client']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_ref_client" value="'.$search_ref_client.'" size="8">';
print '</td>';
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
@ -526,6 +540,9 @@ if ($resql) {
if (!empty($arrayfields['f.ref']['checked'])) {
print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.ref_client']['checked'])) {
print_liste_field_titre($arrayfields['f.ref_client']['label'], $_SERVER["PHP_SELF"], "f.ref_client", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
}
@ -582,6 +599,7 @@ if ($resql) {
$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
$objectstatic->ref_client = $obj->ref_client;
$objectstatic->statut = $obj->status;
$objectstatic->status = $obj->status;
@ -630,6 +648,15 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.ref_client']['checked'])) {
// Customer ref
print '<td class="nowrap tdoverflowmax200">';
print $obj->ref_client;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td>';
print $companystatic->getNomUrl(1, '', 44);

View File

@ -67,6 +67,15 @@ class PaiementFourn extends Paiement
*/
public $type_code;
/**
* @var string Id of prelevement
*/
public $id_prelevement;
/**
* @var string num_prelevement
*/
public $num_prelevement;
/**

View File

@ -720,6 +720,11 @@ if (empty($reshook)) {
//exit;
// Replacement invoice
if (GETPOST('type', 'int') === '') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error++;
}
if (GETPOST('type') == FactureFournisseur::TYPE_REPLACEMENT) {
if (empty($dateinvoice)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('DateInvoice')), null, 'errors');
@ -1974,10 +1979,10 @@ if ($action == 'create') {
$objectsrc->fetch_optionals();
$object->array_options = $objectsrc->array_options;
} else {
$cond_reglement_id = $societe->cond_reglement_supplier_id;
$mode_reglement_id = $societe->mode_reglement_supplier_id;
$transport_mode_id = $societe->transport_mode_supplier_id;
$fk_account = $societe->fk_account;
$cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0;
$mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0;
$transport_mode_id = !empty($societe->transport_mode_supplier_id) ? $societe->transport_mode_supplier_id : 0;
$fk_account = !empty($societe->fk_account) ? $societe->fk_account : 0;
$datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp);
$datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'));
@ -2004,7 +2009,7 @@ if ($action == 'create') {
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
if ($societe->id > 0) {
if (!empty($societe->id) && $societe->id > 0) {
print '<input type="hidden" name="socid" value="'.$societe->id.'">'."\n";
}
print '<input type="hidden" name="origin" value="'.$origin.'">';
@ -2030,12 +2035,12 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans('Supplier').'</td>';
print '<td>';
if ($societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) {
if (!empty($societe->id) && $societe->id > 0 && ($fac_recid <= 0 || !empty($invoice_predefined->frequency))) {
$absolute_discount = $societe->getAvailableDiscounts('', '', 0, 1);
print $societe->getNomUrl(1, 'supplier');
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
} else {
print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
print img_picto('', 'company').$form->select_company(!empty($societe->id) ? $societe->id : 0, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
// reload page to retrieve supplier informations
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
print '<script type="text/javascript">
@ -2123,8 +2128,8 @@ if ($action == 'create') {
}
// Ref supplier
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(GETPOSTISSET('ref_supplier') ? GETPOST('ref_supplier') : $objectsrc->ref_supplier).'" type="text"';
if ($societe->id > 0) {
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(GETPOSTISSET('ref_supplier') ? GETPOST('ref_supplier') : (!empty($objectsrc->ref_supplier) ? $objectsrc->ref_supplier : '')).'" type="text"';
if (!empty($societe->id) && $societe->id > 0) {
print ' autofocus';
}
print '></td>';
@ -2136,7 +2141,7 @@ if ($action == 'create') {
// Standard invoice
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type') == 0 ? ' checked' : '').'> ';
$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int')? '' : 'checked').'> ';
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
print $desc;
print '</div></div>';
@ -2266,7 +2271,7 @@ if ($action == 'create') {
*/
if (empty($origin)) {
if ($societe->id > 0) {
if (!empty($societe->id) && $societe->id > 0) {
// Credit note
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE)) {
// Show link for credit note
@ -2356,7 +2361,7 @@ if ($action == 'create') {
print '</td></tr>';
if ($societe->id > 0) {
if (!empty($societe->id) && $societe->id > 0) {
// Discounts for third party
print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
@ -2406,14 +2411,14 @@ if ($action == 'create') {
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_recid > 0 ? '&fac_rec='.$fac_recid : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.(!empty($soc->id) ? $soc->id : 0).'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.(!empty($soc->id) ? $soc->id : 0).($fac_recid > 0 ? '&fac_rec='.$fac_recid : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td></tr>';
}
// Incoterms
if (!empty($conf->incoterm->enabled)) {
print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).'</label></td>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->select_incoterms(GETPOSTISSET('incoterm_id') ? GETPOST('incoterm_id', 'alphanohtml') : (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), GETPOSTISSET('location_incoterms') ? GETPOST('location_incoterms', 'alphanohtml') : (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : ''));
print '</td></tr>';
@ -2487,7 +2492,7 @@ if ($action == 'create') {
print '</tr>';
if (is_object($objectsrc)) {
if (!empty($objectsrc) && is_object($objectsrc)) {
print "\n<!-- ".$classname." info -->";
print "\n";
print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.'">'."\n";
@ -2549,7 +2554,7 @@ if ($action == 'create') {
print $form->buttonsSaveCancel("CreateDraft");
// Show origin lines
if (is_object($objectsrc)) {
if (!empty($objectsrc) && is_object($objectsrc)) {
print '<br>';
$title = $langs->trans('ProductsAndServices');

View File

@ -440,7 +440,7 @@ if (!file_exists($conffile)) {
if (empty($dolibarr_main_db_host)) { // This means install process was not run
$allowupgrade = false;
}
if (defined("MAIN_NOT_INSTALLED")) {
if (getDolGlobalInt("MAIN_NOT_INSTALLED")) {
$allowupgrade = false;
}
if (GETPOST('allowupgrade')) {

View File

@ -30,10 +30,20 @@
-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences();
ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL;
-- Missing in v15 or lower
-- VMYSQL4.3 ALTER TABLE llx_c_civility CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
ALTER TABLE llx_c_transport_mode ADD UNIQUE INDEX uk_c_transport_mode (code, entity);
ALTER TABLE llx_c_shipment_mode MODIFY COLUMN tracking varchar(255) NULL;
ALTER TABLE llx_holiday ADD COLUMN nb_open_day double(24,8) DEFAULT NULL;
ALTER TABLE llx_element_tag ADD COLUMN fk_categorie INTEGER;
insert into llx_c_type_resource (code, label, active) values ('RES_ROOMS', 'Rooms', 1);
insert into llx_c_type_resource (code, label, active) values ('RES_CARS', 'Cars', 1);
@ -579,4 +589,8 @@ ALTER TABLE llx_c_email_template ADD COLUMN email_to varchar(255);
ALTER TABLE llx_c_email_template ADD COLUMN email_tocc varchar(255);
ALTER TABLE llx_c_email_template ADD COLUMN email_tobcc varchar(255);
ALTER TABLE llx_fichinter ADD COLUMN ref_client varchar(255) after ref_ext;
ALTER TABLE llx_c_holiday_types ADD COLUMN sortorder smallint;
ALTER TABLE llx_expedition MODIFY COLUMN ref_customer varchar(255);

View File

@ -25,6 +25,7 @@ create table llx_fichinter
fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
ref varchar(30) NOT NULL, -- number
ref_ext varchar(255),
ref_client varchar(255), -- customer intervention number
entity integer DEFAULT 1 NOT NULL, -- multi company id
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datec datetime, -- date de creation

View File

@ -164,14 +164,14 @@ ProfId6CL=-
ProfId1CM=Id. prof. 1 (Trade Register)
ProfId2CM=Id. prof. 2 (Taxpayer No.)
ProfId3CM=Id. prof. 3 (Decree of creation)
ProfId4CM=-
ProfId5CM=-
ProfId4CM=Id. prof. 4 (Certificate of deposits)
ProfId5CM=Id. prof. 5 (Others)
ProfId6CM=-
ProfId1ShortCM=Trade Register
ProfId2ShortCM=Taxpayer No.
ProfId3ShortCM=Decree of creation
ProfId4ShortCM=-
ProfId5ShortCM=-
ProfId4ShortCM=Certificate of deposits
ProfId5ShortCM=Others
ProfId6ShortCM=-
ProfId1CO=Prof Id 1 (R.U.T.)
ProfId2CO=-

View File

@ -238,6 +238,33 @@ if ($dirins && $action == 'initmodule' && $modulename) {
}
}
// Copy last html.formsetup.class.php' to backport folder
$tryToCopyFromSetupClass = true;
$backportDest = $destdir .'/backport/v16/core/class';
$backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
$backportFileDest = $backportDest.'/html.formsetup.class.php';
$result = dol_mkdir($backportDest);
if ($result < 0) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCreateDir", $backportDest), null, 'errors');
$tryToCopyFromSetupClass = false;
}
if ($tryToCopyFromSetupClass) {
$result = dol_copy($backportFileSrc, $backportFileDest);
if ($result <= 0) {
if ($result < 0) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyFile", $backportFileSrc, $backportFileDest), null, 'errors');
} else {
setEventMessages($langs->trans("FileDidAlreadyExist", $backportFileDest), null, 'warnings');
}
}
}
if (!empty($conf->global->MODULEBUILDER_USE_ABOUT)) {
dol_delete_file($destdir.'/admin/about.php');
}

View File

@ -78,65 +78,90 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$arrayofparameters = array(
'MYMODULE_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1),
'MYMODULE_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
//'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
//'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
//'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
//'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
//'MYMODULE_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1),
//'MYMODULE_MYPARAM7'=>array('type'=>'product', 'enabled'=>1),
);
$error = 0;
$setupnotempty = 0;
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
$useFormSetup = 0;
// Convert arrayofparameter into a formSetup object
if ($useFormSetup && (float) DOL_VERSION >= 15) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
$formSetup = new FormSetup($db);
$useFormSetup = 1;
// you can use the param convertor
$formSetup->addItemsFromParamsArray($arrayofparameters);
// or use the new system see exemple as follow (or use both because you can ;-) )
/*
// Hôte
$item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
$item->cssClass = 'minwidth500';
// Setup conf MYMODULE_MYPARAM1 as a simple string input
$item = $formSetup->newItem('MYMODULE_MYPARAM1');
// Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
$item->nameText = $item->getNameText().' more html text ';
// Setup conf MYMODULE_MYPARAM3
$item = $formSetup->newItem('MYMODULE_MYPARAM3');
$item->setAsThirdpartyType();
// Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style
$formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo();
// Setup conf MYMODULE_MYPARAM5
$formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty');
// Setup conf MYMODULE_MYPARAM6
$formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled
// Setup conf MYMODULE_MYPARAM7
$formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct();
*/
$setupnotempty = count($formSetup->items);
if (!class_exists('FormSetup')) {
// For retrocompatibility Dolibarr < 16.0
if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) {
require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php';
} else {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
}
}
$formSetup = new FormSetup($db);
// Hôte
$item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
$item->cssClass = 'minwidth500';
// Setup conf MYMODULE_MYPARAM1 as a simple string input
$item = $formSetup->newItem('MYMODULE_MYPARAM1');
$item->defaultFieldValue = 'default value';
// Setup conf MYMODULE_MYPARAM1 as a simple textarea input but we replace the text of field title
$item = $formSetup->newItem('MYMODULE_MYPARAM2');
$item->nameText = $item->getNameText().' more html text ';
// Setup conf MYMODULE_MYPARAM3
$item = $formSetup->newItem('MYMODULE_MYPARAM3');
$item->setAsThirdpartyType();
// Setup conf MYMODULE_MYPARAM4 : exemple of quick define write style
$formSetup->newItem('MYMODULE_MYPARAM4')->setAsYesNo();
// Setup conf MYMODULE_MYPARAM5
$formSetup->newItem('MYMODULE_MYPARAM5')->setAsEmailTemplate('thirdparty');
// Setup conf MYMODULE_MYPARAM6
$formSetup->newItem('MYMODULE_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled
// Setup conf MYMODULE_MYPARAM7
$formSetup->newItem('MYMODULE_MYPARAM7')->setAsProduct();
$formSetup->newItem('Title')->setAsTitle();
// Setup conf MYMODULE_MYPARAM8
$item = $formSetup->newItem('MYMODULE_MYPARAM8');
$TField = array(
'test01' => $langs->trans('test01'),
'test02' => $langs->trans('test02'),
'test03' => $langs->trans('test03'),
'test04' => $langs->trans('test04'),
'test05' => $langs->trans('test05'),
'test06' => $langs->trans('test06'),
);
$item->setAsMultiSelect($TField);
$item->helpText = $langs->transnoentities('MYMODULE_MYPARAM8');
// Setup conf MYMODULE_MYPARAM9
$formSetup->newItem('MYMODULE_MYPARAM9')->setAsSelect($TField);
// Setup conf MYMODULE_MYPARAM10
$item = $formSetup->newItem('MYMODULE_MYPARAM10');
$item->setAsColor();
$item->defaultFieldValue = '#FF0000';
$item->nameText = $item->getNameText().' more html text ';
$item->fieldInputOverride = '';
$item->helpText = $langs->transnoentities('AnHelpMessage');
//$item->fieldValue = '';
//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
//$item->fieldInputOverride = false; // set this var to override field input
//$item->fieldOutputOverride = false; // set this var to override field output
$setupnotempty =+ count($formSetup->items);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
@ -145,6 +170,11 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
* Actions
*/
// For retrocompatibility Dolibarr < 15.0
if ( versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
$formSetup->saveConfFromPost();
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
@ -271,191 +301,15 @@ echo '<span class="opacitymedium">'.$langs->trans("MyModuleSetupPage").'</span><
if ($action == 'edit') {
if ($useFormSetup && (float) DOL_VERSION >= 15) {
print $formSetup->generateOutput(true);
} else {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
print $conf->global->{$constname};
print "</textarea>\n";
} elseif ($val['type']== 'html') {
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
} elseif ($val['type'] == 'yesno') {
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename = array();
if (is_array($formmail->lines_model)) {
foreach ($formmail->lines_model as $modelmail) {
//var_dump($modelmail);
$moreonlabel = '';
if (!empty($arrayofmessagename[$modelmail->label])) {
$moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
}
// The 'label' is the key that is unique if we exclude the language
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
}
}
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
} elseif (preg_match('/category:/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$formother = new FormOther($db);
$tmp = explode(':', $val['type']);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#generate_token'.$constname.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true
},
function(token) {
$("#'.$constname.'").val(token);
});
});
});';
print '</script>';
}
} elseif ($val['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
}
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}
print '</td></tr>';
}
}
print '</table>';
print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
}
print $formSetup->generateOutput(true);
print '<br>';
} elseif (!empty($formSetup->items)) {
print $formSetup->generateOutput();
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
if ($useFormSetup && (float) DOL_VERSION >= 15) {
if (!empty($formSetup->items)) {
print $formSetup->generateOutput();
}
} else {
if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
print '</td><td>';
if ($val['type'] == 'textarea') {
print dol_nl2br($conf->global->{$constname});
} elseif ($val['type']== 'html') {
print $conf->global->{$constname};
} elseif ($val['type'] == 'yesno') {
print ajax_constantonoff($constname);
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp = explode(':', $val['type']);
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
if ($template<0) {
setEventMessages(null, $formmail->errors, 'errors');
}
print $langs->trans($template->label);
} elseif (preg_match('/category:/', $val['type'])) {
$c = new Categorie($db);
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
} elseif ($result > 0 ) {
$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
$toprint = array();
foreach ($ways as $way) {
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
}
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
}
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
print $langs->trans("Prospect");
} elseif ($conf->global->{$constname}==3) {
print $langs->trans("ProspectCustomer");
} elseif ($conf->global->{$constname}==1) {
print $langs->trans("Customer");
} elseif ($conf->global->{$constname}==0) {
print $langs->trans("NorProspectNorCustomer");
}
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
if ($resprod > 0) {
print $product->ref;
} elseif ($resprod < 0) {
setEventMessages(null, $product->errors, "errors");
}
} else {
print $conf->global->{$constname};
}
print '</td></tr>';
}
}
print '</table>';
}
}
if ($setupnotempty) {
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
print '<br>'.$langs->trans("NothingToSetup");
}
print '<br>'.$langs->trans("NothingToSetup");
}

View File

@ -150,6 +150,12 @@ class MyObject extends CommonObject
*/
public $amount;
/**
* @var int Thirdparty ID
*/
public $socid; // both socid and fk_soc are used
public $fk_soc; // both socid and fk_soc are used
/**
* @var int Status
*/

View File

@ -55,6 +55,8 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
$status = GETPOST('status', 'int');
$opp_status = GETPOST('opp_status', 'int');
$opp_percent = price2num(GETPOST('opp_percent', 'alpha'));
$objcanvas = GETPOST("objcanvas", "alpha");
$comefromclone = GETPOST("comefromclone", "alpha");
if ($id == '' && $ref == '' && ($action != "create" && $action != "add" && $action != "update" && !GETPOST("cancel"))) {
accessforbidden();

View File

@ -103,7 +103,7 @@ $search_date_end_endday = GETPOST('search_date_end_endday', 'int');
$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist';
$optioncss = GETPOST('optioncss', 'aZ');
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);

View File

@ -408,18 +408,40 @@ class Societe extends CommonObject
*/
public $idprof1;
/**
* @var string Professional ID 1
* @deprecated
* @see $idprof1
*/
public $siren;
/**
* Professional ID 2 (Ex: Siret in France)
* @var string
*/
public $idprof2;
/**
* @var string Professional ID 2
* @deprecated
* @see $idprof2
*/
public $siret;
/**
* Professional ID 3 (Ex: Ape in France)
* @var string
*/
public $idprof3;
/**
* @var string Professional ID 3
* @deprecated
* @see $idprof3
*/
public $ape;
/**
* Professional ID 4 (Ex: RCS in France)
* @var string

View File

@ -339,6 +339,7 @@ if ($contextpage == 'employeelist' && $search_employee == 1) {
}
$morejs = array();
$morecss = array();
$morehtmlright = "";
// Build and execute select
// --------------------------------------------------------------------

View File

@ -340,7 +340,7 @@ if ($result) {
$obj = $db->fetch_object($result);
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
if (empty($modules[$obj->module])) {
if (!isset($obj->module) || empty($modules[$obj->module])) {
$i++;
continue;
}