Merge pull request #13336 from Dolibarr/scrutinizer-patch-2
Scrutinizer Auto-Fixes
This commit is contained in:
commit
2994a5f35e
@ -46,13 +46,13 @@ if (empty($user->rights->accounting->chartofaccount))
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
$list_account_main = array (
|
||||
$list_account_main = array(
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array ();
|
||||
$list_account = array();
|
||||
$list_account[] = '---Product---';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
@ -120,25 +120,25 @@ if ($action == 'update') {
|
||||
foreach ($list_account_main as $constname) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($list_account as $constname) {
|
||||
$reg=array();
|
||||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $constname, $reg)) { // This is a separator
|
||||
continue;
|
||||
}
|
||||
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@ -190,7 +190,7 @@ foreach ($list_account_main as $key) {
|
||||
|
||||
|
||||
foreach ($list_account as $key) {
|
||||
$reg=array();
|
||||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $key, $reg)) {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).'</td><td></td></tr>';
|
||||
}
|
||||
@ -198,9 +198,9 @@ foreach ($list_account as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
print '<td width="50%">'.$label.'</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -59,7 +59,7 @@ $search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_current_account = GETPOST('search_current_account', 'alpha');
|
||||
$search_current_account_valid = GETPOST('search_current_account_valid', 'alpha');
|
||||
if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount';
|
||||
if ($search_current_account_valid == '') $search_current_account_valid = 'withoutvalidaccount';
|
||||
$search_onsell = GETPOST('search_onsell', 'alpha');
|
||||
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
||||
|
||||
@ -67,9 +67,9 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||
|
||||
if (empty($accounting_product_mode)) $accounting_product_mode='ACCOUNTANCY_SELL';
|
||||
if (empty($accounting_product_mode)) $accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
@ -224,56 +224,56 @@ $aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_P
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
|
||||
if (empty($pcgvercode)) $pcgvercode = $pcgverid;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
|
||||
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
$sql.= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
$sql.= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql.= " aa.rowid as aaid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
$sql .= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql .= " aa.rowid as aaid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
{
|
||||
$sql.=" p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
|
||||
@ -319,8 +319,8 @@ if (strlen(trim($search_label))) {
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= natural_search("p.description", $search_desc);
|
||||
}
|
||||
if ($search_onsell != '' && $search_onsell != '-1') $sql.= natural_search('p.tosell', $search_onsell, 1);
|
||||
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql.= natural_search('p.tobuy', $search_onpurchase, 1);
|
||||
if ($search_onsell != '' && $search_onsell != '-1') $sql .= natural_search('p.tosell', $search_onsell, 1);
|
||||
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql .= natural_search('p.tobuy', $search_onpurchase, 1);
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -367,60 +367,60 @@ if ($result)
|
||||
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
print '<br>';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc") . '</span><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
// Select mode
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
||||
print "</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellIntra') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellExport') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyIntra') . '</td>';
|
||||
print '<td>' . $langs->trans('OptionModeProductBuyDesc') . "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuyExport') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Refresh').'" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$moreforfilter = '';
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '">';
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
|
||||
//print '<br><div class="center">'.$buttonsave.'</div>';
|
||||
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
$texte = $langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
|
||||
// On sell
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
|
||||
@ -431,13 +431,13 @@ if ($result)
|
||||
}
|
||||
// Current account
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
||||
$listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="'.dol_escape_htmltag($search_current_account).'">';
|
||||
$listofvals = array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
|
||||
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="center liste_titre">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -445,36 +445,36 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
// On sell / On purchase
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell";
|
||||
$fieldtosortaccount = "p.accountancy_code_sell";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_intra";
|
||||
$fieldtosortaccount = "p.accountancy_code_sell_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_export";
|
||||
$fieldtosortaccount = "p.accountancy_code_sell_export";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy";
|
||||
$fieldtosortaccount = "p.accountancy_code_buy";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy_intra";
|
||||
$fieldtosortaccount = "p.accountancy_code_buy_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy_export";
|
||||
$fieldtosortaccount = "p.accountancy_code_buy_export";
|
||||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
print '</tr>';
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -491,37 +491,37 @@ if ($result)
|
||||
// Sales
|
||||
if ($obj->product_type == 0) {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
}
|
||||
@ -529,37 +529,37 @@ if ($result)
|
||||
// Purchases
|
||||
if ($obj->product_type == 0) {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
}
|
||||
@ -611,72 +611,72 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
// New account to set
|
||||
$defaultvalue='';
|
||||
$defaultvalue = '';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
// Accounting account buy
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_intra;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_intra);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_intra;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy_export;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy_export);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_export;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy_export);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
// Accounting account sell intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_intra);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
// Accounting account sell export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_export);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell_export);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -204,7 +204,7 @@ if (empty($reshook))
|
||||
$search_debit = '';
|
||||
$search_credit = '';
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled='';
|
||||
$search_not_reconciled = '';
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
@ -276,32 +276,32 @@ if (empty($reshook))
|
||||
if (!empty($search_date_creation_start)) {
|
||||
$filter['t.date_creation>='] = $search_date_creation_start;
|
||||
$tmp = dol_getdate($search_date_creation_start);
|
||||
$param .= '&date_creation_startmonth=' . urlencode($tmp['mon']) . '&date_creation_startday=' . urlencode($tmp['mday']) . '&date_creation_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_creation_end)) {
|
||||
$filter['t.date_creation<='] = $search_date_creation_end;
|
||||
$tmp = dol_getdate($search_date_creation_end);
|
||||
$param .= '&date_creation_endmonth=' .urlencode($tmp['mon']) . '&date_creation_endday=' . urlencode($tmp['mday']) . '&date_creation_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_modification_start)) {
|
||||
$filter['t.tms>='] = $search_date_modification_start;
|
||||
$tmp = dol_getdate($search_date_modification_start);
|
||||
$param .= '&date_modification_startmonth=' . urlencode($tmp['mon']) . '&date_modification_startday=' . urlencode($tmp['mday']) . '&date_modification_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_modification_end)) {
|
||||
$filter['t.tms<='] = $search_date_modification_end;
|
||||
$tmp = dol_getdate($search_date_modification_end);
|
||||
$param .= '&date_modification_endmonth=' . urlencode($tmp['mon']) . '&date_modification_endday=' . urlencode($tmp['mday']) . '&date_modification_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_export_start)) {
|
||||
$filter['t.date_export>='] = $search_date_export_start;
|
||||
$tmp = dol_getdate($search_date_export_start);
|
||||
$param .= '&date_export_startmonth=' . urlencode($tmp['mon']) . '&date_export_startday=' . urlencode($tmp['mday']) . '&date_export_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_export_end)) {
|
||||
$filter['t.date_export<='] = $search_date_export_end;
|
||||
$tmp = dol_getdate($search_date_export_end);
|
||||
$param .= '&date_export_endmonth=' . urlencode($tmp['mon']) . '&date_export_endday=' . urlencode($tmp['mday']) . '&date_export_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_debit)) {
|
||||
$filter['t.debit'] = $search_debit;
|
||||
@ -315,9 +315,9 @@ if (empty($reshook))
|
||||
$filter['t.lettering_code'] = $search_lettering_code;
|
||||
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
|
||||
}
|
||||
if (! empty($search_not_reconciled)) {
|
||||
if (!empty($search_not_reconciled)) {
|
||||
$filter['t.reconciled_option'] = $search_not_reconciled;
|
||||
$param .= '&search_not_reconciled=' . urlencode($search_not_reconciled);
|
||||
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,7 +768,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
||||
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled'?' checked':'').'>'.$langs->trans("NotReconciled").'</span>';
|
||||
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
|
||||
print '</td>';
|
||||
}
|
||||
// Code journal
|
||||
@ -953,9 +953,9 @@ while ($i < min($num, $limit))
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'expensereport';
|
||||
|
||||
$filename=dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
else
|
||||
@ -969,7 +969,7 @@ while ($i < min($num, $limit))
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
|
||||
if($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
{
|
||||
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
|
||||
print $documentlink;
|
||||
|
||||
@ -480,7 +480,7 @@ if ($result) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($objp->code_buy_p)) {
|
||||
if (!empty($objp->code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
@ -561,7 +561,7 @@ if ($result) {
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && ! empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||
{
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
|
||||
{
|
||||
@ -597,7 +597,7 @@ if ($result) {
|
||||
print $db->error();
|
||||
}
|
||||
if ($db->type == 'mysqli') {
|
||||
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
|
||||
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
* \ingroup member
|
||||
* \brief File of class to manage members of a foundation
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -341,7 +341,7 @@ class Adherent extends CommonObject
|
||||
if (dol_textishtml($text, 0)) $msgishtml = 1;
|
||||
}
|
||||
|
||||
dol_syslog('send_an_email msgishtml=' . $msgishtml);
|
||||
dol_syslog('send_an_email msgishtml='.$msgishtml);
|
||||
|
||||
$texttosend = $this->makeSubstitution($text);
|
||||
$subjecttosend = $this->makeSubstitution($subject);
|
||||
@ -351,15 +351,15 @@ class Adherent extends CommonObject
|
||||
$from = $conf->email_from;
|
||||
if (!empty($conf->global->ADHERENT_MAIL_FROM)) $from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
|
||||
$trackid = 'mem' . $this->id;
|
||||
$trackid = 'mem'.$this->id;
|
||||
|
||||
// Send email (substitutionarray must be done just before this)
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader);
|
||||
if ($mailfile->sendfile()) {
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email) . '. ' . $mailfile->error;
|
||||
$this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email).'. '.$mailfile->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -381,26 +381,26 @@ class Adherent extends CommonObject
|
||||
if (dol_textishtml($text, 1)) $msgishtml = 1;
|
||||
|
||||
$infos = '';
|
||||
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle") . ": " . $this->getCivilityLabel() . "\n";
|
||||
$infos .= $langs->transnoentities("id") . ": " . $this->id . "\n";
|
||||
$infos .= $langs->transnoentities("Lastname") . ": " . $this->lastname . "\n";
|
||||
$infos .= $langs->transnoentities("Firstname") . ": " . $this->firstname . "\n";
|
||||
$infos .= $langs->transnoentities("Company") . ": " . $this->company . "\n";
|
||||
$infos .= $langs->transnoentities("Address") . ": " . $this->address . "\n";
|
||||
$infos .= $langs->transnoentities("Zip") . ": " . $this->zip . "\n";
|
||||
$infos .= $langs->transnoentities("Town") . ": " . $this->town . "\n";
|
||||
$infos .= $langs->transnoentities("Country") . ": " . $this->country . "\n";
|
||||
$infos .= $langs->transnoentities("EMail") . ": " . $this->email . "\n";
|
||||
$infos .= $langs->transnoentities("PhonePro") . ": " . $this->phone . "\n";
|
||||
$infos .= $langs->transnoentities("PhonePerso") . ": " . $this->phone_perso . "\n";
|
||||
$infos .= $langs->transnoentities("PhoneMobile") . ": " . $this->phone_mobile . "\n";
|
||||
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
|
||||
$infos .= $langs->transnoentities("id").": ".$this->id."\n";
|
||||
$infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
|
||||
$infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
|
||||
$infos .= $langs->transnoentities("Company").": ".$this->company."\n";
|
||||
$infos .= $langs->transnoentities("Address").": ".$this->address."\n";
|
||||
$infos .= $langs->transnoentities("Zip").": ".$this->zip."\n";
|
||||
$infos .= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||
$infos .= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||
$infos .= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||
$infos .= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||
$infos .= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||
$infos .= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
$infos .= $langs->transnoentities("Login") . ": " . $this->login . "\n";
|
||||
$infos .= $langs->transnoentities("Password") . ": " . $this->pass . "\n";
|
||||
$infos .= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
$infos .= $langs->transnoentities("Password").": ".$this->pass."\n";
|
||||
}
|
||||
$infos .= $langs->transnoentities("Birthday") . ": " . $birthday . "\n";
|
||||
$infos .= $langs->transnoentities("Photo") . ": " . $this->photo . "\n";
|
||||
$infos .= $langs->transnoentities("Public") . ": " . yn($this->public);
|
||||
$infos .= $langs->transnoentities("Birthday").": ".$birthday."\n";
|
||||
$infos .= $langs->transnoentities("Photo").": ".$this->photo."\n";
|
||||
$infos .= $langs->transnoentities("Public").": ".yn($this->public);
|
||||
|
||||
// Substitutions
|
||||
$substitutionarray = array('__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(),
|
||||
@ -481,22 +481,22 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Insert member
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
|
||||
$sql .= " VALUES (";
|
||||
$sql .= " '" . $this->db->idate($this->datec) . "'";
|
||||
$sql .= ", " . ($this->login ? "'" . $this->db->escape($this->login) . "'" : "null");
|
||||
$sql .= ", " . ($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
|
||||
$sql .= ", null, null, '" . $this->db->escape($this->morphy) . "'";
|
||||
$sql .= ", " . $this->typeid;
|
||||
$sql .= ", " . $conf->entity;
|
||||
$sql .= ", " . (!empty($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null");
|
||||
$sql .= " '".$this->db->idate($this->datec)."'";
|
||||
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
|
||||
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
|
||||
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", ".$this->typeid;
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "adherent");
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||
if ($id > 0) {
|
||||
$this->id = $id;
|
||||
$this->ref = (string) $id;
|
||||
@ -511,10 +511,10 @@ class Adherent extends CommonObject
|
||||
// Add link to user
|
||||
if ($this->user_id) {
|
||||
// Add link to user
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET";
|
||||
$sql .= " fk_member = " . $this->id;
|
||||
$sql .= " WHERE rowid = " . $this->user_id;
|
||||
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||
$sql .= " fk_member = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = 'Failed to update user to make link with member';
|
||||
@ -533,7 +533,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
dol_syslog(get_class($this) . "::create " . implode(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create ".implode(',', $this->errors), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
} else {
|
||||
@ -542,7 +542,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$this->error = 'Failed to get last insert id';
|
||||
dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -572,7 +572,7 @@ class Adherent extends CommonObject
|
||||
$nbrowsaffected = 0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncuser=" . $nosyncuser . ", nosyncuserpass=" . $nosyncuserpass . " nosyncthirdparty=" . $nosyncthirdparty . ", email=" .
|
||||
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".
|
||||
$this->email);
|
||||
|
||||
// Clean parameters
|
||||
@ -598,43 +598,43 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql .= " civility = " . ($this->civility_id ? "'" . $this->db->escape($this->civility_id) . "'" : "null");
|
||||
$sql .= ", firstname = " . ($this->firstname ? "'" . $this->db->escape($this->firstname) . "'" : "null");
|
||||
$sql .= ", lastname = " . ($this->lastname ? "'" . $this->db->escape($this->lastname) . "'" : "null");
|
||||
$sql .= ", gender = " . ($this->gender != -1 ? "'" . $this->db->escape($this->gender) . "'" : "null"); // 'man' or 'woman'
|
||||
$sql .= ", login = " . ($this->login ? "'" . $this->db->escape($this->login) . "'" : "null");
|
||||
$sql .= ", societe = " . ($this->company ? "'" . $this->db->escape($this->company) . "'" : ($this->societe ? "'" . $this->db->escape($this->societe) . "'" : "null"));
|
||||
$sql .= ", fk_soc = " . ($this->socid > 0 ? $this->db->escape($this->socid) : "null");
|
||||
$sql .= ", address = " . ($this->address ? "'" . $this->db->escape($this->address) . "'" : "null");
|
||||
$sql .= ", zip = " . ($this->zip ? "'" . $this->db->escape($this->zip) . "'" : "null");
|
||||
$sql .= ", town = " . ($this->town ? "'" . $this->db->escape($this->town) . "'" : "null");
|
||||
$sql .= ", country = " . ($this->country_id > 0 ? $this->db->escape($this->country_id) : "null");
|
||||
$sql .= ", state_id = " . ($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '" . $this->db->escape($this->email) . "'";
|
||||
$sql .= ", socialnetworks = '" . $this->db->escape(json_encode($this->socialnetworks)) . "'";
|
||||
$sql .= ", phone = " . ($this->phone ? "'" . $this->db->escape($this->phone) . "'" : "null");
|
||||
$sql .= ", phone_perso = " . ($this->phone_perso ? "'" . $this->db->escape($this->phone_perso) . "'" : "null");
|
||||
$sql .= ", phone_mobile = " . ($this->phone_mobile ? "'" . $this->db->escape($this->phone_mobile) . "'" : "null");
|
||||
$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");
|
||||
$sql .= ", photo = " . ($this->photo ? "'" . $this->db->escape($this->photo) . "'" : "null");
|
||||
$sql .= ", public = '" . $this->db->escape($this->public) . "'";
|
||||
$sql .= ", statut = " . $this->db->escape($this->statut);
|
||||
$sql .= ", fk_adherent_type = " . $this->db->escape($this->typeid);
|
||||
$sql .= ", morphy = '" . $this->db->escape($this->morphy) . "'";
|
||||
$sql .= ", birth = " . ($this->birth ? "'" . $this->db->idate($this->birth) . "'" : "null");
|
||||
if ($this->socid) $sql .= ", fk_soc = '" . $this->db->escape($this->socid) . "'"; // Must be modified only when creating from a third-party
|
||||
if ($this->datefin) $sql .= ", datefin = '" . $this->db->idate($this->datefin) . "'"; // Must be modified only when deleting a subscription
|
||||
if ($this->datevalid) $sql .= ", datevalid = '" . $this->db->idate($this->datevalid) . "'"; // Must be modified only when validating a member
|
||||
$sql .= ", fk_user_mod = " . ($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null");
|
||||
$sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null");
|
||||
$sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null");
|
||||
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
|
||||
$sql .= ", societe = ".($this->company ? "'".$this->db->escape($this->company)."'" : ($this->societe ? "'".$this->db->escape($this->societe)."'" : "null"));
|
||||
$sql .= ", fk_soc = ".($this->socid > 0 ? $this->db->escape($this->socid) : "null");
|
||||
$sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null");
|
||||
$sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null");
|
||||
$sql .= ", town = ".($this->town ? "'".$this->db->escape($this->town)."'" : "null");
|
||||
$sql .= ", country = ".($this->country_id > 0 ? $this->db->escape($this->country_id) : "null");
|
||||
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
|
||||
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
$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");
|
||||
$sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null");
|
||||
$sql .= ", public = '".$this->db->escape($this->public)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
||||
$sql .= ", morphy = '".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null");
|
||||
if ($this->socid) $sql .= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
|
||||
if ($this->datefin) $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||
if ($this->datevalid) $sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
||||
$sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
// If we change the type of membership, we set also label of new type
|
||||
if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) {
|
||||
$sql2 = "SELECT libelle as label";
|
||||
$sql2 .= " FROM " . MAIN_DB_PREFIX . "adherent_type";
|
||||
$sql2 .= " WHERE rowid = " . $this->typeid;
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql2 .= " WHERE rowid = ".$this->typeid;
|
||||
$resql2 = $this->db->query($sql2);
|
||||
if ($resql2) {
|
||||
while ($obj = $this->db->fetch_object($resql2)) {
|
||||
@ -643,7 +643,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::update update member", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
unset($this->country_code);
|
||||
@ -666,7 +666,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// Update password
|
||||
if (!$error && $this->pass) {
|
||||
dol_syslog(get_class($this) . "::update update password");
|
||||
dol_syslog(get_class($this)."::update update password");
|
||||
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
|
||||
$isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1;
|
||||
|
||||
@ -678,9 +678,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove links to user and replace with new one
|
||||
if (!$error) {
|
||||
dol_syslog(get_class($this) . "::update update link to user");
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL WHERE fk_member = " . $this->id;
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update update link to user");
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -689,8 +689,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
// If there is a user linked to this member
|
||||
if ($this->user_id > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = " . $this->id . " WHERE rowid = " . $this->user_id;
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id." WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -704,9 +704,9 @@ class Adherent extends CommonObject
|
||||
{
|
||||
// Update information on linked user if it is an update
|
||||
if (!$error && $this->user_id > 0 && !$nosyncuser) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
dol_syslog(get_class($this) . "::update update linked user");
|
||||
dol_syslog(get_class($this)."::update update linked user");
|
||||
|
||||
$luser = new User($this->db);
|
||||
$result = $luser->fetch($this->user_id);
|
||||
@ -743,7 +743,7 @@ class Adherent extends CommonObject
|
||||
$result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates
|
||||
if ($result < 0) {
|
||||
$this->error = $luser->error;
|
||||
dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -754,9 +754,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Update information on linked thirdparty if it is an update
|
||||
if (!$error && $this->fk_soc > 0 && !$nosyncthirdparty) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
dol_syslog(get_class($this) . "::update update linked thirdparty");
|
||||
dol_syslog(get_class($this)."::update update linked thirdparty");
|
||||
|
||||
// This member is linked with a thirdparty, so we also update thirdparty informations
|
||||
// if this is an update.
|
||||
@ -779,7 +779,7 @@ class Adherent extends CommonObject
|
||||
if ($result < 0) {
|
||||
$this->error = $lthirdparty->error;
|
||||
$this->errors = $lthirdparty->errors;
|
||||
dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
@ -828,11 +828,11 @@ class Adherent extends CommonObject
|
||||
|
||||
// Search for last subscription id and end date
|
||||
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "subscription";
|
||||
$sql .= " WHERE fk_adherent=" . $this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
|
||||
$sql .= " WHERE fk_adherent=".$this->id;
|
||||
$sql .= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||
|
||||
dol_syslog(get_class($this) . "::update_end_date", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -840,11 +840,11 @@ class Adherent extends CommonObject
|
||||
$datedeb = $this->db->jdate($obj->datedeb);
|
||||
$datefin = $this->db->jdate($obj->datefin);
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql .= " datefin=" . ($datefin != '' ? "'" . $this->db->idate($datefin) . "'" : "null");
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null");
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update_end_date", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->last_subscription_date = $dateop;
|
||||
@ -893,8 +893,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// Remove category
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_member WHERE fk_member = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -904,8 +904,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove subscription
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "subscription WHERE fk_adherent = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -932,15 +932,15 @@ class Adherent extends CommonObject
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errorflag = -4;
|
||||
dol_syslog(get_class($this) . "::delete erreur " . $errorflag . " " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove adherent
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "adherent WHERE rowid = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -975,11 +975,11 @@ class Adherent extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this) . "::setPassword user=" . $user->id . " password=" . preg_replace('/./i', '*', $password) . " isencrypted=" . $isencrypted);
|
||||
dol_syslog(get_class($this)."::setPassword user=".$user->id." password=".preg_replace('/./i', '*', $password)." isencrypted=".$isencrypted);
|
||||
|
||||
// If new password not provided, we generate one
|
||||
if (!$password) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$password = getRandomPassword(false);
|
||||
}
|
||||
|
||||
@ -994,18 +994,18 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " SET pass_crypted = '" . $this->db->escape($password_crypted) . "'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."'";
|
||||
//if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||
if ($isencrypted) {
|
||||
$sql .= ", pass = null";
|
||||
} else {
|
||||
$sql .= ", pass = '" . $this->db->escape($password_indatabase) . "'";
|
||||
$sql .= ", pass = '".$this->db->escape($password_indatabase)."'";
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
//dol_syslog("Adherent::Password sql=hidden");
|
||||
dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setPassword", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$nbaffectedrows = $this->db->affected_rows($result);
|
||||
@ -1016,7 +1016,7 @@ class Adherent extends CommonObject
|
||||
$this->pass_indatabase_crypted = $password_crypted;
|
||||
|
||||
if ($this->user_id && !$nosyncuser) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// This member is linked with a user, so we also update users informations
|
||||
// if this is an update.
|
||||
@ -1027,7 +1027,7 @@ class Adherent extends CommonObject
|
||||
$result = $luser->setPassword($user, $this->pass, 0, 0, 1);
|
||||
if ($result < 0) {
|
||||
$this->error = $luser->error;
|
||||
dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -1074,8 +1074,8 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// If user is linked to this member, remove old link to this member
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL WHERE fk_member = " . $this->id;
|
||||
dol_syslog(get_class($this) . "::setUserId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -1085,9 +1085,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Set link to user
|
||||
if ($userid > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = " . $this->id;
|
||||
$sql .= " WHERE rowid = " . $userid;
|
||||
dol_syslog(get_class($this) . "::setUserId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$userid;
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -1116,18 +1116,18 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove link to third party onto any other members
|
||||
if ($thirdpartyid > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET fk_soc = null";
|
||||
$sql .= " WHERE fk_soc = '" . $thirdpartyid . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
dol_syslog(get_class($this) . "::setThirdPartyId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = null";
|
||||
$sql .= " WHERE fk_soc = '".$thirdpartyid."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
}
|
||||
|
||||
// Add link to third party for current member
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET fk_soc = " . ($thirdpartyid > 0 ? $thirdpartyid : 'null');
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid > 0 ? $thirdpartyid : 'null');
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::setThirdPartyId", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->db->commit();
|
||||
@ -1152,9 +1152,9 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " WHERE login='" . $this->db->escape($login) . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE login='".$this->db->escape($login)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1180,10 +1180,10 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " WHERE firstname='" . $this->db->escape($firstname) . "'";
|
||||
$sql .= " AND lastname='" . $this->db->escape($lastname) . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE firstname='".$this->db->escape($firstname)."'";
|
||||
$sql .= " AND lastname='".$this->db->escape($lastname)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1227,24 +1227,24 @@ class Adherent extends CommonObject
|
||||
$sql .= " dep.nom as state, dep.code_departement as state_code,";
|
||||
$sql .= " t.libelle as type, t.subscription as subscription,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t, " . MAIN_DB_PREFIX . "adherent as d";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON d.country = c.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as dep ON d.state_id = dep.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u ON d.rowid = u.fk_member";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid";
|
||||
if ($rowid)
|
||||
$sql .= " AND d.rowid=" . $rowid;
|
||||
$sql .= " AND d.rowid=".$rowid;
|
||||
elseif ($ref || $fk_soc) {
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if ($ref)
|
||||
$sql .= " AND d.rowid='" . $this->db->escape($ref) . "'";
|
||||
$sql .= " AND d.rowid='".$this->db->escape($ref)."'";
|
||||
elseif ($fk_soc > 0)
|
||||
$sql .= " AND d.fk_soc=" . $fk_soc;
|
||||
$sql .= " AND d.fk_soc=".$fk_soc;
|
||||
} elseif ($ref_ext) {
|
||||
$sql .= " AND d.ref_ext='" . $this->db->escape($ref_ext) . "'";
|
||||
$sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
@ -1257,7 +1257,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
|
||||
$this->civility_code = $obj->civility_code;
|
||||
$this->civility = $obj->civility_code ? ($langs->trans("Civility" . $obj->civility_code) != ("Civility" . $obj->civility_code) ? $langs->trans("Civility" . $obj->civility_code) : $obj->civility_code) : '';
|
||||
$this->civility = $obj->civility_code ? ($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code) : '';
|
||||
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
@ -1281,8 +1281,8 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
if ($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code)
|
||||
$this->country = $langs->transnoentitiesnoconv("Country" . $obj->country_code);
|
||||
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)
|
||||
$this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code);
|
||||
else
|
||||
$this->country = $obj->country;
|
||||
|
||||
@ -1354,17 +1354,17 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
|
||||
$sql .= " c.tms as datem,";
|
||||
$sql .= " c.datec as datec,";
|
||||
$sql .= " c.dateadh as dateh,";
|
||||
$sql .= " c.datef as datef";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "subscription as c";
|
||||
$sql .= " WHERE c.fk_adherent = " . $this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql .= " WHERE c.fk_adherent = ".$this->id;
|
||||
$sql .= " ORDER BY c.dateadh";
|
||||
dol_syslog(get_class($this) . "::fetch_subscriptions", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1401,7 +1401,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error() . ' sql=' . $sql;
|
||||
$this->error = $this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1425,7 +1425,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -1505,12 +1505,12 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->invoice = null; // This will contains invoice if an invoice is created
|
||||
|
||||
dol_syslog("subscriptionComplementaryActions subscriptionid=" . $subscriptionid . " option=" . $option . " accountid=" . $accountid . " datesubscription=" . $datesubscription . " paymentdate=" .
|
||||
$paymentdate . " label=" . $label . " amount=" . $amount . " num_chq=" . $num_chq . " autocreatethirdparty=" . $autocreatethirdparty);
|
||||
dol_syslog("subscriptionComplementaryActions subscriptionid=".$subscriptionid." option=".$option." accountid=".$accountid." datesubscription=".$datesubscription." paymentdate=".
|
||||
$paymentdate." label=".$label." amount=".$amount." num_chq=".$num_chq." autocreatethirdparty=".$autocreatethirdparty);
|
||||
|
||||
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
|
||||
if ($option == 'bankdirect' && $accountid) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$acct = new Account($this->db);
|
||||
$result = $acct->fetch($accountid);
|
||||
@ -1519,11 +1519,11 @@ class Adherent extends CommonObject
|
||||
|
||||
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
|
||||
if ($insertid > 0) {
|
||||
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT . '/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
|
||||
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
|
||||
if ($inserturlid > 0) {
|
||||
// Update table subscription
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "subscription SET fk_bank=" . $insertid;
|
||||
$sql .= " WHERE rowid=" . $subscriptionid;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
|
||||
$sql .= " WHERE rowid=".$subscriptionid;
|
||||
|
||||
dol_syslog("subscription::subscription", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1546,8 +1546,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// If option choosed, we create invoice
|
||||
if (($option == 'bankviainvoice' && $accountid) || $option == 'invoiceonly') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/paymentterm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
|
||||
|
||||
$invoice = new Facture($this->db);
|
||||
$customer = new Societe($this->db);
|
||||
@ -1659,9 +1659,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Add payment onto invoice
|
||||
if (!$error && $option == 'bankviainvoice' && $accountid) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
$amounts = array();
|
||||
$amounts[$invoice->id] = price2num($amount);
|
||||
@ -1695,8 +1695,8 @@ class Adherent extends CommonObject
|
||||
|
||||
if (!$error && !empty($bank_line_id)) {
|
||||
// Update fk_bank into subscription table
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'subscription SET fk_bank=' . $bank_line_id;
|
||||
$sql .= ' WHERE rowid=' . $subscriptionid;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
|
||||
$sql .= ' WHERE rowid='.$subscriptionid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
@ -1751,19 +1751,19 @@ class Adherent extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 1) {
|
||||
dol_syslog(get_class($this) . "::validate statut of member does not allow this", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 1";
|
||||
$sql .= ", datevalid = '" . $this->db->idate($now) . "'";
|
||||
$sql .= ", fk_user_valid=" . $user->id;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= ", datevalid = '".$this->db->idate($now)."'";
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::validate", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->statut = 1;
|
||||
@ -1803,16 +1803,16 @@ class Adherent extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 0) {
|
||||
dol_syslog(get_class($this) . "::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 0";
|
||||
$sql .= ", fk_user_valid=" . $user->id;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -1848,7 +1848,7 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
|
||||
$mailmanspip = new MailmanSpip($this->db);
|
||||
|
||||
$err = 0;
|
||||
@ -1898,7 +1898,7 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
|
||||
$mailmanspip = new MailmanSpip($this->db);
|
||||
|
||||
$err = 0;
|
||||
@ -1949,7 +1949,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$code = (empty($this->civility_id) ? '' : $this->civility_id);
|
||||
if (empty($code)) return '';
|
||||
return $langs->getLabelFromKey($this->db, "Civility" . $code, "c_civility", "code", "label", $code);
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1982,15 +1982,15 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
$label .= '<div class="centpercent">';
|
||||
$label .= '<u>' . $langs->trans("Member") . '</u>';
|
||||
if (!empty($this->ref)) $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
if (!empty($this->company)) $label .= '<br><b>' . $langs->trans('Company') . ':</b> ' . $this->company;
|
||||
$label .= '<u>'.$langs->trans("Member").'</u>';
|
||||
if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
|
||||
if (!empty($this->company)) $label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
|
||||
$label .= '</div>';
|
||||
|
||||
$url = DOL_URL_ROOT . '/adherents/card.php?rowid=' . $this->id;
|
||||
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||
if ($option == 'subscription') {
|
||||
$url = DOL_URL_ROOT . '/adherents/subscription.php?rowid=' . $this->id;
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
|
||||
}
|
||||
|
||||
if ($option != 'nolink') {
|
||||
@ -2000,19 +2000,19 @@ class Adherent extends CommonObject
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkstart .= '<a href="' . $url . '"';
|
||||
$linkstart .= '<a href="'.$url.'"';
|
||||
$linkclose = "";
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$langs->load("users");
|
||||
$label = $langs->trans("ShowUser");
|
||||
$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
|
||||
$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
|
||||
$linkstart .= $linkclose . '>';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
@ -2022,19 +2022,19 @@ class Adherent extends CommonObject
|
||||
if (abs($withpictoimg) == 1) $paddafterimage = 'style="margin-right: 3px;"';
|
||||
// Only picto
|
||||
if ($withpictoimg > 0)
|
||||
$picto = '<span class="nopadding' . ($morecss ? ' userimg' . $morecss : '') . '">' .
|
||||
img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</span>';
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.
|
||||
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</span>';
|
||||
// Picto must be a photo
|
||||
else {
|
||||
$picto = '<span class="nopadding' . ($morecss ? ' userimg' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>';
|
||||
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';
|
||||
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
|
||||
$picto .= '</span>';
|
||||
}
|
||||
$result .= $picto;
|
||||
}
|
||||
if ($withpictoimg > -2 && $withpictoimg != 2) {
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') .
|
||||
($morecss ? ' usertext' . $morecss : '') . '">';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').
|
||||
($morecss ? ' usertext'.$morecss : '').'">';
|
||||
if ($mode == 'login')
|
||||
$result .= dol_trunc($this->login, $maxlen);
|
||||
elseif ($mode == 'ref')
|
||||
@ -2126,9 +2126,9 @@ class Adherent extends CommonObject
|
||||
$this->nb = array();
|
||||
|
||||
$sql = "SELECT count(a.rowid) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= " WHERE a.statut > 0";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -2162,16 +2162,16 @@ class Adherent extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
$sql = "SELECT a.rowid, a.datefin, a.statut";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.fk_adherent_type = t.rowid";
|
||||
if ($mode == 'expired') {
|
||||
$sql .= " AND a.statut = 1";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND ((a.datefin IS NULL or a.datefin < '" . $this->db->idate($now) . "') AND t.subscription = 1)";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)";
|
||||
} elseif ($mode == 'shift') {
|
||||
$sql .= " AND a.statut = -1";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2187,10 +2187,10 @@ class Adherent extends CommonObject
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$label = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$url = DOL_URL_ROOT . '/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
} elseif ($mode == 'shift') {
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$url = DOL_URL_ROOT . '/adherents/list.php?mainmenu=members&statut=-1';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1';
|
||||
$label = $langs->trans("MembersListToValid");
|
||||
$labelShort = $langs->trans("ToValidate");
|
||||
}
|
||||
@ -2331,9 +2331,9 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$dn = '';
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS . "=" . $info[$conf->global->LDAP_KEY_MEMBERS] . "," . $conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS . "=" . $info[$conf->global->LDAP_KEY_MEMBERS];
|
||||
if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS];
|
||||
return $dn;
|
||||
}
|
||||
|
||||
@ -2413,7 +2413,7 @@ class Adherent extends CommonObject
|
||||
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}' . base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||
}
|
||||
}
|
||||
} // Use $this->pass_indatabase value if exists
|
||||
@ -2445,10 +2445,10 @@ class Adherent extends CommonObject
|
||||
$sql .= ' a.datevalid as datev,';
|
||||
$sql .= ' a.tms as datem,';
|
||||
$sql .= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'adherent as a';
|
||||
$sql .= ' WHERE a.rowid = ' . $id;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
|
||||
$sql .= ' WHERE a.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this) . "::info", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
@ -2491,8 +2491,8 @@ class Adherent extends CommonObject
|
||||
public function getNbOfEMailings()
|
||||
{
|
||||
$sql = "SELECT count(mc.email) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.email = '" . $this->db->escape($this->email) . "'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2526,7 +2526,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// Get current categories
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
$existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id');
|
||||
|
||||
@ -2627,7 +2627,7 @@ class Adherent extends CommonObject
|
||||
$arraydaysbeforeend = explode(';', $daysbeforeendlist);
|
||||
foreach ($arraydaysbeforeend as $daysbeforeend) // Loop on each delay
|
||||
{
|
||||
dol_syslog(__METHOD__ . ' - Process delta = ' . $daysbeforeend, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
$blockingerrormsg = "Value for delta is not a positive or negative numeric";
|
||||
@ -2638,15 +2638,15 @@ class Adherent extends CommonObject
|
||||
$tmp = dol_getdate($now);
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
||||
|
||||
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'adherent';
|
||||
$sql .= " WHERE entity = " . $conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '" . $this->db->idate($datetosearchfor) . "'";
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$adherent = new Adherent($this->db);
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
@ -2670,7 +2670,7 @@ class Adherent extends CommonObject
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($languagecodeformember);
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id " . $adherent->id . " set to " . $outputlangs->defaultlang . " mysoc->default_lang=" . $mysoc->default_lang);
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
||||
@ -2687,10 +2687,10 @@ class Adherent extends CommonObject
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$to = $adherent->email;
|
||||
|
||||
$trackid = 'mem' . $adherent->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: sendReminderForExpiredSubscription' . "\r\n";
|
||||
$trackid = 'mem'.$adherent->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n";
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader);
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result) {
|
||||
@ -2713,24 +2713,24 @@ class Adherent extends CommonObject
|
||||
$extraparams = '';
|
||||
|
||||
$actionmsg = '';
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy') . ' ' . CMailFile::getValidAddress($from, 4, 0, 1) . ' ' . $langs->transnoentities('To') . ' ' .
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom') . ': ' . dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo') . ': ' . dol_escape_htmltag($sendto));
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_' . $actioncode;
|
||||
$actioncomm->code = 'AC_'.$actioncode;
|
||||
$actioncomm->label = $actionmsg2;
|
||||
$actioncomm->note_private = $actionmsg;
|
||||
$actioncomm->fk_project = 0;
|
||||
@ -2780,8 +2780,8 @@ class Adherent extends CommonObject
|
||||
$this->error = $blockingerrormsg;
|
||||
return 1;
|
||||
} else {
|
||||
$this->output = 'Found ' . ($nbok + $nbko) . ' members to send reminder to.';
|
||||
$this->output .= ' Send email successfuly to ' . $nbok . ' members';
|
||||
$this->output = 'Found '.($nbok + $nbko).' members to send reminder to.';
|
||||
$this->output .= ' Send email successfuly to '.$nbok.' members';
|
||||
if (is_array($listofmembersok)) {
|
||||
$listofids = '';
|
||||
$i = 0;
|
||||
@ -2801,7 +2801,7 @@ class Adherent extends CommonObject
|
||||
$this->output .= $listofids;
|
||||
}
|
||||
if ($nbko) {
|
||||
$this->output .= ' - Canceled for ' . $nbko . ' member (no email or email sending error)';
|
||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||
if (is_array($listofmembersko)) {
|
||||
$listofids = '';
|
||||
$i = 0;
|
||||
|
||||
@ -36,12 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminihm'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
|
||||
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
if (!defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
|
||||
|
||||
|
||||
@ -49,13 +49,13 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
|
||||
@ -65,15 +65,15 @@ if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
|
||||
else dolibarr_del_const($db, $regs[2], $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||
if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
$logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
|
||||
$mysoc->logo='';
|
||||
$mysoc->logo = '';
|
||||
|
||||
/*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||
dol_delete_file($logosmallfile);
|
||||
@ -89,7 +89,7 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
@ -98,53 +98,53 @@ if ($action == 'update')
|
||||
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
@ -158,29 +158,29 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
$reg = array();
|
||||
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
$original_file = $reg[1];
|
||||
|
||||
$isimage=image_format_supported($original_file);
|
||||
$isimage = image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||
if (! is_dir($dirforimage))
|
||||
if (!is_dir($dirforimage))
|
||||
{
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
|
||||
@ -189,7 +189,7 @@ if ($action == 'update')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$tmparray=explode(':', $result);
|
||||
$tmparray = explode(':', $result);
|
||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
|
||||
}
|
||||
else
|
||||
@ -209,7 +209,7 @@ if ($action == 'update')
|
||||
|
||||
|
||||
|
||||
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
|
||||
$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -220,12 +220,12 @@ if ($action == 'update')
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
|
||||
|
||||
@ -281,12 +281,12 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max size of lists
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'"></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max size of short lists on customer card
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="'.$conf->global->MAIN_SIZE_SHORTLIST_LIMIT.'"></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -301,36 +301,36 @@ print '</tr>';
|
||||
|
||||
// First day for weeks
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
||||
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
|
||||
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingDays
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5').'">';
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingHours
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18').'">';
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname/Name
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
||||
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
||||
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
|
||||
$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
||||
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide unauthorized button
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1);
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -353,28 +353,28 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide wiki link on login page
|
||||
$pictohelp='<span class="fa fa-question-circle"></span>';
|
||||
$pictohelp = '<span class="fa fa-question-circle"></span>';
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
|
||||
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1);
|
||||
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
print '<tr class="oddeven"><td class="titlefield">';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
$texthelp .= $key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
@ -391,23 +391,23 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Message on login page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
print '<tr class="oddeven"><td>';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
$texthelp .= $key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||
print '</td><td colspan="2">';
|
||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Hide helpcenter link on login page
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
|
||||
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1);
|
||||
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -416,13 +416,13 @@ print '</tr>';
|
||||
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
|
||||
print '<div class="centpercent inline-block">';
|
||||
$disabled = '';
|
||||
if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
|
||||
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
|
||||
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground"'.$disabled.'>';
|
||||
if ($disabled)
|
||||
{
|
||||
print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
|
||||
}
|
||||
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print ' ';
|
||||
|
||||
@ -119,16 +119,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -162,18 +162,18 @@ class Proposals extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -182,23 +182,23 @@ class Proposals extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
@ -213,7 +213,7 @@ class Proposals extends DolibarrApi
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$proposal_static = new Propal($db);
|
||||
if($proposal_static->fetch($obj->rowid)) {
|
||||
if ($proposal_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
|
||||
@ -224,7 +224,7 @@ class Proposals extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No proposal found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -238,13 +238,13 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
@ -272,16 +272,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
@ -304,16 +304,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -368,16 +368,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if($result <= 0) {
|
||||
if ($result <= 0) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -391,27 +391,27 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
||||
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
||||
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
||||
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
||||
isset($request_data->label)?$request_data->label:$propalline->label,
|
||||
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
||||
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
||||
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
||||
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
||||
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
@ -438,16 +438,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -479,13 +479,13 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -522,17 +522,17 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -555,16 +555,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach ($request_data as $field => $value) {
|
||||
@ -579,7 +579,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
if (!empty($this->propal->fin_validite))
|
||||
{
|
||||
if($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite)<0)
|
||||
if ($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite) < 0)
|
||||
{
|
||||
throw new RestException(500, $this->propal->error);
|
||||
}
|
||||
@ -604,19 +604,19 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
||||
}
|
||||
|
||||
@ -639,15 +639,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function settodraft($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -660,11 +660,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -696,15 +696,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -717,11 +717,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -744,15 +744,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function close($id, $status, $note_private = '', $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -765,11 +765,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -789,15 +789,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -807,11 +807,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
||||
@ -252,13 +252,13 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
@ -290,7 +290,7 @@ class Propal extends CommonObject
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>220),
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
* \brief File of class to manage proposals statistics
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -66,36 +66,36 @@ class PropaleStats extends Stats
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Propal($this->db);
|
||||
$object = new Propal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.datep';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->field_date = 'p.datep';
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0";
|
||||
$this->where .= " p.fk_statut > 0";
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$object=new SupplierProposal($this->db);
|
||||
$object = new SupplierProposal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.date_valid';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->field_date = 'p.date_valid';
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where.= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($this->socid)
|
||||
$this->where .= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND p.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND p.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) $this->where .= ' AND fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
|
||||
@ -111,14 +111,14 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -133,11 +133,11 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -154,14 +154,14 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -196,11 +196,11 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -219,13 +219,13 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
|
||||
@ -167,15 +167,15 @@ $arrayfields = array(
|
||||
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'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),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
@ -344,7 +344,7 @@ if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('p.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1099,7 +1099,7 @@ if ($resql)
|
||||
// Currency
|
||||
if (!empty($arrayfields['p.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1107,7 +1107,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -118,16 +118,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -163,18 +163,18 @@ class Orders extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('commande').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('commande').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -183,23 +183,23 @@ class Orders extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
@ -209,12 +209,12 @@ class Orders extends DolibarrApi
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$commande_static = new Commande($db);
|
||||
if($commande_static->fetch($obj->rowid)) {
|
||||
if ($commande_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
||||
@ -225,7 +225,7 @@ class Orders extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No order found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -239,13 +239,13 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
@ -274,16 +274,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->commande->getLinesArray();
|
||||
@ -306,16 +306,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
@ -368,16 +368,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
@ -430,16 +430,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -469,16 +469,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -507,16 +507,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -539,19 +539,19 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
@ -580,19 +580,19 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->commande->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when deleting order : '.$this->commande->error);
|
||||
}
|
||||
|
||||
@ -628,15 +628,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -648,11 +648,11 @@ class Orders extends DolibarrApi
|
||||
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -681,21 +681,21 @@ class Orders extends DolibarrApi
|
||||
public function reopen($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($id)) {
|
||||
if (empty($id)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->set_reopen(DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(405, $this->commande->error);
|
||||
}elseif( $result == 0) {
|
||||
}elseif ($result == 0) {
|
||||
throw new RestException(304);
|
||||
}
|
||||
|
||||
@ -719,28 +719,28 @@ class Orders extends DolibarrApi
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($id)) {
|
||||
if (empty($id)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->classifyBilled(DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(400, $this->commande->error);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -761,15 +761,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function close($id, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -782,11 +782,11 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -807,15 +807,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function settodraft($id, $idwarehouse = -1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -828,11 +828,11 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -859,26 +859,26 @@ class Orders extends DolibarrApi
|
||||
public function createOrderFromProposal($proposalid)
|
||||
{
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($proposalid)) {
|
||||
if (empty($proposalid)) {
|
||||
throw new RestException(400, 'Proposal ID is mandatory');
|
||||
}
|
||||
|
||||
$propal = new Propal($this->db);
|
||||
$result = $propal->fetch($proposalid);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->createFromProposal($propal, DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(405, $this->commande->error);
|
||||
}
|
||||
$this->commande->fetchObjectLinked();
|
||||
@ -921,7 +921,7 @@ class Orders extends DolibarrApi
|
||||
$commande = array();
|
||||
foreach (Orders::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, $field ." field missing");
|
||||
throw new RestException(400, $field." field missing");
|
||||
$commande[$field] = $data[$field];
|
||||
}
|
||||
return $commande;
|
||||
|
||||
@ -262,12 +262,12 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
* \ingroup commandes
|
||||
* \brief File of class to manage order statistics
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -67,31 +67,31 @@ class CommandeStats extends Stats
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Commande($this->db);
|
||||
$object = new Commande($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
elseif ($mode == 'supplier')
|
||||
{
|
||||
$object=new CommandeFournisseur($this->db);
|
||||
$object = new CommandeFournisseur($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->where.= " c.fk_statut > 2"; // Only approved & ordered
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
}
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where.= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
$this->where .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND c.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND c.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND c.fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) $this->where .= ' AND c.fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,14 +106,14 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -149,14 +149,14 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -171,12 +171,12 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -191,11 +191,11 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -212,13 +212,13 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
|
||||
@ -346,7 +346,7 @@ if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact
|
||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('c.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1168,7 +1168,7 @@ if ($resql)
|
||||
// Currency
|
||||
if (!empty($arrayfields['c.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1176,7 +1176,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['c.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
|
||||
// Customer invoices
|
||||
if (GETPOST('selectinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
@ -142,7 +142,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Vendor invoices
|
||||
if (GETPOST('selectsupplierinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
@ -151,7 +151,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Expense reports
|
||||
if (GETPOST('selectexpensereports')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE date_fin between ".$wheretail;
|
||||
@ -160,7 +160,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Donations
|
||||
if (GETPOST('selectdonations')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
|
||||
$sql .= " WHERE datedon between ".$wheretail;
|
||||
@ -169,7 +169,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Paiements of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
@ -178,7 +178,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Social contributions
|
||||
if (GETPOST('selectsocialcontributions')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
|
||||
$sql .= " WHERE date_creation between ".$wheretail;
|
||||
@ -467,7 +467,7 @@ print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
$mc->getInfo($conf->entity);
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)?' opacitymedium':'').'">('.$langs->trans("Entity").' : ';
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : ';
|
||||
print "<td>";
|
||||
if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
|
||||
@ -488,8 +488,8 @@ $listofchoices = array(
|
||||
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
|
||||
'selectsocialcontributions'=>array('label'=>'SocialContributions')
|
||||
);
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
$checked = (((! GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice))?' checked="checked"':'');
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" name="'.$choice.'" value="1"'.$checked.'> '.$langs->trans($val['label']).'</div>';
|
||||
}
|
||||
|
||||
@ -508,8 +508,8 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
$param .= '&date_stopday='.GETPOST('date_stopday', 'int');
|
||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
$param.='&'.$choice.'='.(GETPOST($choice, 'int')?1:0);
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
||||
}
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -518,7 +518,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
|
||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
|
||||
|
||||
@ -39,17 +39,17 @@ if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categori
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'accountancy', 'compta'));
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$massaction=GETPOST('massaction', 'alpha');
|
||||
$show_files=GETPOST('show_files', 'int');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bankaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bankaccountlist'; // To manage different context of search
|
||||
|
||||
$search_ref=GETPOST('search_ref', 'alpha');
|
||||
$search_label=GETPOST('search_label', 'alpha');
|
||||
$search_number=GETPOST('search_number', 'alpha');
|
||||
$search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_number = GETPOST('search_number', 'alpha');
|
||||
$search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened'
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
@ -58,13 +58,13 @@ if (!empty($conf->categorie->enabled))
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
if (! $allowed) $result=restrictedArea($user, 'banque');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
if (!$allowed) $result = restrictedArea($user, 'banque');
|
||||
|
||||
$diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction = $conf->bank->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
@ -82,7 +82,7 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
@ -108,10 +108,10 @@ $arrayfields = array(
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
@ -155,41 +155,41 @@ $accounts = array();
|
||||
|
||||
$sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.= $hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid");
|
||||
}
|
||||
|
||||
$sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||
$sql .= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql .= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql .= " AND clos = 1";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list);
|
||||
}
|
||||
|
||||
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
||||
if ($search_ref != '') $sql .= natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql .= natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql .= natural_search('b.number', $search_number);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -438,52 +438,52 @@ foreach ($accounts as $key=>$type)
|
||||
|
||||
$solde = $objecttmp->solde(1);
|
||||
|
||||
if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
|
||||
if (!empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
|
||||
{
|
||||
$lastcurrencycode='various'; // We found several different currencies
|
||||
$lastcurrencycode = 'various'; // We found several different currencies
|
||||
}
|
||||
if ($lastcurrencycode != 'various')
|
||||
{
|
||||
$lastcurrencycode=$objecttmp->currency_code;
|
||||
$lastcurrencycode = $objecttmp->currency_code;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.ref']['checked']))
|
||||
if (!empty($arrayfields['b.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['b.label']['checked']))
|
||||
if (!empty($arrayfields['b.label']['checked']))
|
||||
{
|
||||
print '<td>'.$objecttmp->label.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account type
|
||||
if (! empty($arrayfields['accountype']['checked']))
|
||||
if (!empty($arrayfields['accountype']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $objecttmp->type_lib[$objecttmp->type];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Number
|
||||
if (! empty($arrayfields['b.number']['checked']))
|
||||
if (!empty($arrayfields['b.number']['checked']))
|
||||
{
|
||||
print '<td>'.$objecttmp->number.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (! empty($arrayfields['b.account_number']['checked']))
|
||||
if (!empty($arrayfields['b.account_number']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled) && ! empty($objecttmp->account_number))
|
||||
if (!empty($conf->accounting->enabled) && !empty($objecttmp->account_number))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('', $objecttmp->account_number, 1);
|
||||
@ -494,14 +494,14 @@ foreach ($accounts as $key=>$type)
|
||||
print $objecttmp->account_number;
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
|
||||
if (!empty($arrayfields['b.fk_accountancy_journal']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled) && ! empty($objecttmp->fk_accountancy_journal))
|
||||
if (!empty($conf->accounting->enabled) && !empty($objecttmp->fk_accountancy_journal))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
|
||||
@ -547,47 +547,47 @@ foreach ($accounts as $key=>$type)
|
||||
print '<span class="opacitymedium">'.$langs->trans("FeatureDisabled").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['b.datec']['checked']))
|
||||
if (!empty($arrayfields['b.datec']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($objecttmp->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['b.tms']['checked']))
|
||||
if (!empty($arrayfields['b.tms']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($objecttmp->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Status
|
||||
if (! empty($arrayfields['b.clos']['checked']))
|
||||
if (!empty($arrayfields['b.clos']['checked']))
|
||||
{
|
||||
print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
if (!empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='balance';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance';
|
||||
$totalarray['val']['balance'] += $solde;
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ $langs->loadLangs(array('companies', 'users', 'trips'));
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'deplacement', '', '');
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -42,33 +42,33 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="d.dated";
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "d.dated";
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$tripandexpense_static=new Deplacement($db);
|
||||
$tripandexpense_static = new Deplacement($db);
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
$childids[] = $user->id;
|
||||
|
||||
//$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones';
|
||||
$help_url='';
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans("ListOfFees"), $help_url);
|
||||
|
||||
|
||||
|
||||
$totalnb=0;
|
||||
$totalnb = 0;
|
||||
$sql = "SELECT count(d.rowid) as nb, sum(d.km) as km, d.type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql.= " WHERE d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
$sql.= " GROUP BY d.type";
|
||||
$sql.= " ORDER BY d.type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql .= " WHERE d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql .= ' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
$sql .= " GROUP BY d.type";
|
||||
$sql .= " ORDER BY d.type";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -102,10 +102,10 @@ print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$listoftype=$tripandexpense_static->listOfTypes();
|
||||
$listoftype = $tripandexpense_static->listOfTypes();
|
||||
foreach ($listoftype as $code => $label)
|
||||
{
|
||||
$dataseries[]=array($label, (isset($nb[$code])?(int) $nb[$code]:0));
|
||||
$dataseries[] = array($label, (isset($nb[$code]) ? (int) $nb[$code] : 0));
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
@ -120,7 +120,7 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb?0:1);
|
||||
print $dolgraph->show($totalnb ? 0 : 1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -137,25 +137,25 @@ print '</table>';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
$max=10;
|
||||
$max = 10;
|
||||
|
||||
$langs->load("boxes");
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE u.rowid = d.fk_user";
|
||||
$sql.= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND d.fk_soc = ".$socid;
|
||||
$sql.= $db->order("d.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE u.rowid = d.fk_user";
|
||||
$sql .= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql .= ' AND d.fk_user IN ('.join(',', $childids).')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND d.fk_soc = ".$socid;
|
||||
$sql .= $db->order("d.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$var = false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
@ -171,16 +171,16 @@ if ($result)
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
|
||||
$deplacementstatic=new Deplacement($db);
|
||||
$userstatic=new User($db);
|
||||
$deplacementstatic = new Deplacement($db);
|
||||
$userstatic = new User($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$deplacementstatic->ref=$obj->rowid;
|
||||
$deplacementstatic->id=$obj->rowid;
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$deplacementstatic->ref = $obj->rowid;
|
||||
$deplacementstatic->id = $obj->rowid;
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$deplacementstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||
|
||||
@ -302,7 +302,7 @@ if (empty($reshook))
|
||||
// Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only).
|
||||
$array_of_total_ht_per_vat_rate = array();
|
||||
$array_of_total_ht_devise_per_vat_rate = array();
|
||||
foreach($object->lines as $line) {
|
||||
foreach ($object->lines as $line) {
|
||||
if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0;
|
||||
$array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht;
|
||||
@ -310,7 +310,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
//var_dump($array_of_total_ht_per_vat_rate);exit;
|
||||
foreach($array_of_total_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
foreach ($array_of_total_ht_per_vat_rate as $vatrate => $tmpvalue)
|
||||
{
|
||||
$tmp_total_ht = $array_of_total_ht_per_vat_rate[$vatrate];
|
||||
$tmp_total_ht_devise = $array_of_total_ht_devise_per_vat_rate[$vatrate];
|
||||
@ -1524,7 +1524,7 @@ if (empty($reshook))
|
||||
// If we create a deposit with all lines and a percent, we change amount
|
||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT && $typeamount == 'variablealllines') {
|
||||
if (is_array($lines)) {
|
||||
foreach($lines as $line) {
|
||||
foreach ($lines as $line) {
|
||||
// We keep ->subprice and ->pa_ht, but we change the qty
|
||||
$line->qty = price2num($line->qty * $valuedeposit / 100, 'MS');
|
||||
}
|
||||
@ -5119,7 +5119,7 @@ elseif ($id > 0 || !empty($ref))
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
||||
&& (! empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ class Facture extends CommonInvoice
|
||||
* @var int Ref Int
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int; // deprecated
|
||||
public $ref_int; // deprecated
|
||||
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
@ -261,7 +261,7 @@ class Facture extends CommonInvoice
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
|
||||
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||
//'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
@ -1499,7 +1499,7 @@ class Facture extends CommonInvoice
|
||||
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
|
||||
if ($ref) $sql .= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($notused) $sql .= " AND f.ref_int='".$this->db->escape($notused)."'"; // deprecated
|
||||
if ($notused) $sql .= " AND f.ref_int='".$this->db->escape($notused)."'"; // deprecated
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -2439,9 +2439,9 @@ class Facture extends CommonInvoice
|
||||
$productStatic = null;
|
||||
$warehouseStatic = null;
|
||||
if ($batch_rule > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productbatch.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
$productStatic = new Product($this->db);
|
||||
$warehouseStatic = new Entrepot($this->db);
|
||||
}
|
||||
@ -2621,7 +2621,7 @@ class Facture extends CommonInvoice
|
||||
$langs->load('errors');
|
||||
$warehouseStatic->fetch($idwarehouse);
|
||||
$this->error = $langs->trans('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
|
||||
dol_syslog(__METHOD__ . ' Error: ' . $langs->transnoentitiesnoconv('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
|
||||
dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
|
||||
}
|
||||
|
||||
foreach ($batchList as $batch) {
|
||||
@ -2660,7 +2660,7 @@ class Facture extends CommonInvoice
|
||||
$langs->load('errors');
|
||||
$warehouseStatic->fetch($idwarehouse);
|
||||
$this->error = $langs->trans('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref);
|
||||
dol_syslog(__METHOD__ . ' Error: ' . $langs->transnoentitiesnoconv('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
|
||||
dol_syslog(__METHOD__.' Error: '.$langs->transnoentitiesnoconv('ErrorBatchNoFoundEnoughQuantityForProductInWarehouse', $productStatic->label, $warehouseStatic->ref), LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,10 +22,10 @@
|
||||
* \ingroup factures
|
||||
* \brief Fichier de la classe de gestion des stats des factures
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
/**
|
||||
* Class to manage stats for invoices (customer and supplier)
|
||||
@ -64,32 +64,32 @@ class FactureStats extends Stats
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Facture($this->db);
|
||||
$object = new Facture($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as f";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total';
|
||||
$this->field_line='total_ht';
|
||||
$this->field = 'total';
|
||||
$this->field_line = 'total_ht';
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$object=new FactureFournisseur($this->db);
|
||||
$object = new FactureFournisseur($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as f";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
}
|
||||
|
||||
$this->where = " f.fk_statut >= 0";
|
||||
$this->where.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($mode == 'customer') $this->where.=" AND (f.fk_statut <> 3 OR f.close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons)
|
||||
$this->where .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($mode == 'customer') $this->where .= " AND (f.fk_statut <> 3 OR f.close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons)
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND f.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND f.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid;
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2,5)";
|
||||
else $this->where.= " AND f.type IN (0,1,2,3,5)";
|
||||
if ($this->userid > 0) $this->where .= ' AND f.fk_user_author = '.$this->userid;
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where .= " AND f.type IN (0,1,2,5)";
|
||||
else $this->where .= " AND f.type IN (0,1,2,3,5)";
|
||||
}
|
||||
|
||||
|
||||
@ -105,14 +105,14 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(f.datef,'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
//var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
@ -128,11 +128,11 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -150,14 +150,14 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
//var_dump($res);print '<br>';
|
||||
return $res;
|
||||
}
|
||||
@ -173,12 +173,12 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -193,11 +193,11 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -214,13 +214,13 @@ class FactureStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
|
||||
@ -477,7 +477,7 @@ if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_v
|
||||
if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1);
|
||||
if ($search_montant_localtax2 != '') $sql .= natural_search('f.localtax2', $search_montant_localtax2, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1402,7 +1402,7 @@ if ($resql)
|
||||
// Currency
|
||||
if (!empty($arrayfields['f.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1410,7 +1410,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -23,18 +23,18 @@
|
||||
* \brief Code for actions on extrafields admin pages
|
||||
*/
|
||||
|
||||
$maxsizestring=255;
|
||||
$maxsizeint=10;
|
||||
$mesg=array();
|
||||
$maxsizestring = 255;
|
||||
$maxsizeint = 10;
|
||||
$mesg = array();
|
||||
|
||||
$extrasize=GETPOST('size', 'intcomma');
|
||||
$type=GETPOST('type', 'alpha');
|
||||
$param=GETPOST('param', 'alpha');
|
||||
$extrasize = GETPOST('size', 'intcomma');
|
||||
$type = GETPOST('type', 'alpha');
|
||||
$param = GETPOST('param', 'alpha');
|
||||
|
||||
if ($type=='double' && strpos($extrasize, ',')===false) $extrasize='24,8';
|
||||
if ($type=='date') $extrasize='';
|
||||
if ($type=='datetime') $extrasize='';
|
||||
if ($type=='select') $extrasize='';
|
||||
if ($type == 'double' && strpos($extrasize, ',') === false) $extrasize = '24,8';
|
||||
if ($type == 'date') $extrasize = '';
|
||||
if ($type == 'datetime') $extrasize = '';
|
||||
if ($type == 'select') $extrasize = '';
|
||||
|
||||
|
||||
// Add attribute
|
||||
@ -43,83 +43,83 @@ if ($action == 'add')
|
||||
if ($_POST["button"] != $langs->trans("Cancel"))
|
||||
{
|
||||
// Check values
|
||||
if (! $type)
|
||||
if (!$type)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
|
||||
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='varchar' && $extrasize <= 0)
|
||||
if ($type == 'varchar' && $extrasize <= 0)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
|
||||
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='varchar' && $extrasize > $maxsizestring)
|
||||
if ($type == 'varchar' && $extrasize > $maxsizestring)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
|
||||
$mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='int' && $extrasize > $maxsizeint)
|
||||
if ($type == 'int' && $extrasize > $maxsizeint)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
|
||||
$mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='select' && !$param)
|
||||
if ($type == 'select' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForSelectType");
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='sellist' && !$param)
|
||||
if ($type == 'sellist' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForSelectListType");
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='checkbox' && !$param)
|
||||
if ($type == 'checkbox' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForCheckBoxType");
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='link' && !$param)
|
||||
if ($type == 'link' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForLinkType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForLinkType");
|
||||
$action = 'create';
|
||||
}
|
||||
if ($type=='radio' && !$param)
|
||||
if ($type == 'radio' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForRadioType");
|
||||
$action = 'create';
|
||||
}
|
||||
if ((($type=='radio') || ($type=='checkbox')) && $param)
|
||||
if ((($type == 'radio') || ($type == 'checkbox')) && $param)
|
||||
{
|
||||
// Construct array for parameter (value of select list)
|
||||
$parameters = $param;
|
||||
$parameters_array = explode("\r\n", $parameters);
|
||||
foreach($parameters_array as $param_ligne)
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
if (!empty($param_ligne)) {
|
||||
if (preg_match_all('/,/', $param_ligne, $matches))
|
||||
{
|
||||
if (count($matches[0])>1) {
|
||||
if (count($matches[0]) > 1) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
@ -127,14 +127,14 @@ if ($action == 'add')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
// attrname must be alphabetical and lower case only
|
||||
if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/", $_POST['attrname']) && !is_numeric($_POST["attrname"]))
|
||||
@ -144,8 +144,8 @@ if ($action == 'add')
|
||||
$parameters = $param;
|
||||
$parameters_array = explode("\r\n", $parameters);
|
||||
//In sellist we have only one line and it can have come to do SQL expression
|
||||
if ($type=='sellist') {
|
||||
foreach($parameters_array as $param_ligne)
|
||||
if ($type == 'sellist') {
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
$params['options'] = array($parameters=>null);
|
||||
}
|
||||
@ -153,37 +153,37 @@ if ($action == 'add')
|
||||
else
|
||||
{
|
||||
//Esle it's separated key/value and coma list
|
||||
foreach($parameters_array as $param_ligne)
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
list($key,$value) = explode(',', $param_ligne);
|
||||
list($key, $value) = explode(',', $param_ligne);
|
||||
$params['options'][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
if ($type == 'separate') $visibility = 3;
|
||||
|
||||
$result=$extrafields->addExtraField(
|
||||
$result = $extrafields->addExtraField(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
$type,
|
||||
GETPOST('pos', 'int'),
|
||||
$extrasize,
|
||||
$elementtype,
|
||||
(GETPOST('unique', 'alpha')?1:0),
|
||||
(GETPOST('required', 'alpha')?1:0),
|
||||
(GETPOST('unique', 'alpha') ? 1 : 0),
|
||||
(GETPOST('required', 'alpha') ? 1 : 0),
|
||||
$default_value,
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
(GETPOST('alwayseditable', 'alpha') ? 1 : 0),
|
||||
(GETPOST('perms', 'alpha') ?GETPOST('perms', 'alpha') : ''),
|
||||
$visibility,
|
||||
GETPOST('help', 'alpha'),
|
||||
GETPOST('computed_value', 'alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
|
||||
GETPOST('langfile', 'alpha'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('totalizable', 'alpha') ? 1 : 0),
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
@ -195,7 +195,7 @@ if ($action == 'add')
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$mesg=$extrafields->error;
|
||||
$mesg = $extrafields->error;
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ if ($action == 'add')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode"));
|
||||
$mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
@ -221,76 +221,76 @@ if ($action == 'update')
|
||||
if ($_POST["button"] != $langs->trans("Cancel"))
|
||||
{
|
||||
// Check values
|
||||
if (! $type)
|
||||
if (!$type)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
|
||||
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"));
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='varchar' && $extrasize <= 0)
|
||||
if ($type == 'varchar' && $extrasize <= 0)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
|
||||
$mesg[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Size"));
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='varchar' && $extrasize > $maxsizestring)
|
||||
if ($type == 'varchar' && $extrasize > $maxsizestring)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
|
||||
$mesg[] = $langs->trans("ErrorSizeTooLongForVarcharType", $maxsizestring);
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='int' && $extrasize > $maxsizeint)
|
||||
if ($type == 'int' && $extrasize > $maxsizeint)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
|
||||
$mesg[] = $langs->trans("ErrorSizeTooLongForIntType", $maxsizeint);
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='select' && !$param)
|
||||
if ($type == 'select' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForSelectType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='sellist' && !$param)
|
||||
if ($type == 'sellist' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForSelectListType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForSelectListType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='checkbox' && !$param)
|
||||
if ($type == 'checkbox' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForCheckBoxType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForCheckBoxType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if ($type=='radio' && !$param)
|
||||
if ($type == 'radio' && !$param)
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorNoValueForRadioType");
|
||||
$mesg[] = $langs->trans("ErrorNoValueForRadioType");
|
||||
$action = 'edit';
|
||||
}
|
||||
if ((($type=='radio') || ($type=='checkbox')) && $param)
|
||||
if ((($type == 'radio') || ($type == 'checkbox')) && $param)
|
||||
{
|
||||
// Construct array for parameter (value of select list)
|
||||
$parameters = $param;
|
||||
$parameters_array = explode("\r\n", $parameters);
|
||||
foreach($parameters_array as $param_ligne)
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
if (!empty($param_ligne)) {
|
||||
if (preg_match_all('/,/', $param_ligne, $matches))
|
||||
{
|
||||
if (count($matches[0])>1) {
|
||||
if (count($matches[0]) > 1) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
@ -298,14 +298,14 @@ if ($action == 'update')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[]=$langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne);
|
||||
$action = 'edit';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $_POST['attrname']))
|
||||
{
|
||||
@ -314,8 +314,8 @@ if ($action == 'update')
|
||||
$parameters = $param;
|
||||
$parameters_array = explode("\r\n", $parameters);
|
||||
//In sellist we have only one line and it can have come to do SQL expression
|
||||
if ($type=='sellist') {
|
||||
foreach($parameters_array as $param_ligne)
|
||||
if ($type == 'sellist') {
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
$params['options'] = array($parameters=>null);
|
||||
}
|
||||
@ -323,37 +323,37 @@ if ($action == 'update')
|
||||
else
|
||||
{
|
||||
//Esle it's separated key/value and coma list
|
||||
foreach($parameters_array as $param_ligne)
|
||||
foreach ($parameters_array as $param_ligne)
|
||||
{
|
||||
list($key,$value) = explode(',', $param_ligne);
|
||||
list($key, $value) = explode(',', $param_ligne);
|
||||
$params['options'][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility: -1=not visible by default in list, 1=visible, 0=hidden
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
if ($type == 'separate') $visibility=3;
|
||||
if ($type == 'separate') $visibility = 3;
|
||||
|
||||
$result=$extrafields->update(
|
||||
$result = $extrafields->update(
|
||||
GETPOST('attrname', 'alpha'),
|
||||
GETPOST('label', 'alpha'),
|
||||
$type,
|
||||
$extrasize,
|
||||
$elementtype,
|
||||
(GETPOST('unique', 'alpha')?1:0),
|
||||
(GETPOST('required', 'alpha')?1:0),
|
||||
(GETPOST('unique', 'alpha') ? 1 : 0),
|
||||
(GETPOST('required', 'alpha') ? 1 : 0),
|
||||
$pos,
|
||||
$params,
|
||||
(GETPOST('alwayseditable', 'alpha')?1:0),
|
||||
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
|
||||
(GETPOST('alwayseditable', 'alpha') ? 1 : 0),
|
||||
(GETPOST('perms', 'alpha') ?GETPOST('perms', 'alpha') : ''),
|
||||
$visibility,
|
||||
GETPOST('help', 'alpha'),
|
||||
GETPOST('default_value', 'alpha'),
|
||||
GETPOST('computed_value', 'alpha'),
|
||||
(GETPOST('entitycurrentorall', 'alpha')?0:''),
|
||||
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
|
||||
GETPOST('langfile'),
|
||||
1,
|
||||
(GETPOST('totalizable', 'alpha')?1:0),
|
||||
(GETPOST('totalizable', 'alpha') ? 1 : 0),
|
||||
GETPOST('printable', 'alpha')
|
||||
);
|
||||
if ($result > 0)
|
||||
@ -365,7 +365,7 @@ if ($action == 'update')
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$mesg=$extrafields->error;
|
||||
$mesg = $extrafields->error;
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
}
|
||||
@ -373,7 +373,7 @@ if ($action == 'update')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode"));
|
||||
$mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode"));
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
}
|
||||
}
|
||||
@ -387,20 +387,20 @@ if ($action == 'update')
|
||||
// Delete attribute
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if(isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $_GET["attrname"]))
|
||||
if (isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/", $_GET["attrname"]))
|
||||
{
|
||||
$result=$extrafields->delete($_GET["attrname"], $elementtype);
|
||||
$result = $extrafields->delete($_GET["attrname"], $elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else $mesg=$extrafields->error;
|
||||
else $mesg = $extrafields->error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode"));
|
||||
$mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data1 as $key => $val)
|
||||
foreach ($data1 as $key => $val)
|
||||
{
|
||||
$data1[$key][0] = dol_trunc($data1[$key][0], 32);
|
||||
$legend[] = $data1[$key][0];
|
||||
@ -222,7 +222,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data2 as $key => $val)
|
||||
foreach ($data2 as $key => $val)
|
||||
{
|
||||
$data2[$key][0] = dol_trunc($data2[$key][0], 32);
|
||||
$legend[] = $data2[$key][0];
|
||||
@ -282,7 +282,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
$i = 0; $legend = array();
|
||||
|
||||
foreach($data3 as $key => $val)
|
||||
foreach ($data3 as $key => $val)
|
||||
{
|
||||
$data3[$key][0] = dol_trunc($data3[$key][0], 32);
|
||||
$legend[] = $data3[$key][0];
|
||||
|
||||
@ -36,7 +36,7 @@ class Canvas
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
@ -45,13 +45,13 @@ class Canvas
|
||||
|
||||
public $actiontype;
|
||||
|
||||
public $dirmodule; // Module directory
|
||||
public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
|
||||
public $canvas; // Name of canvas (ex: company, individual, product, service, ...)
|
||||
public $card; // Tab (sub-canvas)
|
||||
public $dirmodule; // Module directory
|
||||
public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
|
||||
public $canvas; // Name of canvas (ex: company, individual, product, service, ...)
|
||||
public $card; // Tab (sub-canvas)
|
||||
|
||||
public $template_dir; // Initialized by getCanvas with templates directory
|
||||
public $control; // Initialized by getCanvas with controller instance
|
||||
public $template_dir; // Initialized by getCanvas with templates directory
|
||||
public $control; // Initialized by getCanvas with controller instance
|
||||
|
||||
|
||||
/**
|
||||
@ -76,9 +76,9 @@ class Canvas
|
||||
private function _cleanaction($action)
|
||||
{
|
||||
$newaction = $action;
|
||||
if ($newaction == 'add') $newaction='create';
|
||||
if ($newaction == 'update') $newaction='edit';
|
||||
if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user' || $newaction == 'presend' || $newaction == 'send') $newaction='view';
|
||||
if ($newaction == 'add') $newaction = 'create';
|
||||
if ($newaction == 'update') $newaction = 'edit';
|
||||
if (empty($newaction) || $newaction == 'delete' || $newaction == 'create_user' || $newaction == 'presend' || $newaction == 'send') $newaction = 'view';
|
||||
return $newaction;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ class Canvas
|
||||
if (file_exists($controlclassfile))
|
||||
{
|
||||
// Include actions class (controller)
|
||||
$this->control_file=$controlclassfile;
|
||||
$this->control_file = $controlclassfile;
|
||||
require_once $controlclassfile;
|
||||
|
||||
// Instantiate actions class (controller)
|
||||
@ -124,9 +124,9 @@ class Canvas
|
||||
|
||||
// Template dir
|
||||
$this->template_dir = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/tpl/');
|
||||
if (! is_dir($this->template_dir))
|
||||
if (!is_dir($this->template_dir))
|
||||
{
|
||||
$this->template_dir='';
|
||||
$this->template_dir = '';
|
||||
}
|
||||
|
||||
//print 'dimodule='.$dirmodule.' canvas='.$this->canvas.'<br>';
|
||||
@ -158,7 +158,7 @@ class Canvas
|
||||
{
|
||||
if (empty($this->template_dir)) return 0;
|
||||
|
||||
if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ class Canvas
|
||||
global $form, $formfile;
|
||||
|
||||
//var_dump($this->card.'-'.$action);
|
||||
include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
include $this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -221,24 +221,24 @@ abstract class CommonDocGenerator
|
||||
);
|
||||
|
||||
// Retrieve extrafields
|
||||
if(is_array($object->array_options) && count($object->array_options))
|
||||
if (is_array($object->array_options) && count($object->array_options))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals();
|
||||
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
{
|
||||
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
{
|
||||
$object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
$array_thirdparty = array_merge($array_thirdparty, array ('company_options_'.$key => $object->array_options ['options_' . $key]));
|
||||
$array_thirdparty = array_merge($array_thirdparty, array('company_options_'.$key => $object->array_options ['options_'.$key]));
|
||||
}
|
||||
}
|
||||
return $array_thirdparty;
|
||||
@ -258,61 +258,61 @@ abstract class CommonDocGenerator
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
if(empty($object->country) && ! empty($object->country_code))
|
||||
if (empty($object->country) && !empty($object->country_code))
|
||||
{
|
||||
$object->country = $outputlangs->transnoentitiesnoconv("Country" . $object->country_code);
|
||||
$object->country = $outputlangs->transnoentitiesnoconv("Country".$object->country_code);
|
||||
}
|
||||
if(empty($object->state) && ! empty($object->state_code))
|
||||
if (empty($object->state) && !empty($object->state_code))
|
||||
{
|
||||
$object->state = getState($object->state_code, 0);
|
||||
}
|
||||
|
||||
$array_contact = array (
|
||||
$array_key . '_fullname' => $object->getFullName($outputlangs, 1),
|
||||
$array_key . '_lastname' => $object->lastname,
|
||||
$array_key . '_firstname' => $object->firstname,
|
||||
$array_key . '_address' => $object->address,
|
||||
$array_key . '_zip' => $object->zip,
|
||||
$array_key . '_town' => $object->town,
|
||||
$array_key . '_state_id' => $object->state_id,
|
||||
$array_key . '_state_code' => $object->state_code,
|
||||
$array_key . '_state' => $object->state,
|
||||
$array_key . '_country_id' => $object->country_id,
|
||||
$array_key . '_country_code' => $object->country_code,
|
||||
$array_key . '_country' => $object->country,
|
||||
$array_key . '_poste' => $object->poste,
|
||||
$array_key . '_socid' => $object->socid,
|
||||
$array_key . '_statut' => $object->statut,
|
||||
$array_key . '_code' => $object->code,
|
||||
$array_key . '_email' => $object->email,
|
||||
$array_key . '_jabberid' => $object->jabberid,
|
||||
$array_key . '_phone_pro' => $object->phone_pro,
|
||||
$array_key . '_phone_perso' => $object->phone_perso,
|
||||
$array_key . '_phone_mobile' => $object->phone_mobile,
|
||||
$array_key . '_fax' => $object->fax,
|
||||
$array_key . '_birthday' => $object->birthday,
|
||||
$array_key . '_default_lang' => $object->default_lang,
|
||||
$array_key . '_note_public' => $object->note_public,
|
||||
$array_key . '_note_private' => $object->note_private
|
||||
$array_contact = array(
|
||||
$array_key.'_fullname' => $object->getFullName($outputlangs, 1),
|
||||
$array_key.'_lastname' => $object->lastname,
|
||||
$array_key.'_firstname' => $object->firstname,
|
||||
$array_key.'_address' => $object->address,
|
||||
$array_key.'_zip' => $object->zip,
|
||||
$array_key.'_town' => $object->town,
|
||||
$array_key.'_state_id' => $object->state_id,
|
||||
$array_key.'_state_code' => $object->state_code,
|
||||
$array_key.'_state' => $object->state,
|
||||
$array_key.'_country_id' => $object->country_id,
|
||||
$array_key.'_country_code' => $object->country_code,
|
||||
$array_key.'_country' => $object->country,
|
||||
$array_key.'_poste' => $object->poste,
|
||||
$array_key.'_socid' => $object->socid,
|
||||
$array_key.'_statut' => $object->statut,
|
||||
$array_key.'_code' => $object->code,
|
||||
$array_key.'_email' => $object->email,
|
||||
$array_key.'_jabberid' => $object->jabberid,
|
||||
$array_key.'_phone_pro' => $object->phone_pro,
|
||||
$array_key.'_phone_perso' => $object->phone_perso,
|
||||
$array_key.'_phone_mobile' => $object->phone_mobile,
|
||||
$array_key.'_fax' => $object->fax,
|
||||
$array_key.'_birthday' => $object->birthday,
|
||||
$array_key.'_default_lang' => $object->default_lang,
|
||||
$array_key.'_note_public' => $object->note_public,
|
||||
$array_key.'_note_private' => $object->note_private
|
||||
);
|
||||
|
||||
// Retrieve extrafields
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element, true);
|
||||
$object->fetch_optionals();
|
||||
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label)
|
||||
{
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
{
|
||||
$object->array_options['options_' . $key] = price($object->array_options ['options_' . $key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
||||
$object->array_options['options_'.$key] = price($object->array_options ['options_'.$key], 0, $outputlangs, 0, 0, - 1, $conf->currency);
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox')
|
||||
{
|
||||
$object->array_options['options_' . $key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_' . $key]];
|
||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
$array_contact = array_merge($array_contact, array($array_key.'_options_' . $key => $object->array_options['options_'. $key]));
|
||||
$array_contact = array_merge($array_contact, array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
|
||||
}
|
||||
return $array_contact;
|
||||
}
|
||||
@ -478,20 +478,20 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
// Add vat by rates
|
||||
if (is_array($object->lines) && count($object->lines)>0)
|
||||
if (is_array($object->lines) && count($object->lines) > 0)
|
||||
{
|
||||
$totalUp = 0;
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward compatibility
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx] = 0;
|
||||
$resarray[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx] = price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
|
||||
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
|
||||
$vatformated=vatrate($line->tva_tx);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
|
||||
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
|
||||
$vatformated = vatrate($line->tva_tx);
|
||||
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated] = 0;
|
||||
$resarray[$array_key.'_total_vat_'.$vatformated] += $line->total_tva;
|
||||
$resarray[$array_key.'_total_vat_locale_'.$vatformated] = price($resarray[$array_key.'_total_vat_'.$vatformated]);
|
||||
|
||||
$totalUp += $line->subprice * $line->qty;
|
||||
}
|
||||
@ -589,13 +589,13 @@ abstract class CommonDocGenerator
|
||||
// Units
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long'));
|
||||
$resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short'));
|
||||
$resarray['line_unit'] = $outputlangs->trans($line->getLabelOfUnit('long'));
|
||||
$resarray['line_unit_short'] = $outputlangs->trans($line->getLabelOfUnit('short'));
|
||||
}
|
||||
|
||||
// Retrieve extrafields
|
||||
$extrafieldkey=$line->element;
|
||||
$array_key="line";
|
||||
$extrafieldkey = $line->element;
|
||||
$array_key = "line";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$extrafields->fetch_name_optionals_label($extrafieldkey, true);
|
||||
@ -608,7 +608,7 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
// Add the product supplier extrafields to the substitutions
|
||||
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
|
||||
|
||||
if (!empty($extralabels) && is_array($extralabels))
|
||||
{
|
||||
@ -622,7 +622,7 @@ abstract class CommonDocGenerator
|
||||
if ($columns != "")
|
||||
{
|
||||
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||
$resql = $this->db->query("SELECT $columns FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields AS ex INNER JOIN ".MAIN_DB_PREFIX."product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '".$line->ref_supplier."'");
|
||||
|
||||
if ($this->db->num_rows($resql) > 0)
|
||||
{
|
||||
@ -737,14 +737,14 @@ abstract class CommonDocGenerator
|
||||
'line_qty'=>$line->qty,
|
||||
'line_qty_shipped'=>$line->qty_shipped,
|
||||
'line_qty_asked'=>$line->qty_asked,
|
||||
'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''),
|
||||
'line_discount_percent'=>($line->remise_percent ? $line->remise_percent.'%' : ''),
|
||||
'line_price_ht'=>price($line->total_ht),
|
||||
'line_price_ttc'=>price($line->total_ttc),
|
||||
'line_price_vat'=>price($line->total_tva),
|
||||
'line_weight'=>empty($line->weight) ? '' : $line->weight*$line->qty_shipped.' '.measuringUnitString(0, 'weight', $line->weight_units),
|
||||
'line_length'=>empty($line->length) ? '' : $line->length*$line->qty_shipped.' '.measuringUnitString(0, 'size', $line->length_units),
|
||||
'line_surface'=>empty($line->surface) ? '' : $line->surface*$line->qty_shipped.' '.measuringUnitString(0, 'surface', $line->surface_units),
|
||||
'line_volume'=>empty($line->volume) ? '' : $line->volume*$line->qty_shipped.' '.measuringUnitString(0, 'volume', $line->volume_units),
|
||||
'line_weight'=>empty($line->weight) ? '' : $line->weight * $line->qty_shipped.' '.measuringUnitString(0, 'weight', $line->weight_units),
|
||||
'line_length'=>empty($line->length) ? '' : $line->length * $line->qty_shipped.' '.measuringUnitString(0, 'size', $line->length_units),
|
||||
'line_surface'=>empty($line->surface) ? '' : $line->surface * $line->qty_shipped.' '.measuringUnitString(0, 'surface', $line->surface_units),
|
||||
'line_volume'=>empty($line->volume) ? '' : $line->volume * $line->qty_shipped.' '.measuringUnitString(0, 'volume', $line->volume_units),
|
||||
);
|
||||
|
||||
// Retrieve extrafields
|
||||
@ -807,37 +807,37 @@ abstract class CommonDocGenerator
|
||||
global $conf;
|
||||
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label)
|
||||
{
|
||||
if($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price')
|
||||
{
|
||||
$object->array_options['options_'.$key] = price2num($object->array_options['options_'.$key]);
|
||||
$object->array_options['options_'.$key.'_currency'] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency);
|
||||
//Add value to store price with currency
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select')
|
||||
{
|
||||
$object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]];
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
|
||||
$valArray=explode(',', $object->array_options['options_'.$key]);
|
||||
$output=array();
|
||||
foreach($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
|
||||
if (in_array($keyopt, $valArray)) {
|
||||
$output[]=$valopt;
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') {
|
||||
$valArray = explode(',', $object->array_options['options_'.$key]);
|
||||
$output = array();
|
||||
foreach ($extrafields->attributes[$object->table_element]['param'][$key]['options'] as $keyopt=>$valopt) {
|
||||
if (in_array($keyopt, $valArray)) {
|
||||
$output[] = $valopt;
|
||||
}
|
||||
}
|
||||
$object->array_options['options_'.$key] = implode(', ', $output);
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'date')
|
||||
{
|
||||
if (strlen($object->array_options['options_'.$key])>0)
|
||||
if (strlen($object->array_options['options_'.$key]) > 0)
|
||||
{
|
||||
$date = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
|
||||
$object->array_options['options_'.$key] = dol_print_date($date, 'day'); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date, 'day', 'tzserver', $outputlangs); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date, 'dayrfc'); // international format
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -845,29 +845,29 @@ abstract class CommonDocGenerator
|
||||
$object->array_options['options_'.$key.'_locale'] = '';
|
||||
$object->array_options['options_'.$key.'_rfc'] = '';
|
||||
}
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
|
||||
elseif ($extrafields->attributes[$object->table_element]['label'][$key] == 'datetime')
|
||||
{
|
||||
$datetime = $object->array_options['options_'.$key];
|
||||
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour'):''); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs):''); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc'):''); // international format
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill=array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
$object->array_options['options_'.$key] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhour') : ''); // using company output language
|
||||
$object->array_options['options_'.$key.'_locale'] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhour', 'tzserver', $outputlangs) : ''); // using output language format
|
||||
$object->array_options['options_'.$key.'_rfc'] = ($datetime != "0000-00-00 00:00:00" ?dol_print_date($object->array_options['options_'.$key], 'dayhourrfc') : ''); // international format
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
|
||||
$array_to_fill = array_merge($array_to_fill, array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
|
||||
}
|
||||
elseif($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
|
||||
elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'link')
|
||||
{
|
||||
$id = $object->array_options['options_'.$key];
|
||||
if ($id != "")
|
||||
{
|
||||
$param = $extrafields->attributes[$object->table_element]['param'][$key];
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$classname=$InfoFieldList[0];
|
||||
$classpath=$InfoFieldList[1];
|
||||
if (! empty($classpath))
|
||||
$classname = $InfoFieldList[0];
|
||||
$classpath = $InfoFieldList[1];
|
||||
if (!empty($classpath))
|
||||
{
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
if ($classname && class_exists($classname))
|
||||
@ -948,27 +948,27 @@ abstract class CommonDocGenerator
|
||||
uasort($this->cols, array($this, 'columnSort'));
|
||||
|
||||
// Positionning
|
||||
$curX = $this->page_largeur-$this->marge_droite; // start from right
|
||||
$curX = $this->page_largeur - $this->marge_droite; // start from right
|
||||
|
||||
// Array width
|
||||
$arrayWidth = $this->page_largeur-$this->marge_droite-$this->marge_gauche;
|
||||
$arrayWidth = $this->page_largeur - $this->marge_droite - $this->marge_gauche;
|
||||
|
||||
// Count flexible column
|
||||
$totalDefinedColWidth = 0;
|
||||
$countFlexCol = 0;
|
||||
foreach ($this->cols as $colKey =>& $colDef)
|
||||
{
|
||||
if(!$this->getColumnStatus($colKey)) continue; // continue if disabled
|
||||
if (!$this->getColumnStatus($colKey)) continue; // continue if disabled
|
||||
|
||||
if(!empty($colDef['scale'])){
|
||||
if (!empty($colDef['scale'])) {
|
||||
// In case of column width is defined by percentage
|
||||
$colDef['width'] = abs($arrayWidth * $colDef['scale'] / 100);
|
||||
}
|
||||
|
||||
if(empty($colDef['width'])){
|
||||
if (empty($colDef['width'])) {
|
||||
$countFlexCol++;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
$totalDefinedColWidth += $colDef['width'];
|
||||
}
|
||||
}
|
||||
@ -1161,7 +1161,7 @@ abstract class CommonDocGenerator
|
||||
'printableEnableNotEmpty' => array(4)
|
||||
);
|
||||
$extrafieldDesc = $this->getExtrafieldsInHtml($object->lines[$i], $outputlangs, $params);
|
||||
if(!empty($extrafieldDesc)){
|
||||
if (!empty($extrafieldDesc)) {
|
||||
$this->printStdColumnContent($pdf, $posYAfterDescription, $colKey, $extrafieldDesc);
|
||||
}
|
||||
}
|
||||
@ -1178,13 +1178,13 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if(empty($object->table_element)){ return; }
|
||||
if (empty($object->table_element)) { return; }
|
||||
|
||||
$extrafieldsKeyPrefix = "options_";
|
||||
|
||||
// Cleanup extrafield key to remove prefix if present
|
||||
$pos = strpos($extrafieldKey, $extrafieldsKeyPrefix);
|
||||
if($pos===0){
|
||||
if ($pos === 0) {
|
||||
$extrafieldKey = substr($extrafieldKey, strlen($extrafieldsKeyPrefix));
|
||||
}
|
||||
|
||||
@ -1192,14 +1192,14 @@ abstract class CommonDocGenerator
|
||||
|
||||
|
||||
// Load extrafiels if not allready does
|
||||
if(empty($this->extrafieldsCache)){ $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if(empty($this->extrafieldsCache->attributes[$object->table_element])){ $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
if (empty($this->extrafieldsCache)) { $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
$extrafields = $this->extrafieldsCache;
|
||||
|
||||
$extrafieldOutputContent = $extrafields->showOutputField($extrafieldKey, $object->array_options[$extrafieldOptionsKey], '', $object->table_element);
|
||||
|
||||
// TODO : allow showOutputField to be pdf public friendly, ex: in a link to object, clean getNomUrl to remove link and images... like a getName methode ...
|
||||
if($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link'){
|
||||
if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'link') {
|
||||
// for lack of anything better we cleanup all html tags
|
||||
$extrafieldOutputContent = dol_string_nohtmltag($extrafieldOutputContent);
|
||||
}
|
||||
@ -1233,13 +1233,13 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if(empty($object->table_element)){
|
||||
if (empty($object->table_element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load extrafiels if not allready does
|
||||
if(empty($this->extrafieldsCache)){ $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if(empty($this->extrafieldsCache->attributes[$object->table_element])){ $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
if (empty($this->extrafieldsCache)) { $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
$extrafields = $this->extrafieldsCache;
|
||||
|
||||
$defaultParams = array(
|
||||
@ -1283,9 +1283,9 @@ abstract class CommonDocGenerator
|
||||
// Enable extrafield ?
|
||||
$enabled = 0;
|
||||
$disableOnEmpty = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if(in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty']) ) {
|
||||
if (in_array($printable, $params['printableEnable']) || in_array($printable, $params['printableEnableNotEmpty'])) {
|
||||
$enabled = 1;
|
||||
}
|
||||
|
||||
@ -1294,7 +1294,7 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($enabled)){
|
||||
if (empty($enabled)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1305,7 +1305,7 @@ abstract class CommonDocGenerator
|
||||
$field->type = $extrafields->attributes[$object->table_element]['type'][$key];
|
||||
|
||||
// dont display if empty
|
||||
if($disableOnEmpty && empty($field->content)) {
|
||||
if ($disableOnEmpty && empty($field->content)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1313,7 +1313,7 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($fields))
|
||||
if (!empty($fields))
|
||||
{
|
||||
// Sort extrafields by rank
|
||||
uasort($fields, function ($a, $b) {
|
||||
@ -1321,32 +1321,32 @@ abstract class CommonDocGenerator
|
||||
});
|
||||
|
||||
// define some HTML content with style
|
||||
$html.= !empty($params['style'])?'<style>'.$params['style'].'</style>':'';
|
||||
$html .= !empty($params['style']) ? '<style>'.$params['style'].'</style>' : '';
|
||||
|
||||
// auto select display format
|
||||
if($params['display'] == 'auto') {
|
||||
if ($params['display'] == 'auto') {
|
||||
$lastNnumbItems = 0;
|
||||
foreach ($params['auto'] as $display => $numbItems){
|
||||
if($lastNnumbItems <= $numbItems && count($fields) > $numbItems){
|
||||
foreach ($params['auto'] as $display => $numbItems) {
|
||||
if ($lastNnumbItems <= $numbItems && count($fields) > $numbItems) {
|
||||
$lastNnumbItems = $numbItems;
|
||||
$params['display'] = $display;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($params['display'] == 'list') {
|
||||
if ($params['display'] == 'list') {
|
||||
// Display in list format
|
||||
$i=0;
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
$html .= !empty($i)?$params['list']['separator']:'';
|
||||
$html .= '<strong>' . $field->label . ' : </strong>';
|
||||
$html .= !empty($i) ? $params['list']['separator'] : '';
|
||||
$html .= '<strong>'.$field->label.' : </strong>';
|
||||
$html .= $field->content;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
elseif($params['display'] == 'table') {
|
||||
elseif ($params['display'] == 'table') {
|
||||
// Display in table format
|
||||
$html .= '<table class="extrafield-table" cellspacing="' . $params['table']['cellspacing'] . '" cellpadding="' . $params['table']['cellpadding'] . '" border="' . $params['table']['border'] . '">';
|
||||
$html .= '<table class="extrafield-table" cellspacing="'.$params['table']['cellspacing'].'" cellpadding="'.$params['table']['cellpadding'].'" border="'.$params['table']['border'].'">';
|
||||
|
||||
$html .= "<tr>";
|
||||
$itemsInRow = 0;
|
||||
@ -1373,14 +1373,14 @@ abstract class CommonDocGenerator
|
||||
}
|
||||
|
||||
$itemsInRow = $maxItemsInRow;
|
||||
$html .= '<td colspan="' . ($maxItemsInRow * 2 - 1) . '">';
|
||||
$html .= '<strong>' . $field->label . ' :</strong> ';
|
||||
$html .= '<td colspan="'.($maxItemsInRow * 2 - 1).'">';
|
||||
$html .= '<strong>'.$field->label.' :</strong> ';
|
||||
$html .= $field->content;
|
||||
$html .= "</td>";
|
||||
} else {
|
||||
$itemsInRow++;
|
||||
$html .= '<td width="'.$params['table']['labelcolwidth'].'" class="extrafield-label">';
|
||||
$html .= '<strong>' . $field->label . ' :</strong>';
|
||||
$html .= '<strong>'.$field->label.' :</strong>';
|
||||
$html .= "</td>";
|
||||
|
||||
|
||||
@ -1460,7 +1460,7 @@ abstract class CommonDocGenerator
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], 0.5);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
// set cell padding with column title definition
|
||||
$pdf->setCellPaddings($colDef['title']['padding'][3], $colDef['title']['padding'][0], $colDef['title']['padding'][1], $colDef['title']['padding'][2]);
|
||||
}
|
||||
@ -1501,17 +1501,17 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if(!empty($hidedetails)){
|
||||
if (!empty($hidedetails)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(empty($object->table_element)){
|
||||
if (empty($object->table_element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load extrafiels if not allready does
|
||||
if(empty($this->extrafieldsCache)){ $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if(empty($this->extrafieldsCache->attributes[$object->table_element])){ $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
if (empty($this->extrafieldsCache)) { $this->extrafieldsCache = new ExtraFields($this->db); }
|
||||
if (empty($this->extrafieldsCache->attributes[$object->table_element])) { $this->extrafieldsCache->fetch_name_optionals_label($object->table_element); }
|
||||
$extrafields = $this->extrafieldsCache;
|
||||
|
||||
|
||||
@ -1526,15 +1526,15 @@ abstract class CommonDocGenerator
|
||||
|
||||
// Enable extrafield ?
|
||||
$enabled = 0;
|
||||
if(!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['printable'][$key])) {
|
||||
$printable = intval($extrafields->attributes[$object->table_element]['printable'][$key]);
|
||||
if($printable === 1 || $printable === 2) {
|
||||
if ($printable === 1 || $printable === 2) {
|
||||
$enabled = 1;
|
||||
}
|
||||
// Note : if $printable === 3 or 4 so, it's displayed after line description not in cols
|
||||
}
|
||||
|
||||
if (!$enabled){ continue; } // don't wast resourses if we don't need them...
|
||||
if (!$enabled) { continue; } // don't wast resourses if we don't need them...
|
||||
|
||||
// Load language if required
|
||||
if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $outputlangs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
|
||||
@ -1556,12 +1556,12 @@ abstract class CommonDocGenerator
|
||||
);
|
||||
|
||||
$alignTypeRight = array('double', 'int', 'price');
|
||||
if(in_array($extrafields->attributes[$object->table_element]['type'][$key], $alignTypeRight)){
|
||||
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], $alignTypeRight)) {
|
||||
$def['content']['align'] = 'R';
|
||||
}
|
||||
|
||||
$alignTypeLeft = array('text', 'html');
|
||||
if(in_array($extrafields->attributes[$object->table_element]['type'][$key], $alignTypeLeft)){
|
||||
$alignTypeLeft = array('text', 'html');
|
||||
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], $alignTypeLeft)) {
|
||||
$def['content']['align'] = 'L';
|
||||
}
|
||||
|
||||
|
||||
@ -683,7 +683,7 @@ class Conf
|
||||
|
||||
if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0;
|
||||
|
||||
if (!isset($this->global->MAIN_JS_GRAPH)) $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
|
||||
if (!isset($this->global->MAIN_JS_GRAPH)) $this->global->MAIN_JS_GRAPH = 'chart'; // Use chart.js library
|
||||
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com';
|
||||
if (empty($this->global->MAIN_MODULE_DOLISTORE_API_KEY)) $this->global->MAIN_MODULE_DOLISTORE_API_KEY = 'dolistorecatalogpublickey1234567';
|
||||
|
||||
@ -115,7 +115,7 @@ class DolGraph
|
||||
|
||||
$this->_library = $library;
|
||||
if ($this->_library == 'auto') {
|
||||
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'jflot': $conf->global->MAIN_JS_GRAPH);
|
||||
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'jflot' : $conf->global->MAIN_JS_GRAPH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ class DolGraph
|
||||
public function GetMaxValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
if (!is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
@ -564,7 +564,7 @@ class DolGraph
|
||||
public function GetMinValueInData()
|
||||
{
|
||||
// phpcs:enable
|
||||
if (! is_array($this->data)) return 0;
|
||||
if (!is_array($this->data)) return 0;
|
||||
|
||||
$k = 0;
|
||||
$vals = array();
|
||||
@ -748,9 +748,9 @@ class DolGraph
|
||||
}
|
||||
|
||||
// Start the div that will contains all the graph
|
||||
$dolxaxisvertical='';
|
||||
if (count($this->data) > 20) $dolxaxisvertical='dol-xaxis-vertical';
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($dolxaxisvertical)?'':' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
|
||||
$dolxaxisvertical = '';
|
||||
if (count($this->data) > 20) $dolxaxisvertical = 'dol-xaxis-vertical';
|
||||
$this->stringtoshow .= '<div id="placeholder_'.$tag.'" style="width:'.$this->width.'px;height:'.$this->height.'px;" class="dolgraph'.(empty($dolxaxisvertical) ? '' : ' '.$dolxaxisvertical).(empty($this->cssprefix) ? '' : ' dolgraph'.$this->cssprefix).' center"></div>'."\n";
|
||||
|
||||
$this->stringtoshow .= '<script id="'.$tag.'">'."\n";
|
||||
$this->stringtoshow .= '$(function () {'."\n";
|
||||
@ -775,8 +775,8 @@ class DolGraph
|
||||
{
|
||||
$datacolor = array();
|
||||
foreach ($this->datacolor as $val) {
|
||||
if (is_array($val)) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
|
||||
else $datacolor[] = "#".str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
|
||||
if (is_array($val)) $datacolor[] = "#".sprintf("%02x%02x%02x", $val[0], $val[1], $val[2]); // If datacolor is array(R, G, B)
|
||||
else $datacolor[] = "#".str_replace(array('#', '-'), '', $val); // If $val is '124' or '#124'
|
||||
}
|
||||
|
||||
$urltemp = ''; // TODO Add support for url link into labels
|
||||
@ -993,10 +993,10 @@ class DolGraph
|
||||
$legends[$x] = (array_key_exists('label', $valarray) ? $valarray['label'] : $valarray[0]);
|
||||
$array_of_ykeys = array_keys($valarray);
|
||||
$alabelexists = 1;
|
||||
$tmpykey = explode('_', ($array_of_ykeys[$i+($alabelexists ? 1 : 0)]), 3);
|
||||
if (! empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
|
||||
$tmpykey = explode('_', ($array_of_ykeys[$i + ($alabelexists ? 1 : 0)]), 3);
|
||||
if (!empty($tmpykey[2]) || $tmpykey[2] == '0') { // This is a 'Group by' array
|
||||
$tmpvalue = (array_key_exists('y_'.$tmpykey[1].'_'.$tmpykey[2], $valarray) ? $valarray['y_'.$tmpykey[1].'_'.$tmpykey[2]] : $valarray[$i + 1]);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$arrayofgroupslegend[$i] = array(
|
||||
'stacknum'=> $tmpykey[1],
|
||||
'legend' => $this->Legend[$tmpykey[1]],
|
||||
@ -1005,7 +1005,7 @@ class DolGraph
|
||||
} else {
|
||||
$tmpvalue = (array_key_exists('y_'.$i, $valarray) ? $valarray['y_'.$i] : $valarray[$i + 1]);
|
||||
//var_dump($i.'_'.$x.'_'.$tmpvalue);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ class DolGraph
|
||||
$j++;
|
||||
}
|
||||
|
||||
$values = null; // Free mem
|
||||
$values = null; // Free mem
|
||||
$i++;
|
||||
}
|
||||
//var_dump($serie);
|
||||
@ -1065,14 +1065,14 @@ class DolGraph
|
||||
// Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
|
||||
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle'))))
|
||||
{
|
||||
$type = $this->type[$firstlot]; // pie or polar
|
||||
$type = $this->type[$firstlot]; // pie or polar
|
||||
$this->stringtoshow .= 'var options = {'."\n";
|
||||
$legendMaxLines= 0; // Does not work
|
||||
$legendMaxLines = 0; // Does not work
|
||||
if (empty($showlegend)) {
|
||||
$this->stringtoshow .= 'legend: { display: false }, ';
|
||||
} else {
|
||||
$this->stringtoshow .= 'legend: { position: \''.($showlegend == 2 ? 'right' : 'top').'\'';
|
||||
if (! empty($legendMaxLines)) {
|
||||
if (!empty($legendMaxLines)) {
|
||||
$this->stringtoshow .= ', maxLines: '.$legendMaxLines.'';
|
||||
}
|
||||
$this->stringtoshow .= ' }, '."\n";
|
||||
@ -1086,17 +1086,17 @@ class DolGraph
|
||||
// Color of earch arc
|
||||
$this->stringtoshow .= 'backgroundColor: [';
|
||||
$i = 0; $foundnegativecolor = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')'; // If datacolor is array(R, G, B)
|
||||
if (is_array($this->datacolor[$i])) $color = 'rgb('.$this->datacolor[$i][0].', '.$this->datacolor[$i][1].', '.$this->datacolor[$i][2].')'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) {
|
||||
$foundnegativecolor++;
|
||||
$color = '#FFFFFF'; // If $val is '-123'
|
||||
$color = '#FFFFFF'; // If $val is '-123'
|
||||
}
|
||||
else $color = "#".$tmp; // If $val is '123' or '#123'
|
||||
else $color = "#".$tmp; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= "'".$color."'";
|
||||
$i++;
|
||||
@ -1106,14 +1106,14 @@ class DolGraph
|
||||
if ($foundnegativecolor) {
|
||||
$this->stringtoshow .= 'borderColor: [';
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', '."\n";
|
||||
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
|
||||
if (is_array($this->datacolor[$i])) $color = 'null'; // If datacolor is array(R, G, B)
|
||||
else {
|
||||
$tmp = str_replace('#', '', $this->datacolor[$i]);
|
||||
if (strpos($tmp, '-') !== false) $color = '#'.str_replace('-', '', $tmp); // If $val is '-123'
|
||||
else $color = 'null'; // If $val is '123' or '#123'
|
||||
if (strpos($tmp, '-') !== false) $color = '#'.str_replace('-', '', $tmp); // If $val is '-123'
|
||||
else $color = 'null'; // If $val is '123' or '#123'
|
||||
}
|
||||
$this->stringtoshow .= ($color == 'null' ? "'rgba(0,0,0,0.2)'" : "'".$color."'");
|
||||
$i++;
|
||||
@ -1133,7 +1133,7 @@ class DolGraph
|
||||
labels: [';
|
||||
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
@ -1196,7 +1196,7 @@ class DolGraph
|
||||
labels: [';
|
||||
|
||||
$i = 0;
|
||||
foreach($legends as $val) // Loop on each serie
|
||||
foreach ($legends as $val) // Loop on each serie
|
||||
{
|
||||
if ($i > 0) $this->stringtoshow .= ', ';
|
||||
$this->stringtoshow .= "'".$val."'";
|
||||
@ -1214,7 +1214,7 @@ class DolGraph
|
||||
$oldstacknum = -1;
|
||||
while ($i < $nblot) // Loop on each serie
|
||||
{
|
||||
$usecolorvariantforgroupby=0;
|
||||
$usecolorvariantforgroupby = 0;
|
||||
// We used a 'group by' and we have too many colors so we generated color variants per
|
||||
if (is_array($arrayofgroupslegend[$i]) && count($arrayofgroupslegend[$i]) > 0) { // If we used a group by.
|
||||
$nbofcolorneeds = count($arrayofgroupslegend);
|
||||
@ -1239,11 +1239,11 @@ class DolGraph
|
||||
// Change color with offset of $$iinstack
|
||||
//var_dump($newcolor);
|
||||
if ($iinstack % 2) { // We increase agressiveness of reference color for color 2, 4, 6, ...
|
||||
$ratio = min(95, 10 + 10 * $iinstack); // step of 20
|
||||
$brightnessratio = min(90, 5 + 5 * $iinstack); // step of 10
|
||||
$ratio = min(95, 10 + 10 * $iinstack); // step of 20
|
||||
$brightnessratio = min(90, 5 + 5 * $iinstack); // step of 10
|
||||
} else { // We decrease agressiveness of reference color for color 3, 5, 7, ..
|
||||
$ratio = max(-100, - 15 * $iinstack + 10); // step of -20
|
||||
$brightnessratio = min(90, 10 * $iinstack); // step of 20
|
||||
$ratio = max(-100, - 15 * $iinstack + 10); // step of -20
|
||||
$brightnessratio = min(90, 10 * $iinstack); // step of 20
|
||||
}
|
||||
//var_dump('Color '.($iinstack+1).' : '.$ratio.' '.$brightnessratio);
|
||||
|
||||
|
||||
@ -2907,7 +2907,7 @@ class Form
|
||||
$objp->fprice = $price_result;
|
||||
if ($objp->quantity >= 1)
|
||||
{
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity; // Replace dynamically unitprice
|
||||
$objp->unitprice = $objp->fprice / $objp->quantity; // Replace dynamically unitprice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ class FormOther
|
||||
if ($obj->fk_user == 0) {
|
||||
$label .= ' <span class="opacitymedium">('.$langs->trans("Everybody").')</span>';
|
||||
}
|
||||
elseif (! empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
|
||||
elseif (!empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch($obj->fk_user);
|
||||
$label .= ' <span class="opacitymedium">('.$tmpuser->getFullName($langs).')</span>';
|
||||
@ -164,7 +164,7 @@ class FormOther
|
||||
if ($obj->fk_user == 0) {
|
||||
$label .= ' <span class="opacitymedium">('.$langs->trans("Everybody").')</span>';
|
||||
}
|
||||
elseif (! empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
|
||||
elseif (!empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) {
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch($obj->fk_user);
|
||||
$label .= ' <span class="opacitymedium">('.$tmpuser->getFullName($langs).')</span>';
|
||||
@ -432,61 +432,61 @@ class FormOther
|
||||
// Enhance with select2
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||
|
||||
$comboenhancement = ajax_combobox($htmlname);
|
||||
if ($comboenhancement)
|
||||
{
|
||||
$out.=$comboenhancement;
|
||||
$out .= $comboenhancement;
|
||||
}
|
||||
}
|
||||
// Select each sales and print them in a select input
|
||||
$out.='<select class="flat'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if ($showempty) $out.='<option value="0"> </option>';
|
||||
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if ($showempty) $out .= '<option value="0"> </option>';
|
||||
|
||||
// Get list of users allowed to be viewed
|
||||
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr.= " WHERE u.entity IS NOT NULL"; // Show all users
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr .= " WHERE u.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr.= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr.= " OR u.entity = 0"; // Show always superadmin
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug WHERE u.rowid = ug.fk_user AND ug.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr .= " OR u.entity = 0"; // Show always superadmin
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_usr.= " WHERE u.entity IN (".getEntity('user').")";
|
||||
$sql_usr .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
}
|
||||
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.rowid = ".$user->id;
|
||||
if (! empty($user->socid)) $sql_usr.=" AND u.fk_soc = ".$user->socid;
|
||||
if (empty($user->rights->user->user->lire)) $sql_usr .= " AND u.rowid = ".$user->id;
|
||||
if (!empty($user->socid)) $sql_usr .= " AND u.fk_soc = ".$user->socid;
|
||||
// Add existing sales representatives of thirdparty of external user
|
||||
if (empty($user->rights->user->user->lire) && $user->socid)
|
||||
{
|
||||
$sql_usr.=" UNION ";
|
||||
$sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
|
||||
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql_usr .= " UNION ";
|
||||
$sql_usr .= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
|
||||
$sql_usr .= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
|
||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr.= " WHERE u2.entity IS NOT NULL"; // Show all users
|
||||
if (!empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql_usr .= " WHERE u2.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql_usr.= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
|
||||
$sql_usr .= " WHERE EXISTS (SELECT ug2.fk_user FROM ".MAIN_DB_PREFIX."usergroup_user as ug2 WHERE u2.rowid = ug2.fk_user AND ug2.entity IN (".getEntity('usergroup')."))";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_usr.= " WHERE u2.entity IN (".getEntity('user').")";
|
||||
$sql_usr .= " WHERE u2.entity IN (".getEntity('user').")";
|
||||
}
|
||||
|
||||
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->socid;
|
||||
$sql_usr .= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->socid;
|
||||
}
|
||||
$sql_usr.= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
$sql_usr .= " ORDER BY statut DESC, lastname ASC"; // Do not use 'ORDER BY u.statut' here, not compatible with the UNION.
|
||||
//print $sql_usr;exit;
|
||||
|
||||
$resql_usr = $this->db->query($sql_usr);
|
||||
@ -494,34 +494,34 @@ class FormOther
|
||||
{
|
||||
while ($obj_usr = $this->db->fetch_object($resql_usr))
|
||||
{
|
||||
$out.='<option value="'.$obj_usr->rowid.'"';
|
||||
$out .= '<option value="'.$obj_usr->rowid.'"';
|
||||
|
||||
if ($obj_usr->rowid == $selected) $out.=' selected';
|
||||
if ($obj_usr->rowid == $selected) $out .= ' selected';
|
||||
|
||||
$out.='>';
|
||||
$out.=dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
|
||||
$out .= '>';
|
||||
$out .= dolGetFirstLastname($obj_usr->firstname, $obj_usr->lastname);
|
||||
// Complete name with more info
|
||||
$moreinfo=0;
|
||||
if (! empty($conf->global->MAIN_SHOW_LOGIN))
|
||||
$moreinfo = 0;
|
||||
if (!empty($conf->global->MAIN_SHOW_LOGIN))
|
||||
{
|
||||
$out.=($moreinfo?' - ':' (').$obj_usr->login;
|
||||
$out .= ($moreinfo ? ' - ' : ' (').$obj_usr->login;
|
||||
$moreinfo++;
|
||||
}
|
||||
if ($showstatus >= 0)
|
||||
{
|
||||
if ($obj_usr->statut == 1 && $showstatus == 1)
|
||||
{
|
||||
$out.=($moreinfo?' - ':' (').$langs->trans('Enabled');
|
||||
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
|
||||
$moreinfo++;
|
||||
}
|
||||
if ($obj_usr->statut == 0)
|
||||
{
|
||||
$out.=($moreinfo?' - ':' (').$langs->trans('Disabled');
|
||||
$out .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
|
||||
$moreinfo++;
|
||||
}
|
||||
}
|
||||
$out.=($moreinfo?')':'');
|
||||
$out.='</option>';
|
||||
$out .= ($moreinfo ? ')' : '');
|
||||
$out .= '</option>';
|
||||
}
|
||||
$this->db->free($resql_usr);
|
||||
}
|
||||
@ -533,10 +533,10 @@ class FormOther
|
||||
if ($norepresentative)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$out.='<option value="-2"'.($selected == -2 ? ' selected':'').'>- '.$langs->trans("NoSalesRepresentativeAffected").' -</option>';
|
||||
$out .= '<option value="-2"'.($selected == -2 ? ' selected' : '').'>- '.$langs->trans("NoSalesRepresentativeAffected").' -</option>';
|
||||
}
|
||||
|
||||
$out.='</select>';
|
||||
$out .= '</select>';
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -1331,7 +1331,7 @@ class FormOther
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected=(($useempty && $value != '0' && $value != 'manual')?'':' selected');
|
||||
$selected = (($useempty && $value != '0' && $value != 'manual') ? '' : ' selected');
|
||||
$resultautomanual .= '<option value="'.$automatic.'">'.$langs->trans("Automatic").'</option>'."\n";
|
||||
$resultautomanual .= '<option value="'.$manual.'"'.$selected.'>'.$langs->trans("Manual").'</option>'."\n";
|
||||
}
|
||||
@ -1352,12 +1352,12 @@ class FormOther
|
||||
{
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!$val['measure']) {
|
||||
@ -1409,12 +1409,12 @@ class FormOther
|
||||
{
|
||||
global $langs, $extrafields, $form;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
|
||||
@ -30,8 +30,8 @@
|
||||
abstract class Stats
|
||||
{
|
||||
protected $db;
|
||||
protected $lastfetchdate=array(); // Dates of cache file read by methods
|
||||
public $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
|
||||
protected $lastfetchdate = array(); // Dates of cache file read by methods
|
||||
public $cachefilesuffix = ''; // Suffix to add to name of cache file (to avoid file name conflicts)
|
||||
|
||||
/**
|
||||
* Return nb of elements by month for several years
|
||||
@ -46,33 +46,33 @@ abstract class Stats
|
||||
*/
|
||||
public function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf, $user, $langs;
|
||||
|
||||
if ($startyear > $endyear) return -1;
|
||||
|
||||
$datay=array();
|
||||
$datay = array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
if (!empty($cachedelay))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
$newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask = '0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
|
||||
$foundintocache=0;
|
||||
$foundintocache = 0;
|
||||
if ($cachedelay > 0)
|
||||
{
|
||||
$filedate=dol_filemtime($newpathofdestfile);
|
||||
$filedate = dol_filemtime($newpathofdestfile);
|
||||
if ($filedate >= ($nowgmt - $cachedelay))
|
||||
{
|
||||
$foundintocache=1;
|
||||
$foundintocache = 1;
|
||||
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -87,7 +87,7 @@ abstract class Stats
|
||||
}
|
||||
else
|
||||
{
|
||||
$year=$startyear;
|
||||
$year = $startyear;
|
||||
$sm = $startmonth - 1;
|
||||
if ($sm != 0) $year = $year - 1;
|
||||
while ($year <= $endyear)
|
||||
@ -98,13 +98,13 @@ abstract class Stats
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
for ($i = 0; $i < 12; $i++)
|
||||
{
|
||||
$data[$i][]=$datay[$endyear][($i+$sm)%12][0];
|
||||
$year=$startyear;
|
||||
while($year <= $endyear)
|
||||
$data[$i][] = $datay[$endyear][($i + $sm) % 12][0];
|
||||
$year = $startyear;
|
||||
while ($year <= $endyear)
|
||||
{
|
||||
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1];
|
||||
$data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1];
|
||||
$year++;
|
||||
}
|
||||
}
|
||||
@ -114,14 +114,14 @@ abstract class Stats
|
||||
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
|
||||
{
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
|
||||
}
|
||||
|
||||
// return array(array('Month',val1,val2,val3),...)
|
||||
@ -143,33 +143,33 @@ abstract class Stats
|
||||
*/
|
||||
public function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay = 0, $format = 0, $startmonth = 1)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf, $user, $langs;
|
||||
|
||||
if ($startyear > $endyear) return -1;
|
||||
|
||||
$datay=array();
|
||||
$datay = array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
if (!empty($cachedelay))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
$newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask = '0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
|
||||
$foundintocache=0;
|
||||
$foundintocache = 0;
|
||||
if ($cachedelay > 0)
|
||||
{
|
||||
$filedate=dol_filemtime($newpathofdestfile);
|
||||
$filedate = dol_filemtime($newpathofdestfile);
|
||||
if ($filedate >= ($nowgmt - $cachedelay))
|
||||
{
|
||||
$foundintocache=1;
|
||||
$foundintocache = 1;
|
||||
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -185,10 +185,10 @@ abstract class Stats
|
||||
}
|
||||
else
|
||||
{
|
||||
$year=$startyear;
|
||||
$year = $startyear;
|
||||
$sm = $startmonth - 1;
|
||||
if ($sm != 0) $year = $year - 1;
|
||||
while($year <= $endyear)
|
||||
while ($year <= $endyear)
|
||||
{
|
||||
$datay[$year] = $this->getAmountByMonth($year, $format);
|
||||
$year++;
|
||||
@ -196,13 +196,13 @@ abstract class Stats
|
||||
|
||||
$data = array();
|
||||
// $data = array('xval'=>array(0=>xlabel,1=>yval1,2=>yval2...),...)
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
for ($i = 0; $i < 12; $i++)
|
||||
{
|
||||
$data[$i][]=$datay[$endyear][($i+$sm)%12][0]; // set label
|
||||
$year=$startyear;
|
||||
while($year <= $endyear)
|
||||
$data[$i][] = $datay[$endyear][($i + $sm) % 12][0]; // set label
|
||||
$year = $startyear;
|
||||
while ($year <= $endyear)
|
||||
{
|
||||
$data[$i][]=$datay[$year - (1 - ((int) ($i+$sm)/12)) + ($sm == 0 ? 1 : 0)][($i+$sm)%12][1]; // set yval for x=i
|
||||
$data[$i][] = $datay[$year - (1 - ((int) ($i + $sm) / 12)) + ($sm == 0 ? 1 : 0)][($i + $sm) % 12][1]; // set yval for x=i
|
||||
$year++;
|
||||
}
|
||||
}
|
||||
@ -212,17 +212,17 @@ abstract class Stats
|
||||
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
|
||||
{
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
if ($fp)
|
||||
{
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
}
|
||||
else dol_syslog("Failed to write cache file", LOG_ERR);
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -239,10 +239,10 @@ abstract class Stats
|
||||
{
|
||||
if ($startyear > $endyear) return -1;
|
||||
|
||||
$datay=array();
|
||||
$datay = array();
|
||||
|
||||
$year=$startyear;
|
||||
while($year <= $endyear)
|
||||
$year = $startyear;
|
||||
while ($year <= $endyear)
|
||||
{
|
||||
$datay[$year] = $this->getAverageByMonth($year);
|
||||
$year++;
|
||||
@ -250,13 +250,13 @@ abstract class Stats
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 0 ; $i < 12 ; $i++)
|
||||
for ($i = 0; $i < 12; $i++)
|
||||
{
|
||||
$data[$i][]=$datay[$endyear][$i][0];
|
||||
$year=$startyear;
|
||||
while($year <= $endyear)
|
||||
$data[$i][] = $datay[$endyear][$i][0];
|
||||
$year = $startyear;
|
||||
while ($year <= $endyear)
|
||||
{
|
||||
$data[$i][]=$datay[$year][$i][1];
|
||||
$data[$i][] = $datay[$year][$i][1];
|
||||
$year++;
|
||||
}
|
||||
}
|
||||
@ -274,31 +274,31 @@ abstract class Stats
|
||||
*/
|
||||
public function getAllByProductEntry($year, $cachedelay = 0, $limit = 10)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$data=array();
|
||||
$data = array();
|
||||
|
||||
// Search into cache
|
||||
if (! empty($cachedelay))
|
||||
if (!empty($cachedelay))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
$newpathofdestfile = $conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix) ? '' : $this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask = '0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
|
||||
$foundintocache=0;
|
||||
$foundintocache = 0;
|
||||
if ($cachedelay > 0)
|
||||
{
|
||||
$filedate=dol_filemtime($newpathofdestfile);
|
||||
$filedate = dol_filemtime($newpathofdestfile);
|
||||
if ($filedate >= ($nowgmt - $cachedelay))
|
||||
{
|
||||
$foundintocache=1;
|
||||
$foundintocache = 1;
|
||||
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -322,16 +322,16 @@ abstract class Stats
|
||||
if (empty($foundintocache) && ($cachedelay > 0 || $cachedelay == -1))
|
||||
{
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__." save cache file ".$newpathofdestfile." onto disk.");
|
||||
if (! dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
if (!dol_is_dir($conf->user->dir_temp)) dol_mkdir($conf->user->dir_temp);
|
||||
$fp = fopen($newpathofdestfile, 'w');
|
||||
if ($fp)
|
||||
{
|
||||
fwrite($fp, json_encode($data));
|
||||
fclose($fp);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
}
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__]=$nowgmt;
|
||||
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -354,7 +354,7 @@ abstract class Stats
|
||||
$result = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -386,7 +386,7 @@ abstract class Stats
|
||||
$result = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -396,16 +396,16 @@ abstract class Stats
|
||||
$row = $this->db->fetch_object($resql);
|
||||
$result[$i]['year'] = $row->year;
|
||||
$result[$i]['nb'] = $row->nb;
|
||||
if($i>0 && $row->nb>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
if ($i > 0 && $row->nb > 0) $result[$i - 1]['nb_diff'] = ($result[$i - 1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
$result[$i]['total'] = $row->total;
|
||||
if($i>0 && $row->total>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
|
||||
if ($i > 0 && $row->total > 0) $result[$i - 1]['total_diff'] = ($result[$i - 1]['total'] - $row->total) / $row->total * 100;
|
||||
$result[$i]['avg'] = $row->avg;
|
||||
if($i>0 && $row->avg>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
if ($i > 0 && $row->avg > 0) $result[$i - 1]['avg_diff'] = ($result[$i - 1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
// For some $sql only
|
||||
if (isset($row->weighted))
|
||||
{
|
||||
$result[$i]['weighted'] = $row->weighted;
|
||||
if($i>0 && $row->weighted>0) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
if ($i > 0 && $row->weighted > 0) $result[$i - 1]['avg_weighted'] = ($result[$i - 1]['weighted'] - $row->weighted) / $row->weighted * 100;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -432,11 +432,11 @@ abstract class Stats
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
$result = array();
|
||||
$res = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -455,22 +455,22 @@ abstract class Stats
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||
$res[$i] = (isset($result[$i]) ? $result[$i] : 0);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$month='unknown';
|
||||
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month=$i;
|
||||
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
$month = 'unknown';
|
||||
if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month = $i;
|
||||
elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
|
||||
//$month=dol_substr($month,0,3);
|
||||
$data[$i-1] = array($month, $res[$i]);
|
||||
$data[$i - 1] = array($month, $res[$i]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -492,12 +492,12 @@ abstract class Stats
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
$result = array();
|
||||
$res = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -513,22 +513,22 @@ abstract class Stats
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$res[$i] = (int) round((isset($result[$i])?$result[$i]:0));
|
||||
$res[$i] = (int) round((isset($result[$i]) ? $result[$i] : 0));
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$month='unknown';
|
||||
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month=$i;
|
||||
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
$month = 'unknown';
|
||||
if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month = $i;
|
||||
elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
|
||||
//$month=dol_substr($month,0,3);
|
||||
$data[$i-1] = array($month, $res[$i]);
|
||||
$data[$i - 1] = array($month, $res[$i]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -549,11 +549,11 @@ abstract class Stats
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$res=array();
|
||||
$result = array();
|
||||
$res = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
@ -569,22 +569,22 @@ abstract class Stats
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||
$res[$i] = (isset($result[$i]) ? $result[$i] : 0);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
for ($i = 1; $i < 13; $i++)
|
||||
{
|
||||
$month='unknown';
|
||||
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month=$i;
|
||||
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
$month = 'unknown';
|
||||
if ($format == 0) $month = $langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
|
||||
elseif ($format == 1) $month = $i;
|
||||
elseif ($format == 2) $month = $langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
|
||||
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
|
||||
//$month=dol_substr($month,0,3);
|
||||
$data[$i-1] = array($month, $res[$i]);
|
||||
$data[$i - 1] = array($month, $res[$i]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
@ -604,22 +604,22 @@ abstract class Stats
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
$result=array();
|
||||
$result = array();
|
||||
|
||||
dol_syslog(get_class($this).'::'.__FUNCTION__."", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0; $other=0;
|
||||
$i = 0; $other = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
if ($i < $limit || $num == $limit) $result[$i] = array($row[0],$row[1]); // Ref of product, nb
|
||||
if ($i < $limit || $num == $limit) $result[$i] = array($row[0], $row[1]); // Ref of product, nb
|
||||
else $other += $row[1];
|
||||
$i++;
|
||||
}
|
||||
if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"),$other);
|
||||
if ($num > $limit) $result[$i] = array($langs->transnoentitiesnoconv("Other"), $other);
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
|
||||
@ -122,7 +122,7 @@ elseif (is_array($hookmanager->resArray)) {
|
||||
|
||||
if ($objecttype) {
|
||||
try {
|
||||
if (! empty($arrayoftype[$objecttype]['ClassPath'])) {
|
||||
if (!empty($arrayoftype[$objecttype]['ClassPath'])) {
|
||||
dol_include_once($arrayoftype[$objecttype]['ClassPath']);
|
||||
} else {
|
||||
dol_include_once("/".$objecttype."/class/".$objecttype.".class.php");
|
||||
@ -156,12 +156,12 @@ $search_component_params = array('');
|
||||
$MAXUNIQUEVALFORGROUP = 20;
|
||||
$MAXMEASURESINBARGRAPH = 20;
|
||||
|
||||
$YYYY=substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM=substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD=substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH=substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI=substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS=substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
$YYYY = substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1).substr($langs->trans("Year"), 0, 1);
|
||||
$MM = substr($langs->trans("Month"), 0, 1).substr($langs->trans("Month"), 0, 1);
|
||||
$DD = substr($langs->trans("Day"), 0, 1).substr($langs->trans("Day"), 0, 1);
|
||||
$HH = substr($langs->trans("Hour"), 0, 1).substr($langs->trans("Hour"), 0, 1);
|
||||
$MI = substr($langs->trans("Minute"), 0, 1).substr($langs->trans("Minute"), 0, 1);
|
||||
$SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1);
|
||||
|
||||
$arrayofmesures = array('t.count'=>'Count');
|
||||
$arrayofxaxis = array();
|
||||
@ -215,7 +215,7 @@ if ($action == 'viewgraph') {
|
||||
|
||||
// Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby
|
||||
if (is_array($search_groupby) && count($search_groupby)) {
|
||||
foreach($search_groupby as $gkey => $gval) {
|
||||
foreach ($search_groupby as $gkey => $gval) {
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
if (preg_match('/\-year$/', $search_groupby[$gkey])) {
|
||||
@ -233,13 +233,13 @@ if (is_array($search_groupby) && count($search_groupby)) {
|
||||
|
||||
$sql = 'SELECT DISTINCT '.$fieldtocount.' as val';
|
||||
if (strpos($fieldtocount, 'te.') === 0) {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te';
|
||||
} else {
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||
}
|
||||
// TODO Add the where here
|
||||
|
||||
$sql.= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
|
||||
$sql .= ' LIMIT '.($MAXUNIQUEVALFORGROUP + 1);
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
@ -334,7 +334,7 @@ print '</div>';
|
||||
// Add measures into array
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['isameasure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['t.'.$key.'-min'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
@ -344,7 +344,7 @@ foreach ($object->fields as $key => $val) {
|
||||
// Add extrafields to Measures
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||
@ -375,7 +375,7 @@ if ($mode == 'grid') {
|
||||
// YAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (empty($val['measure']) && (! isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
if (empty($val['measure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1))) {
|
||||
if (in_array($key, array('id', 'rowid', 'entity', 'last_main_doc', 'extraparams'))) continue;
|
||||
if (preg_match('/^fk_/', $key)) continue;
|
||||
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||
@ -390,7 +390,7 @@ if ($mode == 'grid') {
|
||||
// Add measure from extrafields
|
||||
if ($object->isextrafieldmanaged) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (! isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1))) {
|
||||
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||
}
|
||||
}
|
||||
@ -584,7 +584,7 @@ if ($sql) {
|
||||
$labeltouse = (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : ($xlabel === '' ? $langs->trans("Empty") : $langs->trans("NotDefined")));
|
||||
|
||||
if ($oldlabeltouse && ($labeltouse != $oldlabeltouse)) {
|
||||
$xi++; // Increase $xi
|
||||
$xi++; // Increase $xi
|
||||
}
|
||||
//var_dump($labeltouse.' '.$oldlabeltouse.' '.$xi);
|
||||
$oldlabeltouse = $labeltouse;
|
||||
@ -605,7 +605,7 @@ if ($sql) {
|
||||
foreach ($search_groupby as $gkey) {
|
||||
//var_dump('*** Fetch #'.$ifetch.' for labeltouse='.$labeltouse.' measure number '.$key.' and group g_'.$gi);
|
||||
//var_dump($arrayofvaluesforgroupby);
|
||||
foreach($arrayofvaluesforgroupby['g_'.$gi] as $gvaluepossiblekey => $gvaluepossiblelabel) {
|
||||
foreach ($arrayofvaluesforgroupby['g_'.$gi] as $gvaluepossiblekey => $gvaluepossiblelabel) {
|
||||
$ykeysuffix = $gvaluepossiblelabel;
|
||||
$gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval);
|
||||
|
||||
@ -615,9 +615,9 @@ if ($sql) {
|
||||
//var_dump('gvaluepossiblekey='.$gvaluepossiblekey.' gvaluepossiblelabel='.$gvaluepossiblelabel.' ykeysuffix='.$ykeysuffix.' gval='.$gval.' gvalwithoutsuffix='.$gvalwithoutprefix);
|
||||
//var_dump('fieldforg='.$fieldforg.' obj->$fieldforg='.$obj->$fieldforg.' fieldfory='.$fieldfory.' obj->$fieldfory='.$obj->$fieldfory.' fieldforybis='.$fieldforybis);
|
||||
|
||||
if (! is_array($data[$xi])) $data[$xi] = array();
|
||||
if (!is_array($data[$xi])) $data[$xi] = array();
|
||||
|
||||
if (! array_key_exists('label', $data[$xi])) {
|
||||
if (!array_key_exists('label', $data[$xi])) {
|
||||
$data[$xi] = array();
|
||||
$data[$xi]['label'] = $labeltouse;
|
||||
}
|
||||
@ -632,7 +632,7 @@ if ($sql) {
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
elseif (!isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
} else {
|
||||
@ -642,7 +642,7 @@ if ($sql) {
|
||||
$data[$xi][$fieldforybis] = $obj->$fieldfory;
|
||||
}
|
||||
// The record we fetch is not for this group
|
||||
elseif (! isset($data[$xi][$fieldforybis])) {
|
||||
elseif (!isset($data[$xi][$fieldforybis])) {
|
||||
$data[$xi][$fieldforybis] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
@ -6324,9 +6324,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
||||
}
|
||||
else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = '';
|
||||
|
||||
if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT . "/comm/propal/card.php?id=" . $object->id;
|
||||
if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT . "/commande/card.php?id=" . $object->id;
|
||||
if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT . "/compta/facture/card.php?id=" . $object->id;
|
||||
if (is_object($object) && $object->element == 'propal') $substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id;
|
||||
if (is_object($object) && $object->element == 'commande') $substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id;
|
||||
if (is_object($object) && $object->element == 'facture') $substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7647,7 +7647,7 @@ function printCommonFooter($zone = 'private')
|
||||
}
|
||||
|
||||
if (function_exists("memory_get_usage")) {
|
||||
print ' - Mem: '.memory_get_usage(); // Do not use true here, it seems it takes the peak amount
|
||||
print ' - Mem: '.memory_get_usage(); // Do not use true here, it seems it takes the peak amount
|
||||
}
|
||||
if (function_exists("memory_get_peak_usage")) {
|
||||
print ' - Real mem peak: '.memory_get_peak_usage(true);
|
||||
|
||||
@ -122,7 +122,7 @@ function dol_hash($chain, $type = '0')
|
||||
}
|
||||
|
||||
// Salt value
|
||||
if (! empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'md5openldap') $chain = $conf->global->MAIN_SECURITY_SALT.$chain;
|
||||
if (!empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'md5openldap') $chain = $conf->global->MAIN_SECURITY_SALT.$chain;
|
||||
|
||||
if ($type == '1' || $type == 'sha1') return sha1($chain);
|
||||
elseif ($type == '2' || $type == 'sha1md5') return sha1(md5($chain));
|
||||
@ -198,7 +198,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
||||
|
||||
if (isset($hookmanager->resArray['result'])) {
|
||||
if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
|
||||
if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
|
||||
}
|
||||
if ($reshook > 0) { // No other test done.
|
||||
return 1;
|
||||
|
||||
@ -38,8 +38,8 @@ function dolStripPhpCode($str, $replacewith = '')
|
||||
$parts = explode('<?php', $str);
|
||||
if (!empty($parts))
|
||||
{
|
||||
$i=0;
|
||||
foreach($parts as $part)
|
||||
$i = 0;
|
||||
foreach ($parts as $part)
|
||||
{
|
||||
if ($i == 0) // The first part is never php code
|
||||
{
|
||||
@ -53,7 +53,7 @@ function dolStripPhpCode($str, $replacewith = '')
|
||||
{
|
||||
//$phppart = $partlings[0];
|
||||
//remove content before closing tag
|
||||
if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
|
||||
if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
|
||||
//append to out string
|
||||
//$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
|
||||
//$newstr .= '<span>'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
|
||||
@ -88,7 +88,7 @@ function dolKeepOnlyPhpCode($str)
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
$newstr.='<?php';
|
||||
$newstr .= '<?php';
|
||||
//split on closing tag
|
||||
$partlings = explode('?>', $part, 2);
|
||||
if (!empty($partlings))
|
||||
@ -120,33 +120,33 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
|
||||
{
|
||||
$nbrep = 0;
|
||||
|
||||
dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')', LOG_DEBUG);
|
||||
dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')', LOG_DEBUG);
|
||||
//if ($contenttype == 'html') { print $content;exit; }
|
||||
|
||||
// Replace php code. Note $content may come from database and does not contains body tags.
|
||||
$replacewith='...php...';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = '...php...';
|
||||
if ($removephppart) $replacewith = '';
|
||||
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
|
||||
|
||||
$replacewith='"callto=#';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = '"callto=#';
|
||||
if ($removephppart) $replacewith = '';
|
||||
$content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||
|
||||
$replacewith='"mailto=#';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = '"mailto=#';
|
||||
if ($removephppart) $replacewith = '';
|
||||
$content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||
|
||||
$replacewith='src="php';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = 'src="php';
|
||||
if ($removephppart) $replacewith = '';
|
||||
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||
|
||||
$replacewith='href="php';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = 'href="php';
|
||||
if ($removephppart) $replacewith = '';
|
||||
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
|
||||
|
||||
//$replacewith='<span class="phptag">...php...</span>';
|
||||
$replacewith='...php...';
|
||||
if ($removephppart) $replacewith='';
|
||||
$replacewith = '...php...';
|
||||
if ($removephppart) $replacewith = '';
|
||||
//$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
|
||||
/*if ($content === null) {
|
||||
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
|
||||
@ -188,11 +188,11 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
|
||||
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
|
||||
$content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
|
||||
$content=preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
|
||||
|
||||
// Fix relative URL
|
||||
$content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
|
||||
@ -221,11 +221,11 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
global $db, $langs, $conf, $user;
|
||||
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
||||
|
||||
dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')');
|
||||
dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')');
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
|
||||
@ -250,7 +250,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
$content = str_replace('href="//', 'href="!~!~!~//', $content);
|
||||
$content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content);
|
||||
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
|
||||
$content = str_replace(array('href="document.php','href="/document.php'), 'href="!~!~!~/document.php', $content);
|
||||
$content = str_replace(array('href="document.php', 'href="/document.php'), 'href="!~!~!~/document.php', $content);
|
||||
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
|
||||
|
||||
// Replace relative link / with dolibarr URL: ...href="/"...
|
||||
@ -295,62 +295,62 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
|
||||
}
|
||||
else // REPLACEMENT OF LINKS When page called from virtual host
|
||||
{
|
||||
$symlinktomediaexists=1;
|
||||
$symlinktomediaexists = 1;
|
||||
|
||||
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
|
||||
// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&entity=1&file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||
// become
|
||||
// <img alt="" src="'.$urlwithroot.'/medias/image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
|
||||
$nbrep=0;
|
||||
if (! $symlinktomediaexists)
|
||||
$nbrep = 0;
|
||||
if (!$symlinktomediaexists)
|
||||
{
|
||||
// <img src="image.png... => <img src="medias/image.png...
|
||||
$content=preg_replace('/(<img[^>]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/wrapper.php\2modulepart=medias\3file=\4\5', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp\3\4', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
|
||||
|
||||
// If some links to documents or viewimage remains, we replace with wrapper
|
||||
$content=preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<a[^>]*href=")\/?documents\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")\/?documents\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
}
|
||||
else
|
||||
{
|
||||
// <img src="image.png... => <img src="medias/image.png...
|
||||
$content=preg_replace('/(<img[^>]*src=")\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)\/?image\//', '\1/medias/image/', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<script[^>]*src=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*document\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)modulepart=medias([^\)]*)file=([^\)]*)(["\']?\))/', '\1/medias/\4\5', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)hashp=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(url\(["\']?)[^\)]*viewimage\.php([^\)]*)hashp=([^\)]*)(["\']?\))/', '\1/wrapper.php\2hashp=\3\4', $content, -1, $nbrep);
|
||||
|
||||
$content=preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")[^\"]*viewimage\.php([^\"]*)modulepart=mycompany([^\"]*)file=([^\"]*)("[^>]*>)/', '\1/wrapper.php\2modulepart=mycompany\3file=\4\5', $content, -1, $nbrep);
|
||||
|
||||
// If some links to documents or viewimage remains, we replace with wrapper
|
||||
$content=preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content=preg_replace('/(<a[^>]*href=")\/?document\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<img[^>]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
$content = preg_replace('/(<a[^>]*href=")\/?document\.php/', '\1/wrapper.php', $content, -1, $nbrep);
|
||||
}
|
||||
}
|
||||
|
||||
$content=preg_replace('/ contenteditable="true"/', ' contenteditable="false"', $content, -1, $nbrep);
|
||||
$content = preg_replace('/ contenteditable="true"/', ' contenteditable="false"', $content, -1, $nbrep);
|
||||
|
||||
dol_syslog("dolWebsiteOutput end");
|
||||
|
||||
@ -490,17 +490,17 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
||||
*/
|
||||
function includeContainer($containerref)
|
||||
{
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
||||
global $includehtmlcontentopened;
|
||||
global $websitekey, $websitepagefile;
|
||||
|
||||
$MAXLEVEL=20;
|
||||
$MAXLEVEL = 20;
|
||||
|
||||
if (! preg_match('/\.php$/i', $containerref)) $containerref.='.php';
|
||||
if (!preg_match('/\.php$/i', $containerref)) $containerref .= '.php';
|
||||
|
||||
$fullpathfile=DOL_DATA_ROOT.'/website/'.$websitekey.'/'.$containerref;
|
||||
$fullpathfile = DOL_DATA_ROOT.'/website/'.$websitekey.'/'.$containerref;
|
||||
|
||||
if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0;
|
||||
if (empty($includehtmlcontentopened)) $includehtmlcontentopened = 0;
|
||||
$includehtmlcontentopened++;
|
||||
if ($includehtmlcontentopened > $MAXLEVEL)
|
||||
{
|
||||
@ -536,7 +536,7 @@ function includeContainer($containerref)
|
||||
*/
|
||||
function getStructuredData($type, $data = array())
|
||||
{
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
|
||||
if ($type == 'software')
|
||||
{
|
||||
@ -556,7 +556,7 @@ function getStructuredData($type, $data = array())
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"price": "'.$data['price'].'",
|
||||
"priceCurrency": "'.($data['currency']?$data['currency']:$conf->currency).'"
|
||||
"priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'"
|
||||
}
|
||||
}'."\n";
|
||||
$ret .= '</script>'."\n";
|
||||
@ -607,8 +607,8 @@ function getStructuredData($type, $data = array())
|
||||
elseif ($type == 'product')
|
||||
{
|
||||
$ret = '<!-- Add structured data for blog post -->'."\n";
|
||||
$ret.= '<script type="application/ld+json">'."\n";
|
||||
$ret.= '{
|
||||
$ret .= '<script type="application/ld+json">'."\n";
|
||||
$ret .= '{
|
||||
"@context": "https://schema.org/",
|
||||
"@type": "Product",
|
||||
"name": "'.$data['label'].'",
|
||||
@ -629,7 +629,7 @@ function getStructuredData($type, $data = array())
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"url": "https://example.com/anvil",
|
||||
"priceCurrency": "'.($data['currency']?$data['currency']:$conf->currency).'",
|
||||
"priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'",
|
||||
"price": "'.$data['price'].'",
|
||||
"itemCondition": "https://schema.org/UsedCondition",
|
||||
"availability": "https://schema.org/InStock",
|
||||
@ -639,7 +639,7 @@ function getStructuredData($type, $data = array())
|
||||
}
|
||||
}
|
||||
}'."\n";
|
||||
$ret.= '</script>'."\n";
|
||||
$ret .= '</script>'."\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@ -656,55 +656,55 @@ function getStructuredData($type, $data = array())
|
||||
*/
|
||||
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
|
||||
{
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
|
||||
$error = 0;
|
||||
$arrayresult = array('code'=>'', 'list'=>array());
|
||||
|
||||
if (! is_object($weblangs)) $weblangs = $langs;
|
||||
if (!is_object($weblangs)) $weblangs = $langs;
|
||||
|
||||
if (empty($searchstring))
|
||||
{
|
||||
$error++;
|
||||
$arrayresult['code']='KO';
|
||||
$arrayresult['message']=$weblangs->trans("EmptySearchString");
|
||||
$arrayresult['code'] = 'KO';
|
||||
$arrayresult['message'] = $weblangs->trans("EmptySearchString");
|
||||
}
|
||||
elseif (dol_strlen($searchstring) < 2)
|
||||
{
|
||||
$weblangs->load("errors");
|
||||
$error++;
|
||||
$arrayresult['code']='KO';
|
||||
$arrayresult['message']=$weblangs->trans("ErrorSearchCriteriaTooSmall");
|
||||
$arrayresult['code'] = 'KO';
|
||||
$arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall");
|
||||
}
|
||||
elseif (! in_array($type, array('', 'page')))
|
||||
elseif (!in_array($type, array('', 'page')))
|
||||
{
|
||||
$error++;
|
||||
$arrayresult['code']='KO';
|
||||
$arrayresult['message']='Bad value for parameter $type';
|
||||
$arrayresult['code'] = 'KO';
|
||||
$arrayresult['message'] = 'Bad value for parameter $type';
|
||||
}
|
||||
|
||||
$searchdone = 0;
|
||||
$found = 0;
|
||||
|
||||
if (! $error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo)))
|
||||
if (!$error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo)))
|
||||
{
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page';
|
||||
$sql.= " WHERE fk_website = ".$website->id;
|
||||
if ($type) $sql.= " AND type_container = '".$db->escape($type)."'";
|
||||
$sql.= " AND (";
|
||||
$sql .= " WHERE fk_website = ".$website->id;
|
||||
if ($type) $sql .= " AND type_container = '".$db->escape($type)."'";
|
||||
$sql .= " AND (";
|
||||
$searchalgo = '';
|
||||
if (preg_match('/meta/', $algo))
|
||||
{
|
||||
$searchalgo.= ($searchalgo?' OR ':'')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
|
||||
$searchalgo.= ($searchalgo?' OR ':'')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
|
||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
|
||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
|
||||
}
|
||||
if (preg_match('/content/', $algo))
|
||||
{
|
||||
$searchalgo.= ($searchalgo?' OR ':'')."content LIKE '%".$db->escape($searchstring)."%'";
|
||||
$searchalgo .= ($searchalgo ? ' OR ' : '')."content LIKE '%".$db->escape($searchstring)."%'";
|
||||
}
|
||||
$sql.=$searchalgo;
|
||||
$sql.= ")";
|
||||
$sql.= $db->plimit($max);
|
||||
$sql .= $searchalgo;
|
||||
$sql .= ")";
|
||||
$sql .= $db->plimit($max);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -716,7 +716,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
|
||||
{
|
||||
$tmpwebsitepage = new WebsitePage($db);
|
||||
$tmpwebsitepage->fetch($obj->rowid);
|
||||
if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage;
|
||||
if ($tmpwebsitepage->id > 0) $arrayresult['list'][] = $tmpwebsitepage;
|
||||
$found++;
|
||||
}
|
||||
$i++;
|
||||
@ -725,69 +725,69 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$arrayresult['code']=$db->lasterrno();
|
||||
$arrayresult['message']=$db->lasterror();
|
||||
$arrayresult['code'] = $db->lasterrno();
|
||||
$arrayresult['message'] = $db->lasterror();
|
||||
}
|
||||
|
||||
$searchdone = 1;
|
||||
}
|
||||
|
||||
if (! $error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
|
||||
if (!$error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
|
||||
{
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$website->ref;
|
||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||
$filecss=$pathofwebsite.'/styles.css.php';
|
||||
$filejs=$pathofwebsite.'/javascript.js.php';
|
||||
$filerobot=$pathofwebsite.'/robots.txt';
|
||||
$filehtaccess=$pathofwebsite.'/.htaccess';
|
||||
$filemanifestjson=$pathofwebsite.'/manifest.json.php';
|
||||
$filereadme=$pathofwebsite.'/README.md';
|
||||
$pathofwebsite = $dolibarr_main_data_root.'/website/'.$website->ref;
|
||||
$filehtmlheader = $pathofwebsite.'/htmlheader.html';
|
||||
$filecss = $pathofwebsite.'/styles.css.php';
|
||||
$filejs = $pathofwebsite.'/javascript.js.php';
|
||||
$filerobot = $pathofwebsite.'/robots.txt';
|
||||
$filehtaccess = $pathofwebsite.'/.htaccess';
|
||||
$filemanifestjson = $pathofwebsite.'/manifest.json.php';
|
||||
$filereadme = $pathofwebsite.'/README.md';
|
||||
|
||||
$filecontent = file_get_contents($filehtmlheader);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
|
||||
{
|
||||
$arrayresult['list'][]=array('type'=>'website_htmlheadercontent');
|
||||
$arrayresult['list'][] = array('type'=>'website_htmlheadercontent');
|
||||
}
|
||||
|
||||
$filecontent = file_get_contents($filecss);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
|
||||
{
|
||||
$arrayresult['list'][]=array('type'=>'website_csscontent');
|
||||
$arrayresult['list'][] = array('type'=>'website_csscontent');
|
||||
}
|
||||
|
||||
$filecontent = file_get_contents($filejs);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
|
||||
{
|
||||
$arrayresult['list'][]=array('type'=>'website_jscontent');
|
||||
$arrayresult['list'][] = array('type'=>'website_jscontent');
|
||||
}
|
||||
|
||||
$filerobot = file_get_contents($filerobot);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
|
||||
{
|
||||
$arrayresult['list'][]=array('type'=>'website_robotcontent');
|
||||
$arrayresult['list'][] = array('type'=>'website_robotcontent');
|
||||
}
|
||||
|
||||
$searchdone = 1;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if ($searchdone)
|
||||
{
|
||||
$arrayresult['code']='OK';
|
||||
$arrayresult['code'] = 'OK';
|
||||
if (empty($arrayresult['list']))
|
||||
{
|
||||
$arrayresult['code']='KO';
|
||||
$arrayresult['message']=$weblangs->trans("NoRecordFound");
|
||||
$arrayresult['code'] = 'KO';
|
||||
$arrayresult['message'] = $weblangs->trans("NoRecordFound");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$arrayresult['code']='KO';
|
||||
$arrayresult['message']='No supported algorithm found';
|
||||
$arrayresult['code'] = 'KO';
|
||||
$arrayresult['message'] = 'No supported algorithm found';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -184,7 +184,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
|
||||
else dol_print_error($db);
|
||||
}
|
||||
// Add canonical reference
|
||||
$tplcontent .= '<link href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '') .'/'.$objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
|
||||
$tplcontent .= '<link href="'.(($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php')).'" rel="canonical" />'."\n";
|
||||
// Add manifest.json on homepage
|
||||
$tplcontent .= '<?php if ($website->use_manifest) { print \'<link rel="manifest" href="/manifest.json.php" />\'."\n"; } ?>'."\n";
|
||||
$tplcontent .= '<!-- Include link to CSS file -->'."\n";
|
||||
|
||||
@ -169,214 +169,214 @@ class modProduct extends DolibarrModules
|
||||
|
||||
// Exports
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",
|
||||
'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",
|
||||
'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
|
||||
'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
|
||||
'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.length_units'=>"LengthUnits", 'p.width'=>"Width", 'p.width_units'=>"WidthUnits", 'p.height'=>"Height", 'p.height_units'=>"HeightUnits",
|
||||
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
|
||||
'p.duration'=>"Duration",
|
||||
'p.finished' => 'Nature',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC",
|
||||
'p.tva_tx'=>'VATRate',
|
||||
'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
|
||||
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",
|
||||
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote'));
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text",
|
||||
'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text", 'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
|
||||
'p.customcode'=>'Text',
|
||||
'p.duration'=>"Text",
|
||||
'p.finished' => 'Numeric',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
// 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
// 'p.datec'=>'Date','p.tms'=>'Date'
|
||||
//);
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_base_type'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode",'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text",'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r] = array(
|
||||
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
// Import list of products
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="Products"; // Translation key
|
||||
$this->import_icon[$r]=$this->picto;
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
|
||||
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array(
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = "Products"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'p.ref' => "Ref*",
|
||||
'p.label' => "Label*",
|
||||
'p.fk_product_type' => "Type*",
|
||||
@ -576,7 +576,7 @@ class modProduct extends DolibarrModules
|
||||
)
|
||||
);
|
||||
|
||||
if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
|
||||
if (!is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
|
||||
@ -136,216 +136,216 @@ class modService extends DolibarrModules
|
||||
|
||||
// Exports
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("service","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",
|
||||
'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",
|
||||
'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("service", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
|
||||
'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
|
||||
'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.surface'=>"Surface", 'p.volume'=>"Volume",
|
||||
'p.duration'=>"Duration",
|
||||
'p.finished' => 'Nature',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC",
|
||||
'p.tva_tx'=>'VATRate',
|
||||
'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
|
||||
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",
|
||||
'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
|
||||
'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote'));
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text",
|
||||
'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.description'=>"Text", 'p.url'=>"Text", 'p.accountancy_code_sell'=>"Text",
|
||||
'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text", 'p.accountancy_code_buy'=>"Text",
|
||||
'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
|
||||
'p.customcode'=>'Text',
|
||||
'p.duration'=>"Text",
|
||||
'p.finished' => 'Numeric',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
$this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (!empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
|
||||
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
|
||||
{
|
||||
if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
|
||||
'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceLevelVATRate',
|
||||
'pr.date_price'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
//$this->export_TypeFields_array[$r]=array(
|
||||
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
|
||||
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
|
||||
// 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
// 'p.datec'=>'Date','p.tms'=>'Date'
|
||||
//);
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product",'pr.price'=>"product",
|
||||
'pr.price_base_type'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("produit","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode",'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text",'p.accountancy_code_buy_intra'=>"Text",'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text",'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date','p.tms'=>'Date'
|
||||
if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r]=array(
|
||||
'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct','p.accountancy_code_buy_intra'=>'virtualproduct','p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
|
||||
if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r] = array(
|
||||
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description"));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
}
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
// Import list of services
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->import_label[$r]="Products"; // Translation key
|
||||
$this->import_icon[$r]=$this->picto;
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
|
||||
$this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r]=array(
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = "Products"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'p.ref' => "Ref*",
|
||||
'p.label' => "Label*",
|
||||
'p.fk_product_type' => "Type*",
|
||||
@ -543,7 +543,7 @@ class modService extends DolibarrModules
|
||||
)
|
||||
);
|
||||
|
||||
if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
|
||||
if (!is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@ -154,7 +154,7 @@ $langs->load("modulebuilder");
|
||||
<?php print $form->selectarray('type', $type2label, GETPOST('type', 'alpha')); ?>
|
||||
</td></tr>
|
||||
<!-- Size -->
|
||||
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" size="5" value="<?php echo (GETPOST('size', 'alpha')?GETPOST('size', 'alpha'):''); ?>"></td></tr>
|
||||
<tr class="extra_size"><td class="fieldrequired"><?php echo $langs->trans("Size"); ?></td><td class="valeur"><input id="size" type="text" name="size" size="5" value="<?php echo (GETPOST('size', 'alpha') ?GETPOST('size', 'alpha') : ''); ?>"></td></tr>
|
||||
<!-- Default Value (for select list / radio/ checkbox) -->
|
||||
<tr id="value_choice">
|
||||
<td>
|
||||
@ -176,36 +176,36 @@ $langs->load("modulebuilder");
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Position -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOSTISSET('pos')?GETPOST('pos', 'int'):100; ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOSTISSET('pos') ?GETPOST('pos', 'int') : 100; ?>"></td></tr>
|
||||
<!-- Language file -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" id="langfile" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile', 'alpha')); ?>"></td></tr>
|
||||
<!-- Computed Value -->
|
||||
<?php if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value', 'none')?GETPOST('computed_value', 'none'):''); ?>"></td></tr>
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('computed_value', 'none') ?GETPOST('computed_value', 'none') : ''); ?>"></td></tr>
|
||||
<?php } else { ?>
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc")).$form->textwithpicto($langs->trans("Computedpersistent"), $langs->trans("ComputedpersistentDesc"), 1, 'warning'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
|
||||
<?php } ?>
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo (GETPOST('default_value', 'alpha')?GETPOST('default_value', 'alpha'):''); ?>"></td></tr>
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo (GETPOST('default_value', 'alpha') ?GETPOST('default_value', 'alpha') : ''); ?>"></td></tr>
|
||||
<!-- Unique -->
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo (GETPOST('unique', 'alpha')?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo (GETPOST('unique', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Required -->
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo (GETPOST('required', 'alpha')?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo (GETPOST('required', 'alpha') ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable', 'alpha') || ! GETPOST('button', 'alpha'))?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ((GETPOST('alwayseditable', 'alpha') || !GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int')!='' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo GETPOST('list', 'int') != '' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag(GETPOST('printable', 'int')); ?>"></td></tr>
|
||||
<!-- Totalizable -->
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha'))?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $langs->trans("Totalizable"); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ((GETPOST('totalizable', 'alpha') || GETPOST('button', 'alpha')) ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
<?php if ($conf->multicompany->enabled) { ?>
|
||||
<!-- Multicompany entity -->
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall', 'alpha') ? '':' checked'); ?>></td></tr>
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (GETPOST('entitycurrentorall', 'alpha') ? '' : ' checked'); ?>></td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@ -54,7 +54,7 @@ $langs->load("modulebuilder");
|
||||
var list = jQuery("#list");
|
||||
var totalizable = jQuery("#totalizable");
|
||||
<?php
|
||||
if ((GETPOST('type', 'alpha') != "select") && (GETPOST('type', 'alpha') != "sellist"))
|
||||
if ((GETPOST('type', 'alpha') != "select") && (GETPOST('type', 'alpha') != "sellist"))
|
||||
{
|
||||
print 'jQuery("#value_choice").hide();';
|
||||
}
|
||||
@ -149,38 +149,38 @@ $langs->load("modulebuilder");
|
||||
<table summary="listofattributes" class="border centpercent">
|
||||
|
||||
<?php
|
||||
$label=$extrafields->attributes[$elementtype]['label'][$attrname];
|
||||
$type=$extrafields->attributes[$elementtype]['type'][$attrname];
|
||||
$size=$extrafields->attributes[$elementtype]['size'][$attrname];
|
||||
$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
|
||||
$default=$extrafields->attributes[$elementtype]['default'][$attrname];
|
||||
$unique=$extrafields->attributes[$elementtype]['unique'][$attrname];
|
||||
$required=$extrafields->attributes[$elementtype]['required'][$attrname];
|
||||
$pos=$extrafields->attributes[$elementtype]['pos'][$attrname];
|
||||
$alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
|
||||
$param=$extrafields->attributes[$elementtype]['param'][$attrname];
|
||||
$perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
|
||||
$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
|
||||
$list=$extrafields->attributes[$elementtype]['list'][$attrname];
|
||||
$label = $extrafields->attributes[$elementtype]['label'][$attrname];
|
||||
$type = $extrafields->attributes[$elementtype]['type'][$attrname];
|
||||
$size = $extrafields->attributes[$elementtype]['size'][$attrname];
|
||||
$computed = $extrafields->attributes[$elementtype]['computed'][$attrname];
|
||||
$default = $extrafields->attributes[$elementtype]['default'][$attrname];
|
||||
$unique = $extrafields->attributes[$elementtype]['unique'][$attrname];
|
||||
$required = $extrafields->attributes[$elementtype]['required'][$attrname];
|
||||
$pos = $extrafields->attributes[$elementtype]['pos'][$attrname];
|
||||
$alwayseditable = $extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
|
||||
$param = $extrafields->attributes[$elementtype]['param'][$attrname];
|
||||
$perms = $extrafields->attributes[$elementtype]['perms'][$attrname];
|
||||
$langfile = $extrafields->attributes[$elementtype]['langfile'][$attrname];
|
||||
$list = $extrafields->attributes[$elementtype]['list'][$attrname];
|
||||
$totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname];
|
||||
$help=$extrafields->attributes[$elementtype]['help'][$attrname];
|
||||
$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
|
||||
$printable=$extrafields->attributes[$elementtype]['printable'][$attrname];
|
||||
$help = $extrafields->attributes[$elementtype]['help'][$attrname];
|
||||
$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname];
|
||||
$printable = $extrafields->attributes[$elementtype]['printable'][$attrname];
|
||||
|
||||
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
||||
if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
|
||||
{
|
||||
$param_chain = '';
|
||||
foreach ($param['options'] as $key => $value)
|
||||
{
|
||||
if(strlen($key))
|
||||
if (strlen($key))
|
||||
{
|
||||
$param_chain .= $key.','.$value."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
|
||||
elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
|
||||
{
|
||||
$paramlist=array_keys($param['options']);
|
||||
$paramlist = array_keys($param['options']);
|
||||
$param_chain = $paramlist[0];
|
||||
}
|
||||
?>
|
||||
@ -192,10 +192,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
|
||||
<tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur">
|
||||
<?php
|
||||
// Define list of possible type transition
|
||||
$typewecanchangeinto=array(
|
||||
$typewecanchangeinto = array(
|
||||
'varchar'=>array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'),
|
||||
'text'=>array('text','html'),
|
||||
'html'=>array('text','html'),
|
||||
'text'=>array('text', 'html'),
|
||||
'html'=>array('text', 'html'),
|
||||
'password'=>array('password', 'varchar'),
|
||||
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
|
||||
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
|
||||
@ -204,12 +204,12 @@ $typewecanchangeinto=array(
|
||||
);
|
||||
if (in_array($type, array_keys($typewecanchangeinto)))
|
||||
{
|
||||
$newarray=array();
|
||||
$newarray = array();
|
||||
print '<select id="type" class="flat type" name="type">';
|
||||
foreach($type2label as $key => $val)
|
||||
foreach ($type2label as $key => $val)
|
||||
{
|
||||
$selected='';
|
||||
if ($key == (GETPOST('type', 'alpha')?GETPOST('type', 'alpha'):$type)) $selected=' selected="selected"';
|
||||
$selected = '';
|
||||
if ($key == (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : $type)) $selected = ' selected="selected"';
|
||||
if (in_array($key, $typewecanchangeinto[$type])) print '<option value="'.$key.'"'.$selected.'>'.$val.'</option>';
|
||||
else print '<option value="'.$key.'" disabled="disabled"'.$selected.'>'.$val.'</option>';
|
||||
}
|
||||
@ -245,9 +245,9 @@ else
|
||||
</td>
|
||||
</tr>
|
||||
<!-- Position -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
|
||||
<!-- Language file -->
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
|
||||
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
|
||||
<!-- Computed value -->
|
||||
<?php if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
|
||||
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
|
||||
@ -257,23 +257,23 @@ else
|
||||
<!-- Default Value (at sql setup level) -->
|
||||
<tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" size="5" value="<?php echo dol_escape_htmltag($default); ?>"></td></tr>
|
||||
<!-- Unique -->
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_unique"><td><?php echo $langs->trans("Unique"); ?></td><td class="valeur"><input id="unique" type="checkbox" name="unique"<?php echo ($unique ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Required -->
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_required"><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required"<?php echo ($required ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Always editable -->
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_alwayseditable"><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable"<?php echo ($alwayseditable ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Visibility -->
|
||||
<tr><td class="extra_list"><?php echo $form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc")); ?>
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list!=''?$list:'1'); ?>"></td></tr>
|
||||
</td><td class="valeur"><input id="list" class="minwidth100" type="text" name="list" value="<?php echo ($list != '' ? $list : '1'); ?>"></td></tr>
|
||||
<!-- Visibility for PDF-->
|
||||
<tr><td class="extra_pdf"><?php echo $form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")); ?>
|
||||
</td><td class="valeur"><input id="printable" class="minwidth100" type="text" name="printable" value="<?php echo dol_escape_htmltag($printable); ?>"></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable?' checked':''); ?>></td></tr>
|
||||
<tr class="extra_totalizable"><td><?php echo $form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")); ?></td><td class="valeur"><input id="totalizable" type="checkbox" name="totalizable"<?php echo ($totalizable ? ' checked' : ''); ?>></td></tr>
|
||||
<!-- Help tooltip -->
|
||||
<tr class="help"><td><?php echo $form->textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?></td><td class="valeur"><input id="help" class="quatrevingtpercent" type="text" name="help" value="<?php echo dol_escape_htmltag($help); ?>"></td></tr>
|
||||
<?php if ($conf->multicompany->enabled) { ?>
|
||||
<!-- Multicompany entity -->
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ?' checked':''); ?>></td></tr>
|
||||
<tr><td><?php echo $langs->trans("AllEntities"); ?></td><td class="valeur"><input id="entitycurrentorall" type="checkbox" name="entitycurrentorall"<?php echo (empty($entitycurrentorall) ? ' checked' : ''); ?>></td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($langs) || ! is_object($langs))
|
||||
if (empty($langs) || !is_object($langs))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@ -66,7 +66,7 @@ print '<td class="center">'.$langs->trans("AlwaysEditable").'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).'</td>';
|
||||
print '<td class="center">'.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).'</td>';
|
||||
if ($conf->multicompany->enabled){
|
||||
if ($conf->multicompany->enabled) {
|
||||
print '<td class="center">'.$langs->trans("Entities").'</td>';
|
||||
}
|
||||
print '<td width="80"> </td>';
|
||||
@ -74,16 +74,16 @@ print "</tr>\n";
|
||||
|
||||
if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type']))
|
||||
{
|
||||
foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
|
||||
foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value)
|
||||
{
|
||||
// Load language if required
|
||||
if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
|
||||
if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
|
||||
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$extrafields->attributes[$elementtype]['pos'][$key]."</td>\n";
|
||||
print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
||||
print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
|
||||
print "<td>".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])."</td>\n";
|
||||
print "<td>".$key."</td>\n";
|
||||
print "<td>".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]."</td>\n";
|
||||
@ -95,7 +95,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
|
||||
print '<td class="center">'.$extrafields->attributes[$elementtype]['printable'][$key]."</td>\n";
|
||||
print '<td class="center">'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."</td>\n";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
if (!empty($conf->multicompany->enabled)) {
|
||||
print '<td class="center">';
|
||||
if (empty($extrafields->attributes[$elementtype]['entityid'][$key]))
|
||||
{
|
||||
@ -103,7 +103,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
}
|
||||
else {
|
||||
global $multicompanylabel_cache;
|
||||
if (! is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
|
||||
if (!is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
|
||||
if (empty($multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]])) {
|
||||
global $mc;
|
||||
$mc->getInfo($extrafields->attributes[$elementtype]['entityid'][$key]);
|
||||
@ -120,8 +120,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan=13;
|
||||
if (! empty($conf->multicompany->enabled)) $colspan++;
|
||||
$colspan = 13;
|
||||
if (!empty($conf->multicompany->enabled)) $colspan++;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="opacitymedium" colspan="'.$colspan.'">';
|
||||
|
||||
@ -128,10 +128,10 @@ if ($permission)
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php
|
||||
$nbofcontacts=$form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
|
||||
$nbofcontacts = $form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
|
||||
|
||||
$newcardbutton = '';
|
||||
if (! empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
|
||||
if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
|
||||
{
|
||||
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
}
|
||||
@ -140,13 +140,13 @@ if ($permission)
|
||||
</div>
|
||||
<div class="tagtd maxwidthonsmartphone noborderbottom">
|
||||
<?php
|
||||
$tmpobject=$object;
|
||||
if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
|
||||
$tmpobject = $object;
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc;
|
||||
$formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?>
|
||||
</div>
|
||||
<div class="tagtd noborderbottom"> </div>
|
||||
<div class="tagtd center noborderbottom">
|
||||
<input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled'; ?>>
|
||||
<input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (!$nbofcontacts) echo ' disabled'; ?>>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -162,11 +162,11 @@ print "</div>";
|
||||
|
||||
// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder)
|
||||
$list = array();
|
||||
foreach(array('internal', 'external') as $source)
|
||||
foreach (array('internal', 'external') as $source)
|
||||
{
|
||||
$tmpobject = $object;
|
||||
|
||||
if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc))
|
||||
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc))
|
||||
{
|
||||
$tmpobject = $objectsrc;
|
||||
}
|
||||
@ -200,27 +200,27 @@ foreach(array('internal', 'external') as $source)
|
||||
{
|
||||
$entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
}
|
||||
elseif (! $tab[$i]['socid'])
|
||||
elseif (!$tab[$i]['socid'])
|
||||
{
|
||||
$entry->thirdparty = "";
|
||||
}
|
||||
|
||||
if ($tab[$i]['source']=='internal')
|
||||
if ($tab[$i]['source'] == 'internal')
|
||||
{
|
||||
$userstatic->fetch($tab[$i]['id']);
|
||||
$entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($tab[$i]['source']=='external')
|
||||
elseif ($tab[$i]['source'] == 'external')
|
||||
{
|
||||
$contactstatic->fetch($tab[$i]['id']);
|
||||
$entry->contact =$contactstatic->getNomUrl(1, '', 0, '', 0, 0);
|
||||
$entry->contact = $contactstatic->getNomUrl(1, '', 0, '', 0, 0);
|
||||
}
|
||||
|
||||
if ($tab[$i]['source']=='internal')
|
||||
if ($tab[$i]['source'] == 'internal')
|
||||
{
|
||||
$entry->status = $userstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
}
|
||||
elseif ($tab[$i]['source']=='external')
|
||||
elseif ($tab[$i]['source'] == 'external')
|
||||
{
|
||||
$entry->status = $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
|
||||
}
|
||||
@ -279,7 +279,7 @@ print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "
|
||||
print_liste_field_titre($arrayfields['link']['label'], $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>";
|
||||
|
||||
foreach($list as $entry)
|
||||
foreach ($list as $entry)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -314,8 +314,8 @@ print "</div>";
|
||||
print "<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->\n";
|
||||
if (is_object($hookmanager)) {
|
||||
$hookmanager->initHooks(array('contacttpl'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
|
||||
}
|
||||
print "<!-- END PHP TEMPLATE CONTACTS -->\n";
|
||||
|
||||
|
||||
@ -37,14 +37,14 @@ if (empty($conf) || !is_object($conf))
|
||||
<?php
|
||||
|
||||
// Other attributes
|
||||
if (! isset($parameters)) $parameters = array();
|
||||
if (!isset($parameters)) $parameters = array();
|
||||
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$params = array();
|
||||
if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
|
||||
$params['cols']=$parameters['colspanvalue'];
|
||||
$params['cols'] = $parameters['colspanvalue'];
|
||||
print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params
|
||||
}
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@ -37,12 +37,12 @@ if (empty($conf) || ! is_object($conf))
|
||||
<?php
|
||||
|
||||
// Other attributes
|
||||
if (! isset($parameters)) $parameters = array();
|
||||
if (!isset($parameters)) $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$params=array();
|
||||
$params['cols']=$parameters['colspanvalue'];
|
||||
$params = array();
|
||||
$params['cols'] = $parameters['colspanvalue'];
|
||||
print $object->showOptionals($extrafields, 'edit', $params);
|
||||
}
|
||||
|
||||
|
||||
@ -378,7 +378,7 @@ if ($nolinesbefore) {
|
||||
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"]) ?GETPOST("qty", 'alpha', 2) : 1); ?>">
|
||||
</td>
|
||||
<?php
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print $form->selectUnits($line->fk_unit, "units");
|
||||
@ -636,7 +636,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
|
||||
{
|
||||
console.log("We are in a price per qty context, we do not call ajax/product");
|
||||
} else {
|
||||
<?php if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
|
||||
<?php if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
|
||||
if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we are not yet able to get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
|
||||
<?php } ?>
|
||||
// Get the HT price for the product and display it
|
||||
|
||||
@ -59,13 +59,13 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
|
||||
if (!empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
|
||||
|
||||
$key='MAIN_LOGEVENTS_'.$action;
|
||||
$key = 'MAIN_LOGEVENTS_'.$action;
|
||||
//dol_syslog("xxxxxxxxxxx".$key);
|
||||
if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
|
||||
if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
|
||||
|
||||
if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
|
||||
if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
|
||||
|
||||
$date = dol_now();
|
||||
|
||||
@ -76,18 +76,18 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text="(UserLogged,".$object->login.")";
|
||||
$text.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
|
||||
$desc="(UserLogged,".$object->login.")";
|
||||
$desc.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
|
||||
$text = "(UserLogged,".$object->login.")";
|
||||
$text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
|
||||
$desc = "(UserLogged,".$object->login.")";
|
||||
$desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
|
||||
}
|
||||
if ($action == 'USER_LOGIN_FAILED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$object->trigger_mesg; // Message direct
|
||||
$desc=$object->trigger_mesg; // Message direct
|
||||
$text = $object->trigger_mesg; // Message direct
|
||||
$desc = $object->trigger_mesg; // Message direct
|
||||
}
|
||||
if ($action == 'USER_LOGOUT')
|
||||
{
|
||||
@ -95,8 +95,8 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text="(UserLogoff,".$object->login.")";
|
||||
$desc="(UserLogoff,".$object->login.")";
|
||||
$text = "(UserLogoff,".$object->login.")";
|
||||
$desc = "(UserLogoff,".$object->login.")";
|
||||
}
|
||||
if ($action == 'USER_CREATE')
|
||||
{
|
||||
@ -104,8 +104,8 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("NewUserCreated", $object->login);
|
||||
$desc=$langs->transnoentities("NewUserCreated", $object->login);
|
||||
$text = $langs->transnoentities("NewUserCreated", $object->login);
|
||||
$desc = $langs->transnoentities("NewUserCreated", $object->login);
|
||||
}
|
||||
elseif ($action == 'USER_MODIFY')
|
||||
{
|
||||
@ -113,8 +113,8 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("EventUserModified", $object->login);
|
||||
$desc=$langs->transnoentities("EventUserModified", $object->login);
|
||||
$text = $langs->transnoentities("EventUserModified", $object->login);
|
||||
$desc = $langs->transnoentities("EventUserModified", $object->login);
|
||||
}
|
||||
elseif ($action == 'USER_NEW_PASSWORD')
|
||||
{
|
||||
@ -122,8 +122,8 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
$langs->load("users");
|
||||
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("NewUserPassword", $object->login);
|
||||
$desc=$langs->transnoentities("NewUserPassword", $object->login);
|
||||
$text = $langs->transnoentities("NewUserPassword", $object->login);
|
||||
$desc = $langs->transnoentities("NewUserPassword", $object->login);
|
||||
}
|
||||
elseif ($action == 'USER_ENABLEDISABLE')
|
||||
{
|
||||
@ -132,13 +132,13 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
$text=$langs->transnoentities("UserEnabled", $object->login);
|
||||
$desc=$langs->transnoentities("UserEnabled", $object->login);
|
||||
$text = $langs->transnoentities("UserEnabled", $object->login);
|
||||
$desc = $langs->transnoentities("UserEnabled", $object->login);
|
||||
}
|
||||
if ($object->statut == 1)
|
||||
{
|
||||
$text=$langs->transnoentities("UserDisabled", $object->login);
|
||||
$desc=$langs->transnoentities("UserDisabled", $object->login);
|
||||
$text = $langs->transnoentities("UserDisabled", $object->login);
|
||||
$desc = $langs->transnoentities("UserDisabled", $object->login);
|
||||
}
|
||||
}
|
||||
elseif ($action == 'USER_DELETE')
|
||||
@ -146,8 +146,8 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("UserDeleted", $object->login);
|
||||
$desc=$langs->transnoentities("UserDeleted", $object->login);
|
||||
$text = $langs->transnoentities("UserDeleted", $object->login);
|
||||
$desc = $langs->transnoentities("UserDeleted", $object->login);
|
||||
}
|
||||
|
||||
// Groupes
|
||||
@ -156,24 +156,24 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("NewGroupCreated", $object->name);
|
||||
$desc=$langs->transnoentities("NewGroupCreated", $object->name);
|
||||
$text = $langs->transnoentities("NewGroupCreated", $object->name);
|
||||
$desc = $langs->transnoentities("NewGroupCreated", $object->name);
|
||||
}
|
||||
elseif ($action == 'GROUP_MODIFY')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("GroupModified", $object->name);
|
||||
$desc=$langs->transnoentities("GroupModified", $object->name);
|
||||
$text = $langs->transnoentities("GroupModified", $object->name);
|
||||
$desc = $langs->transnoentities("GroupModified", $object->name);
|
||||
}
|
||||
elseif ($action == 'GROUP_DELETE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("users");
|
||||
// Initialisation donnees (date,duree,texte,desc)
|
||||
$text=$langs->transnoentities("GroupDeleted", $object->name);
|
||||
$desc=$langs->transnoentities("GroupDeleted", $object->name);
|
||||
$text = $langs->transnoentities("GroupDeleted", $object->name);
|
||||
$desc = $langs->transnoentities("GroupDeleted", $object->name);
|
||||
}
|
||||
|
||||
// If not found
|
||||
@ -186,28 +186,28 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
*/
|
||||
|
||||
// Add more information into desc from the context property
|
||||
if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit'];
|
||||
if (!empty($desc) && !empty($object->context['audit'])) $desc .= ' - '.$object->context['audit'];
|
||||
|
||||
// Add entry in event table
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
||||
|
||||
$event=new Events($this->db);
|
||||
$event->type=$action;
|
||||
$event->dateevent=$date;
|
||||
$event->label=$text;
|
||||
$event->description=$desc;
|
||||
$event->user_agent=$_SERVER["HTTP_USER_AGENT"];
|
||||
$event = new Events($this->db);
|
||||
$event->type = $action;
|
||||
$event->dateevent = $date;
|
||||
$event->label = $text;
|
||||
$event->description = $desc;
|
||||
$event->user_agent = $_SERVER["HTTP_USER_AGENT"];
|
||||
|
||||
$result=$event->create($user);
|
||||
$result = $event->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error ="Failed to insert security event: ".$event->error;
|
||||
$error = "Failed to insert security event: ".$event->error;
|
||||
$this->errors[] = $error;
|
||||
$this->error=$error;
|
||||
$this->error = $error;
|
||||
|
||||
dol_syslog(get_class($this).": ".$error, LOG_ERR);
|
||||
return -1;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -27,27 +27,27 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies","donations"));
|
||||
$langs->loadLangs(array("companies", "donations"));
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="d.datedon";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "d.datedon";
|
||||
|
||||
$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
|
||||
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref=GETPOST('search_ref', 'alpha');
|
||||
$search_company=GETPOST('search_company', 'alpha');
|
||||
$search_name=GETPOST('search_name', 'alpha');
|
||||
$search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$search_name = GETPOST('search_name', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
@ -79,26 +79,26 @@ $fieldstosearchall = array(
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
|
||||
$form = new Form($db);
|
||||
if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
|
||||
|
||||
llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones');
|
||||
|
||||
$donationstatic=new Don($db);
|
||||
$donationstatic = new Don($db);
|
||||
|
||||
// Genere requete de liste des dons
|
||||
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
|
||||
$sql.= " d.amount, d.fk_statut as status,";
|
||||
$sql.= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
||||
$sql .= " d.amount, d.fk_statut as status,";
|
||||
$sql .= " p.rowid as pid, p.ref, p.title, p.public";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
|
||||
$sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
|
||||
if ($search_status != '' && $search_status != '-4')
|
||||
{
|
||||
$sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
|
||||
}
|
||||
if (trim($search_ref) != '')
|
||||
{
|
||||
$sql.= natural_search('d.ref', $search_ref);
|
||||
$sql .= natural_search('d.ref', $search_ref);
|
||||
}
|
||||
if (trim($search_all) != '')
|
||||
{
|
||||
@ -137,17 +137,17 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status);
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||
if ($search_name) $param .= '&search_name='.urlencode($search_name);
|
||||
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
||||
|
||||
$newcardbutton='';
|
||||
$newcardbutton = '';
|
||||
if ($user->rights->don->creer)
|
||||
{
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
|
||||
}
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
@ -163,19 +163,19 @@ if ($resql)
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_thirdparty" value="'.$search_thirdparty.'">';
|
||||
print '</td>';
|
||||
@ -207,21 +207,21 @@ if ($resql)
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
|
||||
} else {
|
||||
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder);
|
||||
@ -236,15 +236,15 @@ if ($resql)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$donationstatic->id=$objp->rowid;
|
||||
$donationstatic->ref=$objp->rowid;
|
||||
$donationstatic->lastname=$objp->lastname;
|
||||
$donationstatic->firstname=$objp->firstname;
|
||||
$donationstatic->id = $objp->rowid;
|
||||
$donationstatic->ref = $objp->rowid;
|
||||
$donationstatic->lastname = $objp->lastname;
|
||||
$donationstatic->firstname = $objp->firstname;
|
||||
print "<td>".$donationstatic->getNomUrl(1)."</td>";
|
||||
if (! empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
$company=new Societe($db);
|
||||
$result=$company->fetch($objp->socid);
|
||||
if (!empty($objp->socid) && $company->id > 0) {
|
||||
if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) {
|
||||
$company = new Societe($db);
|
||||
$result = $company->fetch($objp->socid);
|
||||
if (!empty($objp->socid) && $company->id > 0) {
|
||||
print "<td>".$company->getNomUrl(1)."</td>";
|
||||
} else {
|
||||
print "<td>".$objp->societe."</td>";
|
||||
|
||||
@ -814,7 +814,7 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
//var_dump($regforval[count($regforval)-1]);exit;
|
||||
// Overwrite param $tmpproperty
|
||||
$object->$tmpproperty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
|
||||
$object->$tmpproperty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1135,7 +1135,7 @@ class EmailCollector extends CommonObject
|
||||
if (function_exists('imap_mime_header_decode')) {
|
||||
$elements = imap_mime_header_decode($overview[0]->subject);
|
||||
$newstring = '';
|
||||
if (! empty($elements)) {
|
||||
if (!empty($elements)) {
|
||||
$num = count($elements);
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$newstring .= ($newstring ? ' ' : '').$elements[$i]->text;
|
||||
@ -1426,7 +1426,7 @@ class EmailCollector extends CommonObject
|
||||
{
|
||||
//var_dump($regforval[count($regforval)-1]);exit;
|
||||
// Overwrite param $tmpproperty
|
||||
$nametouseforthirdparty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null;
|
||||
$nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1796,10 +1796,10 @@ class EmailCollector extends CommonObject
|
||||
}
|
||||
// Create event specific on hook
|
||||
// this code action is hook..... for support this call
|
||||
elseif (substr($operation['type'], 0, 4) == 'hook'){
|
||||
elseif (substr($operation['type'], 0, 4) == 'hook') {
|
||||
global $hookmanager;
|
||||
|
||||
if(!is_object($hookmanager))
|
||||
if (!is_object($hookmanager))
|
||||
$hookmanager->initHooks(array('emailcollectorcard'));
|
||||
|
||||
$parameters = array(
|
||||
@ -1807,24 +1807,24 @@ class EmailCollector extends CommonObject
|
||||
'imapemail'=>$imapemail,
|
||||
'overview'=>$overview,
|
||||
|
||||
'from' => $from ,
|
||||
'from' => $from,
|
||||
'fromtext' => $fromtext,
|
||||
|
||||
'actionparam'=> $operation['actionparam'],
|
||||
|
||||
|
||||
|
||||
'thirdpartyid' => $thirdpartyid ,
|
||||
'thirdpartyid' => $thirdpartyid,
|
||||
'objectid'=> $objectid,
|
||||
'objectemail'=> $objectemail,
|
||||
|
||||
'messagetext'=>$messagetext,
|
||||
'subject'=>$subject,
|
||||
'header'=>$header,
|
||||
) ;
|
||||
);
|
||||
$res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
|
||||
|
||||
if($res < 0 )
|
||||
if ($res < 0)
|
||||
$this->error = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
@ -2047,7 +2047,7 @@ class EmailCollector extends CommonObject
|
||||
|
||||
// TEXT
|
||||
if ($p->type == 0 && $data) {
|
||||
if(!empty($params['charset'])) {
|
||||
if (!empty($params['charset'])) {
|
||||
$data = $this->convertStringEncoding($data, $params['charset']);
|
||||
}
|
||||
// Messages may be split in different parts because of inline attachments,
|
||||
@ -2065,7 +2065,7 @@ class EmailCollector extends CommonObject
|
||||
// There are no PHP functions to parse embedded messages,
|
||||
// so this just appends the raw source to the main message.
|
||||
elseif ($p->type == 2 && $data) {
|
||||
if(!empty($params['charset'])) {
|
||||
if (!empty($params['charset'])) {
|
||||
$data = $this->convertStringEncoding($data, $params['charset']);
|
||||
}
|
||||
$plainmsg .= $data."\n\n";
|
||||
@ -2091,14 +2091,14 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
protected function convertStringEncoding($string, $fromEncoding, $toEncoding = 'UTF-8')
|
||||
{
|
||||
if(!$string || $fromEncoding == $toEncoding) {
|
||||
if (!$string || $fromEncoding == $toEncoding) {
|
||||
return $string;
|
||||
}
|
||||
$convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) : null;
|
||||
if(!$convertedString && extension_loaded('mbstring')) {
|
||||
$convertedString = function_exists('iconv') ? @iconv($fromEncoding, $toEncoding.'//IGNORE', $string) : null;
|
||||
if (!$convertedString && extension_loaded('mbstring')) {
|
||||
$convertedString = @mb_convert_encoding($string, $toEncoding, $fromEncoding);
|
||||
}
|
||||
if(!$convertedString) {
|
||||
if (!$convertedString) {
|
||||
throw new Exception('Mime string encoding conversion failed');
|
||||
}
|
||||
return $convertedString;
|
||||
|
||||
@ -287,90 +287,90 @@ class Expedition extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (";
|
||||
$sql.= "ref";
|
||||
$sql.= ", entity";
|
||||
$sql.= ", ref_customer";
|
||||
$sql.= ", ref_int";
|
||||
$sql.= ", date_creation";
|
||||
$sql.= ", fk_user_author";
|
||||
$sql.= ", date_expedition";
|
||||
$sql.= ", date_delivery";
|
||||
$sql.= ", fk_soc";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_address";
|
||||
$sql.= ", fk_shipping_method";
|
||||
$sql.= ", tracking_number";
|
||||
$sql.= ", weight";
|
||||
$sql.= ", size";
|
||||
$sql.= ", width";
|
||||
$sql.= ", height";
|
||||
$sql.= ", weight_units";
|
||||
$sql.= ", size_units";
|
||||
$sql.= ", note_private";
|
||||
$sql.= ", note_public";
|
||||
$sql.= ", model_pdf";
|
||||
$sql.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".($this->ref_customer?"'".$this->db->escape($this->ref_customer)."'":"null");
|
||||
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".($this->date_expedition>0?"'".$this->db->idate($this->date_expedition)."'":"null");
|
||||
$sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null");
|
||||
$sql.= ", ".$this->socid;
|
||||
$sql.= ", ".$this->fk_project;
|
||||
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
|
||||
$sql.= ", '".$this->db->escape($this->tracking_number)."'";
|
||||
$sql.= ", ".$this->weight;
|
||||
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
||||
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
||||
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
||||
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
||||
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
||||
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null");
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ")";
|
||||
$sql .= "ref";
|
||||
$sql .= ", entity";
|
||||
$sql .= ", ref_customer";
|
||||
$sql .= ", ref_int";
|
||||
$sql .= ", date_creation";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", date_expedition";
|
||||
$sql .= ", date_delivery";
|
||||
$sql .= ", fk_soc";
|
||||
$sql .= ", fk_projet";
|
||||
$sql .= ", fk_address";
|
||||
$sql .= ", fk_shipping_method";
|
||||
$sql .= ", tracking_number";
|
||||
$sql .= ", weight";
|
||||
$sql .= ", size";
|
||||
$sql .= ", width";
|
||||
$sql .= ", height";
|
||||
$sql .= ", weight_units";
|
||||
$sql .= ", size_units";
|
||||
$sql .= ", note_private";
|
||||
$sql .= ", note_public";
|
||||
$sql .= ", model_pdf";
|
||||
$sql .= ", fk_incoterms, location_incoterms";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'(PROV)'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null");
|
||||
$sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null");
|
||||
$sql .= ", '".$this->db->idate($now)."'";
|
||||
$sql .= ", ".$user->id;
|
||||
$sql .= ", ".($this->date_expedition > 0 ? "'".$this->db->idate($this->date_expedition)."'" : "null");
|
||||
$sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null");
|
||||
$sql .= ", ".$this->socid;
|
||||
$sql .= ", ".$this->fk_project;
|
||||
$sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : "null");
|
||||
$sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null");
|
||||
$sql .= ", '".$this->db->escape($this->tracking_number)."'";
|
||||
$sql .= ", ".$this->weight;
|
||||
$sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth
|
||||
$sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth
|
||||
$sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight
|
||||
$sql .= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
|
||||
$sql .= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
|
||||
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
|
||||
$sql .= ", ".(int) $this->fk_incoterms;
|
||||
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expedition");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition";
|
||||
$sql.= " SET ref = '(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql .= " SET ref = '(PROV".$this->id.")'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
// Insert of lines
|
||||
$num=count($this->lines);
|
||||
$num = count($this->lines);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
if (! isset($this->lines[$i]->detail_batch))
|
||||
if (!isset($this->lines[$i]->detail_batch))
|
||||
{ // no batch management
|
||||
if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0)
|
||||
if (!$this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // with batch management
|
||||
if (! $this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0)
|
||||
if (!$this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $this->id && $this->origin_id)
|
||||
if (!$error && $this->id && $this->origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked();
|
||||
if (!$ret)
|
||||
@ -535,24 +535,24 @@ class Expedition extends CommonObject
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
|
||||
$sql.= ", e.date_valid";
|
||||
$sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||
$sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
||||
$sql.= ", e.fk_shipping_method, e.tracking_number";
|
||||
$sql.= ", e.note_private, e.note_public";
|
||||
$sql.= ', e.fk_incoterms, e.location_incoterms';
|
||||
$sql.= ', i.libelle as label_incoterms';
|
||||
$sql.= ', s.libelle as shipping_method';
|
||||
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid';
|
||||
$sql.= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||
if ($id) $sql.= " AND e.rowid=".$id;
|
||||
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($notused) $sql.= " AND e.ref_int='".$this->db->escape($notused)."'";
|
||||
$sql .= ", e.date_valid";
|
||||
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||
$sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
||||
$sql .= ", e.fk_shipping_method, e.tracking_number";
|
||||
$sql .= ", e.note_private, e.note_public";
|
||||
$sql .= ', e.fk_incoterms, e.location_incoterms';
|
||||
$sql .= ', i.libelle as label_incoterms';
|
||||
$sql .= ', s.libelle as shipping_method';
|
||||
$sql .= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as s ON e.fk_shipping_method = s.rowid';
|
||||
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
|
||||
if ($id) $sql .= " AND e.rowid=".$id;
|
||||
if ($ref) $sql .= " AND e.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($notused) $sql .= " AND e.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -565,26 +565,26 @@ class Expedition extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->socid = $obj->socid;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_customer = $obj->ref_customer;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->ref_int = $obj->ref_int;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
|
||||
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
|
||||
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
|
||||
$this->fk_delivery_address = $obj->fk_address;
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->shipping_method_id = $obj->fk_shipping_method;
|
||||
$this->shipping_method = $obj->shipping_method;
|
||||
$this->shipping_method = $obj->shipping_method;
|
||||
$this->tracking_number = $obj->tracking_number;
|
||||
$this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility
|
||||
$this->origin = ($obj->origin ? $obj->origin : 'commande'); // For compatibility
|
||||
$this->origin_id = $obj->origin_id;
|
||||
$this->billed = $obj->billed;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->trueWeight = $obj->weight;
|
||||
$this->weight_units = $obj->weight_units;
|
||||
@ -763,7 +763,7 @@ class Expedition extends CommonObject
|
||||
// line without batch detail
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref));
|
||||
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref));
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $mouvS->error;
|
||||
@ -777,7 +777,7 @@ class Expedition extends CommonObject
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->error = $mouvS->error;
|
||||
@ -819,17 +819,17 @@ class Expedition extends CommonObject
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'expedition/sending/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expedition/sending/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'expedition/sending/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expedition/sending/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
if (!$resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($numref);
|
||||
$dirsource = $conf->expedition->dir_output.'/sending/'.$oldref;
|
||||
$dirdest = $conf->expedition->dir_output.'/sending/'.$newref;
|
||||
if (! $error && file_exists($dirsource))
|
||||
if (!$error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
@ -852,13 +852,13 @@ class Expedition extends CommonObject
|
||||
}
|
||||
|
||||
// Set new ref and current status
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->ref = $numref;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -866,7 +866,7 @@ class Expedition extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
return -1 * $error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1173,32 +1173,32 @@ class Expedition extends CommonObject
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
|
||||
|
||||
$error=0;
|
||||
$this->error='';
|
||||
$error = 0;
|
||||
$this->error = '';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Add a protection to refuse deleting if shipment has at least one delivery
|
||||
$this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
|
||||
$this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
|
||||
if (count($this->linkedObjectsIds) > 0)
|
||||
{
|
||||
$this->error='ErrorThereIsSomeDeliveries';
|
||||
$this->error = 'ErrorThereIsSomeDeliveries';
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('SHIPPING_DELETE', $user);
|
||||
$result = $this->call_trigger('SHIPPING_DELETE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Stock control
|
||||
if (! $error && $conf->stock->enabled &&
|
||||
if (!$error && $conf->stock->enabled &&
|
||||
(($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) ||
|
||||
($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock)))
|
||||
{
|
||||
@ -1387,20 +1387,20 @@ class Expedition extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf, $mysoc;
|
||||
// TODO: recuperer les champs du document associe a part
|
||||
$this->lines=array();
|
||||
$this->lines = array();
|
||||
|
||||
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
||||
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||
$sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
|
||||
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
|
||||
$sql.= " WHERE ed.fk_expedition = ".$this->id;
|
||||
$sql.= " AND ed.fk_origin_line = cd.rowid";
|
||||
$sql.= " ORDER BY cd.rang, ed.fk_origin_line";
|
||||
$sql .= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||
$sql .= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.info_bits, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang";
|
||||
$sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||
$sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||
$sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
|
||||
$sql .= " WHERE ed.fk_expedition = ".$this->id;
|
||||
$sql .= " AND ed.fk_origin_line = cd.rowid";
|
||||
$sql .= " ORDER BY cd.rang, ed.fk_origin_line";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1461,7 +1461,7 @@ class Expedition extends CommonObject
|
||||
$line->label = $obj->custom_label;
|
||||
$line->description = $obj->description;
|
||||
$line->qty_asked = $obj->qty_asked;
|
||||
$line->rang = $obj->rang;
|
||||
$line->rang = $obj->rang;
|
||||
$line->weight = $obj->weight;
|
||||
$line->weight_units = $obj->weight_units;
|
||||
$line->length = $obj->length;
|
||||
@ -1750,23 +1750,23 @@ class Expedition extends CommonObject
|
||||
$this->origin_id = 1;
|
||||
$this->origin = 'commande';
|
||||
|
||||
$this->note_private = 'Private note';
|
||||
$this->note_public = 'Public note';
|
||||
$this->note_private = 'Private note';
|
||||
$this->note_public = 'Public note';
|
||||
|
||||
$nbp = 5;
|
||||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$line=new ExpeditionLigne($this->db);
|
||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$line->libelle=$langs->trans("Description")." ".$xnbp; // deprecated
|
||||
$line->label=$langs->trans("Description")." ".$xnbp;
|
||||
$line->qty=10;
|
||||
$line->qty_asked=5;
|
||||
$line->qty_shipped=4;
|
||||
$line->fk_product=$this->commande->lines[$xnbp]->fk_product;
|
||||
$line = new ExpeditionLigne($this->db);
|
||||
$line->desc = $langs->trans("Description")." ".$xnbp;
|
||||
$line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated
|
||||
$line->label = $langs->trans("Description")." ".$xnbp;
|
||||
$line->qty = 10;
|
||||
$line->qty_asked = 5;
|
||||
$line->qty_shipped = 4;
|
||||
$line->fk_product = $this->commande->lines[$xnbp]->fk_product;
|
||||
|
||||
$this->lines[]=$line;
|
||||
$this->lines[] = $line;
|
||||
$xnbp++;
|
||||
}
|
||||
}
|
||||
@ -1820,17 +1820,17 @@ class Expedition extends CommonObject
|
||||
$this->meths = array();
|
||||
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql.= " WHERE em.active = 1";
|
||||
$sql.= " ORDER BY em.libelle ASC";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
$sql .= " WHERE em.active = 1";
|
||||
$sql .= " ORDER BY em.libelle ASC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||
$this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
|
||||
$label = $langs->trans('SendingMethod'.$obj->code);
|
||||
$this->meths[$obj->rowid] = ($label != 'SendingMethod'.$obj->code ? $label : $obj->label);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1848,11 +1848,11 @@ class Expedition extends CommonObject
|
||||
global $langs;
|
||||
|
||||
$this->listmeths = array();
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$sql = "SELECT em.rowid, em.code, em.libelle as label, em.description, em.tracking, em.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
if ($id!='') $sql.= " WHERE em.rowid=".$id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em";
|
||||
if ($id != '') $sql .= " WHERE em.rowid=".$id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -1861,8 +1861,8 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$this->listmeths[$i]['rowid'] = $obj->rowid;
|
||||
$this->listmeths[$i]['code'] = $obj->code;
|
||||
$label=$langs->trans('SendingMethod'.$obj->code);
|
||||
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code?$label:$obj->label);
|
||||
$label = $langs->trans('SendingMethod'.$obj->code);
|
||||
$this->listmeths[$i]['libelle'] = ($label != 'SendingMethod'.$obj->code ? $label : $obj->label);
|
||||
$this->listmeths[$i]['description'] = $obj->description;
|
||||
$this->listmeths[$i]['tracking'] = $obj->tracking;
|
||||
$this->listmeths[$i]['active'] = $obj->active;
|
||||
@ -2316,16 +2316,16 @@ class Expedition extends CommonObject
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("sendings");
|
||||
|
||||
if (! dol_strlen($modele)) {
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'rouget';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
$modele = $this->modelpdf;
|
||||
} elseif (! empty($conf->global->EXPEDITION_ADDON_PDF)) {
|
||||
} elseif (!empty($conf->global->EXPEDITION_ADDON_PDF)) {
|
||||
$modele = $conf->global->EXPEDITION_ADDON_PDF;
|
||||
}
|
||||
}
|
||||
@ -2567,10 +2567,10 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($this->fk_expedition) || empty($this->fk_origin_line) || ! is_numeric($this->qty))
|
||||
if (empty($this->fk_expedition) || empty($this->fk_origin_line) || !is_numeric($this->qty))
|
||||
{
|
||||
$this->error = 'ErrorMandatoryParametersNotProvided';
|
||||
return -1;
|
||||
@ -2589,18 +2589,18 @@ class ExpeditionLigne extends CommonObjectLine
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expeditiondet (";
|
||||
$sql.= "fk_expedition";
|
||||
$sql.= ", fk_entrepot";
|
||||
$sql.= ", fk_origin_line";
|
||||
$sql.= ", qty";
|
||||
$sql.= ", rang";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $this->fk_expedition;
|
||||
$sql.= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
|
||||
$sql.= ", ".$this->fk_origin_line;
|
||||
$sql.= ", ".$this->qty;
|
||||
$sql.= ", ".$ranktouse;
|
||||
$sql.= ")";
|
||||
$sql .= "fk_expedition";
|
||||
$sql .= ", fk_entrepot";
|
||||
$sql .= ", fk_origin_line";
|
||||
$sql .= ", qty";
|
||||
$sql .= ", rang";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $this->fk_expedition;
|
||||
$sql .= ", ".(empty($this->entrepot_id) ? 'NULL' : $this->entrepot_id);
|
||||
$sql .= ", ".$this->fk_origin_line;
|
||||
$sql .= ", ".$this->qty;
|
||||
$sql .= ", ".$ranktouse;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -31,14 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('bills', 'banks', 'trips'));
|
||||
|
||||
$id=GETPOST("id", 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$id = GETPOST("id", 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$amounts = array();
|
||||
$accountid=GETPOST('accountid', 'int');
|
||||
$accountid = GETPOST('accountid', 'int');
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
$socid = 0;
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
$socid = $user->socid;
|
||||
@ -51,7 +51,7 @@ if ($user->socid > 0)
|
||||
|
||||
if ($action == 'add_payment')
|
||||
{
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
@ -62,7 +62,7 @@ if ($action == 'add_payment')
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$result = $expensereport->fetch($id, $ref);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($expensereport->error, $expensereport->errors, 'errors');
|
||||
@ -70,7 +70,7 @@ if ($action == 'add_payment')
|
||||
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
|
||||
if (! ($_POST["fk_typepayment"] > 0))
|
||||
if (!($_POST["fk_typepayment"] > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
@ -80,13 +80,13 @@ if ($action == 'add_payment')
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! ($accountid > 0))
|
||||
if (!empty($conf->banque->enabled) && !($accountid > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountToDebit")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$paymentid = 0;
|
||||
$total = 0;
|
||||
@ -104,10 +104,10 @@ if ($action == 'add_payment')
|
||||
if (count($amounts) <= 0)
|
||||
{
|
||||
$error++;
|
||||
$errmsg='ErrorNoPaymentDefined';
|
||||
$errmsg = 'ErrorNoPaymentDefined';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
@ -115,13 +115,13 @@ if ($action == 'add_payment')
|
||||
$payment = new PaymentExpenseReport($db);
|
||||
$payment->fk_expensereport = $expensereport->id;
|
||||
$payment->datepaid = $datepaid;
|
||||
$payment->amounts = $amounts; // Tableau de montant
|
||||
$payment->amounts = $amounts; // Tableau de montant
|
||||
$payment->total = $total;
|
||||
$payment->fk_typepayment = GETPOST("fk_typepayment", 'int');
|
||||
$payment->num_payment = GETPOST("num_payment", 'alphanothtml');
|
||||
$payment->note_public = GETPOST("note_public", 'none');
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$paymentid = $payment->create($user);
|
||||
if ($paymentid < 0)
|
||||
@ -131,10 +131,10 @@ if ($action == 'add_payment')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$result=$payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', '');
|
||||
if (! $result > 0)
|
||||
$result = $payment->addPaymentToBank($user, 'payment_expensereport', '(ExpenseReportPayment)', $accountid, '', '');
|
||||
if (!$result > 0)
|
||||
{
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
$error++;
|
||||
@ -152,7 +152,7 @@ if ($action == 'add_payment')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id;
|
||||
@ -166,7 +166,7 @@ if ($action == 'add_payment')
|
||||
}
|
||||
}
|
||||
|
||||
$action='create';
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ if ($action == 'add_payment')
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
// Form to create expense report payment
|
||||
@ -188,7 +188,7 @@ if ($action == 'create' || empty($action))
|
||||
$total = $expensereport->total_ttc;
|
||||
|
||||
// autofill remainder amount
|
||||
if (! empty($conf->use_javascript_ajax)) {
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
//Add js for AutoFill
|
||||
print ' $(document).ready(function () {';
|
||||
@ -224,18 +224,18 @@ if ($action == 'create' || empty($action))
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($expensereport->total_ttc, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
$sql = "SELECT sum(p.amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$id;
|
||||
$sql.= ' AND e.entity IN ('.getEntity('expensereport').')';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sql .= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$id;
|
||||
$sql .= ' AND e.entity IN ('.getEntity('expensereport').')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$sumpaid = $obj->total;
|
||||
$db->free();
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total - $sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -249,7 +249,7 @@ if ($action == 'create' || empty($action))
|
||||
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Date").'</td><td colspan="2">';
|
||||
$datepaid = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST("reday", 'int'), GETPOST("reyear", 'int'));
|
||||
$datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?(empty($_POST["remonth"])?-1:$datepaid):0;
|
||||
$datepayment = empty($conf->global->MAIN_AUTOFILL_DATE) ? (empty($_POST["remonth"]) ?-1 : $datepaid) : 0;
|
||||
print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1);
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
@ -259,12 +259,12 @@ if ($action == 'create' || empty($action))
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
$form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", "int") : $expensereport->accountid, "accountid", 0, '', 1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -298,8 +298,8 @@ if ($action == 'create' || empty($action))
|
||||
print '<td class="center">'.$langs->trans("Amount").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$total=0;
|
||||
$totalrecu=0;
|
||||
$total = 0;
|
||||
$totalrecu = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -318,7 +318,7 @@ if ($action == 'create' || empty($action))
|
||||
$nameRemain = "remain_".$objp->id; // autofill remainder amount
|
||||
if (!empty($conf->use_javascript_ajax)) // autofill remainder amount
|
||||
print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->total_ttc - $sumpaid)."'"); // autofill remainder amount
|
||||
$remaintopay=$objp->total_ttc - $sumpaid; // autofill remainder amount
|
||||
$remaintopay = $objp->total_ttc - $sumpaid; // autofill remainder amount
|
||||
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">'; // autofill remainder amount
|
||||
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||
}
|
||||
@ -330,9 +330,9 @@ if ($action == 'create' || empty($action))
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total+=$objp->total;
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$totalrecu+=$objp->am;
|
||||
$total += $objp->total;
|
||||
$total_ttc += $objp->total_ttc;
|
||||
$totalrecu += $objp->am;
|
||||
$i++;
|
||||
}
|
||||
if ($i > 1)
|
||||
|
||||
@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
class Fichinter extends CommonObject
|
||||
{
|
||||
|
||||
public $fields=array(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
@ -57,7 +57,7 @@ class Fichinter extends CommonObject
|
||||
'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105,'showoncombobox'=>1),
|
||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120),
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
* \ingroup fichinter
|
||||
* \brief File of class to manage intervention statistics
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -64,22 +64,22 @@ class FichinterStats extends Stats
|
||||
$this->userid = $userid;
|
||||
$this->cachefilesuffix = $mode;
|
||||
|
||||
$this->where.= " c.entity = ".$conf->entity;
|
||||
$this->where .= " c.entity = ".$conf->entity;
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Fichinter($this->db);
|
||||
$object = new Fichinter($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='0';
|
||||
$this->field_line='0';
|
||||
$this->field = '0';
|
||||
$this->field_line = '0';
|
||||
//$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND c.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND c.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND c.fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) $this->where .= ' AND c.fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,14 +94,14 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -116,11 +116,11 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, COUNT(*) as nb, 0";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -137,14 +137,14 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -159,12 +159,12 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -179,11 +179,11 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_valid,'%Y') as year, COUNT(*) as nb, 0 as total, 0 as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -200,13 +200,13 @@ class FichinterStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, 0 as total, 0 as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND c.rowid = tl.fk_fichinter AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND c.rowid = tl.fk_fichinter AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
|
||||
@ -436,14 +436,14 @@ if (empty($reshook))
|
||||
// Fac builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissiontoadd=$user->rights->facture->creer;
|
||||
$permissiontoadd = $user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
}
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
|
||||
@ -559,7 +559,7 @@ if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.eleme
|
||||
if ($search_total_ht != '') $sql .= natural_search('cf.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_vat != '') $sql .= natural_search('cf.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('cf.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND cf.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND cf.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('cf.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('cf.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('cf.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1064,98 +1064,98 @@ if ($resql)
|
||||
$thirdpartytmp->email = $obj->email;
|
||||
print $thirdpartytmp->getNomUrl(1, 'supplier');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
if (!empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
if (!empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
$tmparray=getCountry($obj->fk_pays, 'all');
|
||||
$tmparray = getCountry($obj->fk_pays, 'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type ent
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Order date
|
||||
if (! empty($arrayfields['cf.date_commande']['checked']))
|
||||
if (!empty($arrayfields['cf.date_commande']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day');
|
||||
else print '';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Plannned date of delivery
|
||||
if (! empty($arrayfields['cf.date_delivery']['checked']))
|
||||
if (!empty($arrayfields['cf.date_delivery']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_delivery), 'day');
|
||||
if ($objectstatic->hasDelay() && ! empty($objectstatic->date_delivery)) {
|
||||
if ($objectstatic->hasDelay() && !empty($objectstatic->date_delivery)) {
|
||||
print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning");
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['cf.total_ht']['checked']))
|
||||
if (!empty($arrayfields['cf.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ht';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ht';
|
||||
$totalarray['val']['cf.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['cf.total_vat']['checked']))
|
||||
if (!empty($arrayfields['cf.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_tva)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_vat';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_vat';
|
||||
$totalarray['val']['cf.total_vat'] += $obj->total_tva;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['cf.total_ttc']['checked']))
|
||||
if (!empty($arrayfields['cf.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='cf.total_ttc';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'cf.total_ttc';
|
||||
$totalarray['val']['cf.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['cf.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1163,7 +1163,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['cf.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -1189,48 +1189,48 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['cf.datec']['checked']))
|
||||
if (!empty($arrayfields['cf.datec']['checked']))
|
||||
{
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['cf.tms']['checked']))
|
||||
if (!empty($arrayfields['cf.tms']['checked']))
|
||||
{
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['cf.fk_statut']['checked']))
|
||||
if (!empty($arrayfields['cf.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Billed
|
||||
if (! empty($arrayfields['cf.billed']['checked']))
|
||||
if (!empty($arrayfields['cf.billed']['checked']))
|
||||
{
|
||||
print '<td class="center">'.yn($obj->billed).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -102,7 +102,7 @@ $day = GETPOST('day', 'int');
|
||||
$month = GETPOST('month', 'int');
|
||||
$year = GETPOST('year', 'int');
|
||||
$day_lim = GETPOST('day_lim', 'int');
|
||||
$month_lim = GETPOST('month_lim', 'int');
|
||||
$month_lim = GETPOST('month_lim', 'int');
|
||||
$year_lim = GETPOST('year_lim', 'int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$search_btn = GETPOST('button_search', 'alpha');
|
||||
@ -213,52 +213,52 @@ if (empty($reshook))
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha')) // All tests must be present to be compatible with all browsers
|
||||
{
|
||||
$search_all="";
|
||||
$search_user='';
|
||||
$search_sale='';
|
||||
$search_product_category='';
|
||||
$search_ref="";
|
||||
$search_refsupplier="";
|
||||
$search_type="";
|
||||
$search_label="";
|
||||
$search_project='';
|
||||
$search_company="";
|
||||
$search_amount_no_tax="";
|
||||
$search_amount_all_tax="";
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
$search_montant_localtax1='';
|
||||
$search_montant_localtax2='';
|
||||
$search_montant_ttc='';
|
||||
$search_all = "";
|
||||
$search_user = '';
|
||||
$search_sale = '';
|
||||
$search_product_category = '';
|
||||
$search_ref = "";
|
||||
$search_refsupplier = "";
|
||||
$search_type = "";
|
||||
$search_label = "";
|
||||
$search_project = '';
|
||||
$search_company = "";
|
||||
$search_amount_no_tax = "";
|
||||
$search_amount_all_tax = "";
|
||||
$search_montant_ht = '';
|
||||
$search_montant_vat = '';
|
||||
$search_montant_localtax1 = '';
|
||||
$search_montant_localtax2 = '';
|
||||
$search_montant_ttc = '';
|
||||
$search_multicurrency_code = '';
|
||||
$search_multicurrency_tx = '';
|
||||
$search_multicurrency_montant_ht = '';
|
||||
$search_multicurrency_montant_vat = '';
|
||||
$search_multicurrency_montant_ttc = '';
|
||||
$search_status='';
|
||||
$search_paymentmode='';
|
||||
$search_town='';
|
||||
$search_zip="";
|
||||
$search_state="";
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_type_thirdparty='';
|
||||
$year="";
|
||||
$month="";
|
||||
$day="";
|
||||
$year_lim="";
|
||||
$month_lim="";
|
||||
$day_lim="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
$filter='';
|
||||
$option='';
|
||||
$socid="";
|
||||
$search_status = '';
|
||||
$search_paymentmode = '';
|
||||
$search_town = '';
|
||||
$search_zip = "";
|
||||
$search_state = "";
|
||||
$search_type = '';
|
||||
$search_country = '';
|
||||
$search_type_thirdparty = '';
|
||||
$year = "";
|
||||
$month = "";
|
||||
$day = "";
|
||||
$year_lim = "";
|
||||
$month_lim = "";
|
||||
$day_lim = "";
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
$filter = '';
|
||||
$option = '';
|
||||
$socid = "";
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='FactureFournisseur';
|
||||
$objectlabel='SupplierInvoices';
|
||||
$objectclass = 'FactureFournisseur';
|
||||
$objectlabel = 'SupplierInvoices';
|
||||
$permissiontoread = $user->rights->fournisseur->facture->lire;
|
||||
$permissiontoadd = $user->rights->fournisseur->facture->creer;
|
||||
$permissiontodelete = $user->rights->fournisseur->facture->supprimer;
|
||||
@ -354,7 +354,7 @@ if ($search_montant_vat != '') $sql .= natural_search('f.total_tva', $search_mon
|
||||
if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1);
|
||||
if ($search_montant_localtax2 != '') $sql .= natural_search('f.localtax2', $search_montant_localtax2, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND f.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1014,143 +1014,143 @@ if ($resql)
|
||||
print img_warning($langs->trans('Late'));
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
if (!empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
if ($obj->project_id > 0)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_label;
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
$projectstatic->title = $obj->project_label;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $thirdparty->getNomUrl(1, 'supplier');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
if (!empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
if (!empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd center">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
$tmparray=getCountry($obj->fk_pays, 'all');
|
||||
$tmparray = getCountry($obj->fk_pays, 'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type ent
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['f.total_ht']['checked']))
|
||||
if (!empty($arrayfields['f.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ht';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht';
|
||||
$totalarray['val']['f.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['f.total_vat']['checked']))
|
||||
if (!empty($arrayfields['f.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_vat)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_vat';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_vat';
|
||||
$totalarray['val']['f.total_vat'] += $obj->total_vat;
|
||||
}
|
||||
// Amount LocalTax1
|
||||
if (! empty($arrayfields['f.total_localtax1']['checked']))
|
||||
if (!empty($arrayfields['f.total_localtax1']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_localtax1)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax1';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax1';
|
||||
$totalarray['val']['f.total_localtax1'] += $obj->total_localtax1;
|
||||
}
|
||||
// Amount LocalTax2
|
||||
if (! empty($arrayfields['f.total_localtax2']['checked']))
|
||||
if (!empty($arrayfields['f.total_localtax2']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_localtax2)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_localtax2';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_localtax2';
|
||||
$totalarray['val']['f.total_localtax2'] += $obj->total_localtax2;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
if (!empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['dynamount_payed']['checked']))
|
||||
if (!empty($arrayfields['dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):' ').'</td>'; // TODO Use a denormalized field
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totalam';
|
||||
print '<td class="right nowrap">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalam';
|
||||
$totalarray['val']['totalam'] += $totalpay;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['rtp']['checked']))
|
||||
if (!empty($arrayfields['rtp']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').'</td>'; // TODO Use a denormalized field
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='rtp';
|
||||
print '<td class="right nowrap">'.(!empty($remaintopay) ?price($remaintopay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'rtp';
|
||||
$totalarray['val']['rtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['f.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1158,7 +1158,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['f.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -755,8 +755,8 @@ class MyObject extends CommonObject
|
||||
$label = $langs->trans("ShowMyObject");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
|
||||
@ -770,27 +770,27 @@ class MyObject extends CommonObject
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
} else {
|
||||
if ($withpicto) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
list($class, $module) = explode('@', $this->picto);
|
||||
$upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref);
|
||||
$upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
|
||||
$filearray = dol_dir_list($upload_dir, "files");
|
||||
$filename = $filearray[0]['name'];
|
||||
if(!empty($filename)){
|
||||
if (!empty($filename)) {
|
||||
$pospoint = strpos($filearray[0]['name'], '.');
|
||||
|
||||
$pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint);
|
||||
$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
|
||||
if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
|
||||
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>';
|
||||
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
|
||||
}
|
||||
else {
|
||||
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>';
|
||||
$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
|
||||
}
|
||||
|
||||
$result .= '</div>';
|
||||
}
|
||||
else {
|
||||
$result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ if ($conf->use_javascript_ajax)
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->SetHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($totalnb?0:1);
|
||||
print $dolgraph->show($totalnb ? 0 : 1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -138,15 +138,15 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
* Last modified BOM
|
||||
*/
|
||||
|
||||
$max=5;
|
||||
$max = 5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('bom').")";
|
||||
$sql.= $db->order("a.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('bom').")";
|
||||
$sql .= $db->order("a.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -162,10 +162,10 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticbom->id=$obj->rowid;
|
||||
$staticbom->ref=$obj->ref;
|
||||
$staticbom->date_modification=$obj->datem;
|
||||
$staticbom->status=$obj->status;
|
||||
$staticbom->id = $obj->rowid;
|
||||
$staticbom->ref = $obj->ref;
|
||||
$staticbom->date_modification = $obj->datem;
|
||||
$staticbom->status = $obj->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticbom->getNomUrl(1, 32).'</td>';
|
||||
@ -176,7 +176,7 @@ if ($resql)
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><span class="opacitymedium">' . $langs->trans("None") . '</span></td>';
|
||||
print '<td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table></div>";
|
||||
@ -191,15 +191,15 @@ else
|
||||
* Last modified MOs
|
||||
*/
|
||||
|
||||
$max=5;
|
||||
$max = 5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('mo').")";
|
||||
$sql.= $db->order("a.tms", "DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as a";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('mo').")";
|
||||
$sql .= $db->order("a.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -215,10 +215,10 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticmo->id=$obj->rowid;
|
||||
$staticmo->ref=$obj->ref;
|
||||
$staticmo->date_modification=$obj->datem;
|
||||
$staticmo->status=$obj->status;
|
||||
$staticmo->id = $obj->rowid;
|
||||
$staticmo->ref = $obj->ref;
|
||||
$staticmo->date_modification = $obj->datem;
|
||||
$staticmo->status = $obj->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$staticmo->getNomUrl(1, 32).'</td>';
|
||||
@ -229,7 +229,7 @@ if ($resql)
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><span class="opacitymedium">' . $langs->trans("None") . '</span></td>';
|
||||
print '<td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table></div>";
|
||||
|
||||
@ -2181,7 +2181,7 @@ class Product extends CommonObject
|
||||
$this->barcode_type = $obj->fk_barcode_type;
|
||||
|
||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
|
||||
$this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
|
||||
$this->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
|
||||
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
||||
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
|
||||
|
||||
@ -37,11 +37,11 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
||||
$socid='';
|
||||
if (! empty($user->socid)) $socid=$user->socid;
|
||||
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
$socid = '';
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('productstatsorder'));
|
||||
@ -49,7 +49,7 @@ $hookmanager->initHooks(array('productstatsorder'));
|
||||
$mesg = '';
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
@ -57,54 +57,54 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="c.date_commande";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "c.date_commande";
|
||||
$search_month = GETPOST('search_month', 'alpha');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_month='';
|
||||
$search_year='';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$orderstatic=new Commande($db);
|
||||
$societestatic=new Societe($db);
|
||||
$orderstatic = new Commande($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$form = new Form($db);
|
||||
$formother= new FormOther($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
llxHeader("", "", $langs->trans("CardProduct".$product->type));
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==Product::TYPE_SERVICE?'service':'product');
|
||||
$head = product_prepare_head($product);
|
||||
$titre = $langs->trans("CardProduct".$product->type);
|
||||
$picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
dol_fiche_head($head, 'referers', $titre, -1, $picto);
|
||||
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
@ -126,28 +126,28 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
|
||||
$sql.= " c.ref_client,";
|
||||
$sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commandedet as d";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity IN (".getEntity('commande').")";
|
||||
$sql.= " AND d.fk_commande = c.rowid";
|
||||
$sql.= " AND d.fk_product =".$product->id;
|
||||
if (! empty($search_month))
|
||||
$sql.= ' AND MONTH(c.date_commande) IN (' . $search_month . ')';
|
||||
if (! empty($search_year))
|
||||
$sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= " c.ref_client,";
|
||||
$sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."commandedet as d";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity IN (".getEntity('commande').")";
|
||||
$sql .= " AND d.fk_commande = c.rowid";
|
||||
$sql .= " AND d.fk_product =".$product->id;
|
||||
if (!empty($search_month))
|
||||
$sql .= ' AND MONTH(c.date_commande) IN ('.$search_month.')';
|
||||
if (!empty($search_year))
|
||||
$sql .= ' AND YEAR(c.date_commande) IN ('.$search_year.')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
//Calcul total qty and amount for global if full scan list
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
@ -164,30 +164,30 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if (! empty($id))
|
||||
if (!empty($id))
|
||||
$option .= '&id='.$product->id;
|
||||
if (! empty($search_month))
|
||||
if (!empty($search_month))
|
||||
$option .= '&search_month='.$search_month;
|
||||
if (! empty($search_year))
|
||||
if (!empty($search_year))
|
||||
$option .= '&search_year='.$search_year;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
if (! empty($sortorder))
|
||||
print '<input type="hidden" name="sortorder" value="' . $sortorder . '"/>';
|
||||
if (! empty($page)) {
|
||||
print '<input type="hidden" name="page" value="' . $page . '"/>';
|
||||
$option .= '&page=' . $page;
|
||||
print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
if (!empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
if (!empty($sortorder))
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
|
||||
if (!empty($page)) {
|
||||
print '<input type="hidden" name="page" value="'.$page.'"/>';
|
||||
$option .= '&page='.$page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
|
||||
print $langs->trans('Month') . ':<input class="flat" type="text" size="4" name="search_month" value="' . $search_month . '"> ';
|
||||
print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
|
||||
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';
|
||||
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print '<div style="vertical-align: middle; display: inline-block">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
@ -214,12 +214,12 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
|
||||
$orderstatic->id=$objp->commandeid;
|
||||
$orderstatic->ref=$objp->ref;
|
||||
$orderstatic->ref_client=$objp->ref_client;
|
||||
$orderstatic->id = $objp->commandeid;
|
||||
$orderstatic->ref = $objp->ref;
|
||||
$orderstatic->ref_client = $objp->ref_client;
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -38,19 +38,19 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
|
||||
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
|
||||
$socid='';
|
||||
if (! empty($user->socid)) $socid=$user->socid;
|
||||
$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
$socid = '';
|
||||
if (!empty($user->socid)) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('productstatsinvoice'));
|
||||
|
||||
$showmessage=GETPOST('showmessage');
|
||||
$showmessage = GETPOST('showmessage');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
@ -58,15 +58,15 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined,
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.datef";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "f.datef";
|
||||
|
||||
$search_month = GETPOST('search_month', 'alpha');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$search_month='';
|
||||
$search_year='';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
|
||||
@ -75,21 +75,21 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
||||
* View
|
||||
*/
|
||||
|
||||
$invoicestatic=new Facture($db);
|
||||
$societestatic=new Societe($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
$societestatic = new Societe($db);
|
||||
|
||||
$form = new Form($db);
|
||||
$formother= new FormOther($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
$object = $product;
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('id'=>$id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
@ -97,32 +97,32 @@ if ($id > 0 || ! empty($ref))
|
||||
$shortlabel = dol_trunc($object->label, 16);
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT))
|
||||
{
|
||||
$title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Referers');
|
||||
$helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
|
||||
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
}
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
|
||||
{
|
||||
$title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Referers');
|
||||
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
|
||||
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==Product::TYPE_SERVICE?'service':'product');
|
||||
$head = product_prepare_head($product);
|
||||
$titre = $langs->trans("CardProduct".$product->type);
|
||||
$picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
dol_fiche_head($head, 'referers', $titre, -1, $picto);
|
||||
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$shownav = 1;
|
||||
if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
|
||||
if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
|
||||
|
||||
@ -147,28 +147,28 @@ if ($id > 0 || ! empty($ref))
|
||||
elseif ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
|
||||
$sql.= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
$sql.= " AND d.fk_product =".$product->id;
|
||||
if (! empty($search_month))
|
||||
$sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')';
|
||||
if (! empty($search_year))
|
||||
$sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND d.fk_facture = f.rowid";
|
||||
$sql .= " AND d.fk_product =".$product->id;
|
||||
if (!empty($search_month))
|
||||
$sql .= ' AND MONTH(f.datef) IN ('.$search_month.')';
|
||||
if (!empty($search_year))
|
||||
$sql .= ' AND YEAR(f.datef) IN ('.$search_year.')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
@ -178,37 +178,37 @@ if ($id > 0 || ! empty($ref))
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if (! empty($id))
|
||||
if (!empty($id))
|
||||
$option .= '&id='.$product->id;
|
||||
if (! empty($search_month))
|
||||
if (!empty($search_month))
|
||||
$option .= '&search_month='.$search_month;
|
||||
if (! empty($search_year))
|
||||
if (!empty($search_year))
|
||||
$option .= '&search_year='.$search_year;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
if (! empty($sortorder))
|
||||
print '<input type="hidden" name="sortorder" value="' . $sortorder . '"/>';
|
||||
if (! empty($page)) {
|
||||
print '<input type="hidden" name="page" value="' . $page . '"/>';
|
||||
$option .= '&page=' . $page;
|
||||
print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
|
||||
if (!empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
|
||||
if (!empty($sortorder))
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'"/>';
|
||||
if (!empty($page)) {
|
||||
print '<input type="hidden" name="page" value="'.$page.'"/>';
|
||||
$option .= '&page='.$page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - ';
|
||||
print $langs->trans('Month') . ':<input class="flat" type="text" size="4" name="search_month" value="' . $search_month . '"> ';
|
||||
print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
|
||||
print $langs->trans('Month').':<input class="flat" type="text" size="4" name="search_month" value="'.$search_month.'"> ';
|
||||
print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
|
||||
print '<div style="vertical-align: middle; display: inline-block">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
@ -235,13 +235,13 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty);
|
||||
if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty = -($objp->qty);
|
||||
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
|
||||
$invoicestatic->id=$objp->facid;
|
||||
$invoicestatic->ref=$objp->ref;
|
||||
$invoicestatic->id = $objp->facid;
|
||||
$invoicestatic->ref = $objp->ref;
|
||||
$societestatic->fetch($objp->socid);
|
||||
$paiement = $invoicestatic->getSommePaiement();
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ abstract class ActionsCardCommon
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
|
||||
/**
|
||||
@ -66,7 +66,7 @@ abstract class ActionsCardCommon
|
||||
//$ret = $this->getInstanceDao();
|
||||
|
||||
$object = new Societe($this->db);
|
||||
if (! empty($id) || ! empty($ref)) $object->fetch($id, $ref);
|
||||
if (!empty($id) || !empty($ref)) $object->fetch($id, $ref);
|
||||
$this->object = $object;
|
||||
}
|
||||
|
||||
@ -87,13 +87,13 @@ abstract class ActionsCardCommon
|
||||
|
||||
if ($action == 'add' || $action == 'update') $this->assign_post($action);
|
||||
|
||||
if ($_GET["type"]=='f') { $this->object->fournisseur=1; }
|
||||
if ($_GET["type"]=='c') { $this->object->client=1; }
|
||||
if ($_GET["type"]=='p') { $this->object->client=2; }
|
||||
if ($_GET["type"]=='cp') { $this->object->client=3; }
|
||||
if ($_REQUEST["private"]==1) { $this->object->particulier=1; }
|
||||
if ($_GET["type"] == 'f') { $this->object->fournisseur = 1; }
|
||||
if ($_GET["type"] == 'c') { $this->object->client = 1; }
|
||||
if ($_GET["type"] == 'p') { $this->object->client = 2; }
|
||||
if ($_GET["type"] == 'cp') { $this->object->client = 3; }
|
||||
if ($_REQUEST["private"] == 1) { $this->object->particulier = 1; }
|
||||
|
||||
foreach($this->object as $key => $value)
|
||||
foreach ($this->object as $key => $value)
|
||||
{
|
||||
$this->tpl[$key] = $value;
|
||||
}
|
||||
@ -140,15 +140,15 @@ abstract class ActionsCardCommon
|
||||
}
|
||||
|
||||
// Load object modCodeClient
|
||||
$module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard');
|
||||
$module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
|
||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
||||
{
|
||||
$module = substr($module, 0, dol_strlen($module)-4);
|
||||
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||
}
|
||||
$dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
|
||||
$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
|
||||
foreach ($dirsociete as $dirroot)
|
||||
{
|
||||
$res=dol_include_once($dirroot.$module.'.php');
|
||||
$res = dol_include_once($dirroot.$module.'.php');
|
||||
if ($res) break;
|
||||
}
|
||||
$modCodeClient = new $module($db);
|
||||
@ -168,23 +168,23 @@ abstract class ActionsCardCommon
|
||||
$this->tpl['customercode'] = $this->object->code_client;
|
||||
if ((!$this->object->code_client || $this->object->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this->object, 0);
|
||||
$this->tpl['ismodifiable_customercode'] = $this->object->codeclient_modifiable();
|
||||
$s=$modCodeClient->getToolTip($langs, $this->object, 0);
|
||||
$s = $modCodeClient->getToolTip($langs, $this->object, 0);
|
||||
$this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1);
|
||||
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
if (!empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$this->tpl['supplier_enabled'] = 1;
|
||||
|
||||
// Load object modCodeFournisseur
|
||||
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
||||
$module = $conf->global->SOCIETE_CODECLIENT_ADDON;
|
||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
||||
{
|
||||
$module = substr($module, 0, dol_strlen($module)-4);
|
||||
$module = substr($module, 0, dol_strlen($module) - 4);
|
||||
}
|
||||
$dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
|
||||
$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
|
||||
foreach ($dirsociete as $dirroot)
|
||||
{
|
||||
$res=dol_include_once($dirroot.$module.'.php');
|
||||
$res = dol_include_once($dirroot.$module.'.php');
|
||||
if ($res) break;
|
||||
}
|
||||
$modCodeFournisseur = new $module;
|
||||
@ -197,7 +197,7 @@ abstract class ActionsCardCommon
|
||||
$this->tpl['suppliercode'] = $this->object->code_fournisseur;
|
||||
if ((!$this->object->code_fournisseur || $this->object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this->object, 1);
|
||||
$this->tpl['ismodifiable_suppliercode'] = $this->object->codefournisseur_modifiable();
|
||||
$s=$modCodeFournisseur->getToolTip($langs, $this->object, 1);
|
||||
$s = $modCodeFournisseur->getToolTip($langs, $this->object, 1);
|
||||
$this->tpl['help_suppliercode'] = $form->textwithpicto('', $s, 1);
|
||||
|
||||
$this->object->LoadSupplierCateg();
|
||||
@ -205,10 +205,10 @@ abstract class ActionsCardCommon
|
||||
}
|
||||
|
||||
// Zip
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 6);
|
||||
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
|
||||
|
||||
// Town
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode','selectcountry_id','state_id'));
|
||||
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
|
||||
|
||||
// Country
|
||||
$this->object->country_id = ($this->object->country_id ? $this->object->country_id : $mysoc->country_id);
|
||||
@ -223,39 +223,39 @@ abstract class ActionsCardCommon
|
||||
else $this->tpl['select_state'] = $countrynotdefined;
|
||||
|
||||
// Language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang?$this->object->default_lang:$conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1);
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->tpl['select_lang'] = $formadmin->select_language(($this->object->default_lang ? $this->object->default_lang : $conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1);
|
||||
|
||||
// VAT
|
||||
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation
|
||||
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value', $this->tpl['tva_assuj'], 1); // Assujeti par defaut en creation
|
||||
|
||||
// Select users
|
||||
$this->tpl['select_users'] = $form->select_dolusers($this->object->commercial_id, 'commercial_id', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
|
||||
// Local Tax
|
||||
// TODO mettre dans une classe propre au pays
|
||||
if($mysoc->country_code=='ES')
|
||||
if ($mysoc->country_code == 'ES')
|
||||
{
|
||||
$this->tpl['localtax'] = '';
|
||||
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
||||
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
||||
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'].= '</td></tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
||||
$this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'] .= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
||||
$this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'] .= '</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
elseif ($mysoc->localtax1_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'].= '</td><tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||
$this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'] .= '</td><tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
elseif ($mysoc->localtax2_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'].= '</td><tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||
$this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1);
|
||||
$this->tpl['localtax'] .= '</td><tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,76 +263,76 @@ abstract class ActionsCardCommon
|
||||
{
|
||||
$head = societe_prepare_head($this->object);
|
||||
|
||||
$this->tpl['showhead']=dol_get_fiche_head($head, 'card', '', 0, 'company');
|
||||
$this->tpl['showend']=dol_get_fiche_end();
|
||||
$this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company');
|
||||
$this->tpl['showend'] = dol_get_fiche_end();
|
||||
|
||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->socid?0:1), 'rowid', 'nom');
|
||||
$this->tpl['showrefnav'] = $form->showrefnav($this->object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
|
||||
$this->tpl['checkcustomercode'] = $this->object->check_codeclient();
|
||||
$this->tpl['checksuppliercode'] = $this->object->check_codefournisseur();
|
||||
$this->tpl['address'] = dol_nl2br($this->object->address);
|
||||
$this->tpl['address'] = dol_nl2br($this->object->address);
|
||||
|
||||
$img=picto_from_langcode($this->object->country_code);
|
||||
if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img?$img.' ':'').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||
$this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
|
||||
$img = picto_from_langcode($this->object->country_code);
|
||||
if ($this->object->isInEEC()) $this->tpl['country'] = $form->textwithpicto(($img ? $img.' ' : '').$this->object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||
$this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country;
|
||||
|
||||
$this->tpl['phone'] = dol_print_phone($this->object->phone, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
|
||||
$this->tpl['fax'] = dol_print_phone($this->object->fax, $this->object->country_code, 0, $this->object->id, 'AC_FAX');
|
||||
$this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
|
||||
$this->tpl['url'] = dol_print_url($this->object->url);
|
||||
|
||||
$this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
|
||||
$this->tpl['tva_assuj'] = yn($this->object->tva_assuj);
|
||||
|
||||
// Third party type
|
||||
$arr = $formcompany->typent_array(1);
|
||||
$this->tpl['typent'] = $arr[$this->object->typent_code];
|
||||
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
//$s=picto_from_langcode($this->default_lang);
|
||||
//print ($s?$s.' ':'');
|
||||
$langs->load("languages");
|
||||
$this->tpl['default_lang'] = ($this->default_lang?$langs->trans('Language_'.$this->object->default_lang):'');
|
||||
$this->tpl['default_lang'] = ($this->default_lang ? $langs->trans('Language_'.$this->object->default_lang) : '');
|
||||
}
|
||||
|
||||
$this->tpl['image_edit'] = img_edit();
|
||||
$this->tpl['image_edit'] = img_edit();
|
||||
|
||||
$this->tpl['display_rib'] = $this->object->display_rib();
|
||||
$this->tpl['display_rib'] = $this->object->display_rib();
|
||||
|
||||
// Sales representatives
|
||||
$this->tpl['sales_representatives'] = '';
|
||||
$listsalesrepresentatives=$this->object->getSalesRepresentatives($user);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
$listsalesrepresentatives = $this->object->getSalesRepresentatives($user);
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
$this->tpl['sales_representatives'].= $nbofsalesrepresentative;
|
||||
$this->tpl['sales_representatives'] .= $nbofsalesrepresentative;
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
$userstatic=new User($this->db);
|
||||
$i=0;
|
||||
foreach($listsalesrepresentatives as $val)
|
||||
$userstatic = new User($this->db);
|
||||
$i = 0;
|
||||
foreach ($listsalesrepresentatives as $val)
|
||||
{
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->lastname=$val['name'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
$this->tpl['sales_representatives'].= $userstatic->getNomUrl(1);
|
||||
$userstatic->id = $val['id'];
|
||||
$userstatic->lastname = $val['name'];
|
||||
$userstatic->firstname = $val['firstname'];
|
||||
$this->tpl['sales_representatives'] .= $userstatic->getNomUrl(1);
|
||||
$i++;
|
||||
if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'].= ', ';
|
||||
if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'] .= ', ';
|
||||
}
|
||||
}
|
||||
else $this->tpl['sales_representatives'].= $langs->trans("NoSalesRepresentativeAffected");
|
||||
else $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected");
|
||||
|
||||
// Linked member
|
||||
if (! empty($conf->adherent->enabled))
|
||||
if (!empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$adh=new Adherent($this->db);
|
||||
$result=$adh->fetch('', '', $this->object->id);
|
||||
$adh = new Adherent($this->db);
|
||||
$result = $adh->fetch('', '', $this->object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
$this->tpl['linked_member'] = $adh->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
@ -343,26 +343,26 @@ abstract class ActionsCardCommon
|
||||
|
||||
// Local Tax
|
||||
// TODO mettre dans une classe propre au pays
|
||||
if($mysoc->country_code=='ES')
|
||||
if ($mysoc->country_code == 'ES')
|
||||
{
|
||||
$this->tpl['localtax'] = '';
|
||||
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
|
||||
$this->tpl['localtax'].= '<td>'.yn($this->object->localtax1_assuj).'</td>';
|
||||
$this->tpl['localtax'].= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
|
||||
$this->tpl['localtax'].= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
|
||||
$this->tpl['localtax'] .= '<td>'.yn($this->object->localtax1_assuj).'</td>';
|
||||
$this->tpl['localtax'] .= '<td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
|
||||
$this->tpl['localtax'] .= '<td>'.yn($this->object->localtax2_assuj).'</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
elseif ($mysoc->localtax1_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
|
||||
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td>';
|
||||
$this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax1_assuj).'</td></tr>';
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
elseif ($mysoc->localtax2_assuj == "1")
|
||||
{
|
||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
|
||||
$this->tpl['localtax'].= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>';
|
||||
$this->tpl['localtax'] .= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td>';
|
||||
$this->tpl['localtax'] .= '<td colspan="3">'.yn($this->object->localtax2_assuj).'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -380,47 +380,47 @@ abstract class ActionsCardCommon
|
||||
// phpcs:enable
|
||||
global $langs, $mysoc;
|
||||
|
||||
$this->object->id = $_POST["socid"];
|
||||
$this->object->name = $_POST["nom"];
|
||||
$this->object->prefix_comm = $_POST["prefix_comm"];
|
||||
$this->object->client = $_POST["client"];
|
||||
$this->object->code_client = $_POST["code_client"];
|
||||
$this->object->fournisseur = $_POST["fournisseur"];
|
||||
$this->object->code_fournisseur = $_POST["code_fournisseur"];
|
||||
$this->object->address = $_POST["adresse"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$this->object->state_id = $_POST["state_id"];
|
||||
$this->object->phone = $_POST["tel"];
|
||||
$this->object->fax = $_POST["fax"];
|
||||
$this->object->email = $_POST["email"];
|
||||
$this->object->url = $_POST["url"];
|
||||
$this->object->capital = $_POST["capital"];
|
||||
$this->object->idprof1 = $_POST["idprof1"];
|
||||
$this->object->idprof2 = $_POST["idprof2"];
|
||||
$this->object->idprof3 = $_POST["idprof3"];
|
||||
$this->object->idprof4 = $_POST["idprof4"];
|
||||
$this->object->typent_id = $_POST["typent_id"];
|
||||
$this->object->effectif_id = $_POST["effectif_id"];
|
||||
$this->object->barcode = $_POST["barcode"];
|
||||
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||
$this->object->default_lang = $_POST["default_lang"];
|
||||
$this->object->commercial_id = $_POST["commercial_id"];
|
||||
$this->object->id = $_POST["socid"];
|
||||
$this->object->name = $_POST["nom"];
|
||||
$this->object->prefix_comm = $_POST["prefix_comm"];
|
||||
$this->object->client = $_POST["client"];
|
||||
$this->object->code_client = $_POST["code_client"];
|
||||
$this->object->fournisseur = $_POST["fournisseur"];
|
||||
$this->object->code_fournisseur = $_POST["code_fournisseur"];
|
||||
$this->object->address = $_POST["adresse"];
|
||||
$this->object->zip = $_POST["zipcode"];
|
||||
$this->object->town = $_POST["town"];
|
||||
$this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
|
||||
$this->object->state_id = $_POST["state_id"];
|
||||
$this->object->phone = $_POST["tel"];
|
||||
$this->object->fax = $_POST["fax"];
|
||||
$this->object->email = $_POST["email"];
|
||||
$this->object->url = $_POST["url"];
|
||||
$this->object->capital = $_POST["capital"];
|
||||
$this->object->idprof1 = $_POST["idprof1"];
|
||||
$this->object->idprof2 = $_POST["idprof2"];
|
||||
$this->object->idprof3 = $_POST["idprof3"];
|
||||
$this->object->idprof4 = $_POST["idprof4"];
|
||||
$this->object->typent_id = $_POST["typent_id"];
|
||||
$this->object->effectif_id = $_POST["effectif_id"];
|
||||
$this->object->barcode = $_POST["barcode"];
|
||||
$this->object->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||
$this->object->default_lang = $_POST["default_lang"];
|
||||
$this->object->commercial_id = $_POST["commercial_id"];
|
||||
|
||||
$this->object->tva_assuj = $_POST["assujtva_value"]?$_POST["assujtva_value"]:1;
|
||||
$this->object->tva_intra = $_POST["tva_intra"];
|
||||
$this->object->tva_assuj = $_POST["assujtva_value"] ? $_POST["assujtva_value"] : 1;
|
||||
$this->object->tva_intra = $_POST["tva_intra"];
|
||||
|
||||
//Local Taxes
|
||||
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
||||
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
||||
$this->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
||||
$this->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
||||
|
||||
// We set country_id, and country_code label of the chosen country
|
||||
if ($this->object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($this->object->country_id, 'all', $this->db, $langs, 0);
|
||||
$this->object->country_code = $tmparray['code'];
|
||||
$this->object->country_label= $tmparray['label'];
|
||||
$tmparray = getCountry($this->object->country_id, 'all', $this->db, $langs, 0);
|
||||
$this->object->country_code = $tmparray['code'];
|
||||
$this->object->country_label = $tmparray['label'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ class Societe extends CommonObject
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'parent' =>array('type'=>'integer', 'label'=>'Parent', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
@ -134,7 +134,7 @@ class Societe extends CommonObject
|
||||
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>45),
|
||||
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
|
||||
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
|
||||
'code_client' =>array('type'=>'varchar(24)', 'label'=>'Code client', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'code_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'Code fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'Code compta', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
@ -877,7 +877,7 @@ class Societe extends CommonObject
|
||||
$contact->firstname = $this->firstname;
|
||||
$contact->civility_id = $this->civility_id;
|
||||
$contact->socid = $this->id; // fk_soc
|
||||
$contact->statut = 1; // deprecated
|
||||
$contact->statut = 1; // deprecated
|
||||
$contact->status = 1;
|
||||
$contact->priv = 0;
|
||||
$contact->country_id = $this->country_id;
|
||||
@ -2111,7 +2111,7 @@ class Societe extends CommonObject
|
||||
$reparray[$i]['email'] = $obj->email;
|
||||
$reparray[$i]['phone'] = $obj->office_phone;
|
||||
$reparray[$i]['job'] = $obj->job;
|
||||
$reparray[$i]['statut'] = $obj->status; // deprecated
|
||||
$reparray[$i]['statut'] = $obj->status; // deprecated
|
||||
$reparray[$i]['status'] = $obj->status;
|
||||
$reparray[$i]['entity'] = $obj->entity;
|
||||
$reparray[$i]['login'] = $obj->login;
|
||||
|
||||
@ -307,7 +307,7 @@ if ($search_author) $sql .= natural_search('u.login', $search_author);
|
||||
if ($search_montant_ht) $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("sp.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("sp.total", $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -719,121 +719,121 @@ if ($resql)
|
||||
}
|
||||
// Other picto tool
|
||||
print '<td width="16" class="right nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
$companystatic->id = $obj->socid;
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->client = $obj->client;
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
|
||||
// Thirdparty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">';
|
||||
print $companystatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
if (!empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
if (!empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
if (!empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
$tmparray=getCountry($obj->fk_pays, 'all');
|
||||
$tmparray = getCountry($obj->fk_pays, 'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type ent
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
if (!empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date proposal
|
||||
if (! empty($arrayfields['sp.date_valid']['checked']))
|
||||
if (!empty($arrayfields['sp.date_valid']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_valid), 'day');
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date delivery
|
||||
if (! empty($arrayfields['sp.date_livraison']['checked']))
|
||||
if (!empty($arrayfields['sp.date_livraison']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->dp), 'day');
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['sp.total_ht']['checked']))
|
||||
if (!empty($arrayfields['sp.total_ht']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ht';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht';
|
||||
$totalarray['val']['sp.total_ht'] += $obj->total_ht;
|
||||
}
|
||||
// Amount VAT
|
||||
if (! empty($arrayfields['sp.total_vat']['checked']))
|
||||
if (!empty($arrayfields['sp.total_vat']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_vat)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_vat';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_vat';
|
||||
$totalarray['val']['sp.total_vat'] += $obj->total_vat;
|
||||
}
|
||||
// Amount TTC
|
||||
if (! empty($arrayfields['sp.total_ttc']['checked']))
|
||||
if (!empty($arrayfields['sp.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ttc';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc';
|
||||
$totalarray['val']['sp.total_ttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
// Currency
|
||||
if (!empty($arrayfields['sp.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -841,7 +841,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['sp.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -864,58 +864,58 @@ if ($resql)
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->id = $obj->fk_user_author;
|
||||
$userstatic->login = $obj->login;
|
||||
|
||||
// Author
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
if (!empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||
else print ' ';
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['sp.datec']['checked']))
|
||||
if (!empty($arrayfields['sp.datec']['checked']))
|
||||
{
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['sp.tms']['checked']))
|
||||
if (!empty($arrayfields['sp.tms']['checked']))
|
||||
{
|
||||
print '<td class="center nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['sp.fk_statut']['checked']))
|
||||
if (!empty($arrayfields['sp.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="right">'.$objectstatic->LibStatut($obj->fk_statut, 5)."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))]=preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
|
||||
$array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,9 +213,9 @@ if (!empty($conf->stock->enabled))
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('CashDeskForceDecreaseStockLabel') . '</td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('CashDeskForceDecreaseStockLabel').'</td>';
|
||||
print '<td>';
|
||||
print '<span class="opacitymedium">' . $langs->trans('CashDeskForceDecreaseStockDesc') . '</span>';
|
||||
print '<span class="opacitymedium">'.$langs->trans('CashDeskForceDecreaseStockDesc').'</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -248,13 +248,13 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>' . $langs->trans('CashDeskReaderKeyCodeForEnter') . '</td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('CashDeskReaderKeyCodeForEnter').'</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" name="' . 'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse . '" value="' . $conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse} . '" />';
|
||||
print '<input type="text" name="'.'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse.'" value="'.$conf->global->{'CASHDESK_READER_KEYCODE_FOR_ENTER'.$terminaltouse}.'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
// Numbering module
|
||||
if ($conf->global->TAKEPOS_ADDON=="terminal"){
|
||||
if ($conf->global->TAKEPOS_ADDON == "terminal") {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BillsNumberingModule");
|
||||
print '<td colspan="2">';
|
||||
@ -298,7 +298,7 @@ if ($conf->global->TAKEPOS_ADDON=="terminal"){
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
$array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))]=preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
|
||||
$array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,10 +168,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
$invoice->update($user);
|
||||
}
|
||||
|
||||
$sav_FACTURE_ADDON='';
|
||||
if (! empty($conf->global->TAKEPOS_ADDON)) {
|
||||
$sav_FACTURE_ADDON = '';
|
||||
if (!empty($conf->global->TAKEPOS_ADDON)) {
|
||||
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
|
||||
if ($conf->global->TAKEPOS_ADDON=="terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]};
|
||||
if ($conf->global->TAKEPOS_ADDON == "terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]};
|
||||
else $conf->global->FACTURE_ADDON = $conf->global->TAKEPOS_ADDON;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
|
||||
$batch_rule = 0;
|
||||
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/productbatch.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
|
||||
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
|
||||
}
|
||||
$res = $invoice->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule);
|
||||
@ -211,7 +211,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
}
|
||||
|
||||
// Restore save values
|
||||
if (! empty($sav_FACTURE_ADDON))
|
||||
if (!empty($sav_FACTURE_ADDON))
|
||||
{
|
||||
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
|
||||
}
|
||||
@ -227,7 +227,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
|
||||
// If user has not used change control, add total invoice payment
|
||||
// Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay
|
||||
if ($amountofpayment == 0 || $amountofpayment>$remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
|
||||
if ($amountofpayment == 0 || $amountofpayment > $remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
|
||||
|
||||
$payment->paiementid = $paiementid;
|
||||
$payment->num_payment = $invoice->ref;
|
||||
@ -302,7 +302,7 @@ if ($action == "addline")
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
|
||||
|
||||
if (! empty($conf->global->TAKEPOS_SUPPLEMENTS))
|
||||
if (!empty($conf->global->TAKEPOS_SUPPLEMENTS))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$cat = new Categorie($db);
|
||||
@ -313,8 +313,8 @@ if ($action == "addline")
|
||||
$sql = "SELECT fk_parent_line FROM ".MAIN_DB_PREFIX."facturedet where rowid=$selectedline";
|
||||
$resql = $db->query($sql);
|
||||
$row = $db->fetch_array($resql);
|
||||
if ($row[0]==null) $parent_line=$selectedline;
|
||||
else $parent_line=$row[0]; //If the parent line is already a supplement, add the supplement to the main product
|
||||
if ($row[0] == null) $parent_line = $selectedline;
|
||||
else $parent_line = $row[0]; //If the parent line is already a supplement, add the supplement to the main product
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ if ($action == "updatereduction")
|
||||
if ($action == "order" and $placeid != 0)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||
$printer = new dolReceiptPrinter($db);
|
||||
}
|
||||
@ -495,7 +495,7 @@ if ($action == "order" and $placeid != 0)
|
||||
$order_receipt_printer1 .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
$invoice->fetch($placeid); //Reload object before send to printer
|
||||
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1
|
||||
}
|
||||
@ -520,7 +520,7 @@ if ($action == "order" and $placeid != 0)
|
||||
$order_receipt_printer2 .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
$invoice->fetch($placeid); //Reload object before send to printer
|
||||
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2
|
||||
}
|
||||
@ -546,9 +546,9 @@ if ($action == "valid" || $action == "history")
|
||||
else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated');
|
||||
}
|
||||
$sectionwithinvoicelink .= '</span>';
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
|
||||
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
} elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
|
||||
} elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
} else {
|
||||
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
@ -800,13 +800,13 @@ if ($placeid > 0)
|
||||
$tmplines = array_reverse($invoice->lines);
|
||||
foreach ($tmplines as $line)
|
||||
{
|
||||
if ($line->fk_parent_line!=false)
|
||||
if ($line->fk_parent_line != false)
|
||||
{
|
||||
$htmlsupplements[$line->fk_parent_line].='<tr class="drag drop oddeven posinvoiceline';
|
||||
if ($line->special_code == "4") $htmlsupplements[$line->fk_parent_line].=' order';
|
||||
$htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">';
|
||||
$htmlsupplements[$line->fk_parent_line].= '<td class="left">';
|
||||
$htmlsupplements[$line->fk_parent_line].= img_picto('', 'rightarrow');
|
||||
$htmlsupplements[$line->fk_parent_line] .= '<tr class="drag drop oddeven posinvoiceline';
|
||||
if ($line->special_code == "4") $htmlsupplements[$line->fk_parent_line] .= ' order';
|
||||
$htmlsupplements[$line->fk_parent_line] .= '" id="'.$line->id.'">';
|
||||
$htmlsupplements[$line->fk_parent_line] .= '<td class="left">';
|
||||
$htmlsupplements[$line->fk_parent_line] .= img_picto('', 'rightarrow');
|
||||
if ($line->product_label) $htmlsupplements[$line->fk_parent_line] .= $line->product_label;
|
||||
if ($line->product_label && $line->desc) $htmlsupplements[$line->fk_parent_line] .= '<br>';
|
||||
if ($line->product_label != $line->desc)
|
||||
|
||||
@ -251,9 +251,9 @@ $action_buttons = array(
|
||||
);
|
||||
$numpad = $conf->global->TAKEPOS_NUMPAD;
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '7' : '10').');">' . ($numpad == 0 ? '7' : '10') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '8' : '20').');">' . ($numpad == 0 ? '8' : '20') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '9' : '50').');">' . ($numpad == 0 ? '9' : '50') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '7' : '10').');">'.($numpad == 0 ? '7' : '10').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '8' : '20').');">'.($numpad == 0 ? '8' : '20').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '9' : '50').');">'.($numpad == 0 ? '9' : '50').'</button>';
|
||||
?>
|
||||
<?php if (count($paiements) > 0) {
|
||||
$paycode = $paiements[0]->code;
|
||||
@ -269,14 +269,14 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">' . (!empty($payIcon) ? '<span class="fa fa-2x fa-' . $payIcon . '"></span>' : $langs->trans("PaymentTypeShort".$paiements[0]->code)) . '</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[0]->code)).'</button>';
|
||||
} else {
|
||||
print '<button type="button" class="calcbutton2">' . $langs->trans("NoPaimementModesDefined") . '</button>';
|
||||
print '<button type="button" class="calcbutton2">'.$langs->trans("NoPaimementModesDefined").'</button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '4' : '1').');">' . ($numpad == 0 ? '4' : '1') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '5' : '2').');">' . ($numpad == 0 ? '5' : '2') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '6' : '5').');">' . ($numpad == 0 ? '6' : '5') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '4' : '1').');">'.($numpad == 0 ? '4' : '1').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '5' : '2').');">'.($numpad == 0 ? '5' : '2').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '6' : '5').');">'.($numpad == 0 ? '6' : '5').'</button>';
|
||||
?>
|
||||
<?php if (count($paiements) > 1) {
|
||||
$paycode = $paiements[1]->code;
|
||||
@ -292,15 +292,15 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'. (!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[1]->code)) . '</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[1]->code)).'</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
print '<button type="button" class="calcbutton2" onclick="' . $button["function"] . '"><span ' . $button["span"] . '>' . $button["text"] . '</span></button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '1' : '0.10').');">' . ($numpad == 0 ? '1' : '0.10') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '2' : '0.20').');">' . ($numpad == 0 ? '2' : '0.20') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '3' : '0.50').');">' . ($numpad == 0 ? '3' : '0.50') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '1' : '0.10').');">'.($numpad == 0 ? '1' : '0.10').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '2' : '0.20').');">'.($numpad == 0 ? '2' : '0.20').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '3' : '0.50').');">'.($numpad == 0 ? '3' : '0.50').'</button>';
|
||||
?>
|
||||
<?php if (count($paiements) > 2) {
|
||||
$paycode = $paiements[2]->code;
|
||||
@ -316,19 +316,19 @@ print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad
|
||||
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">' . (!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[2]->code)) . '</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paycode).'\');">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-'.$payIcon.'"></span>' : $langs->trans("PaymentTypeShort".$paiements[2]->code)).'</button>';
|
||||
} else {
|
||||
$button = array_pop($action_buttons);
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>' . $button["text"] . '</span></button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="'.$button["function"].'"><span '.$button["span"].'>'.$button["text"].'</span></button>';
|
||||
}
|
||||
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '0' : '0.01').');">' . ($numpad == 0 ? '0' : '0.01') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'000\'' : '0.02').');">' . ($numpad == 0 ? '000' : '0.02') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'.\'' : '0.05').');">' . ($numpad == 0 ? '.' : '0.05') . '</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '0' : '0.01').');">'.($numpad == 0 ? '0' : '0.01').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'000\'' : '0.02').');">'.($numpad == 0 ? '000' : '0.02').'</button>';
|
||||
print '<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ? '\'.\'' : '0.05').');">'.($numpad == 0 ? '.' : '0.05').'</button>';
|
||||
|
||||
$i = 3;
|
||||
while ($i < count($paiements)) {
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paiements[$i]->code).'\');">' . $langs->trans("PaymentTypeShort".$paiements[$i]->code) . '</button>';
|
||||
print '<button type="button" class="calcbutton2" onclick="Validate(\''.$langs->trans($paiements[$i]->code).'\');">'.$langs->trans("PaymentTypeShort".$paiements[$i]->code).'</button>';
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
|
||||
@ -187,7 +187,7 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk'));
|
||||
<div style="position:absolute; top:2%; left:5%; width:91%;">
|
||||
<center>
|
||||
<?php
|
||||
print '<input type="text" class="takepospay" id="reduction_total" name="reduction_total" style="width: 50%;" placeholder="' . $langs->trans('Reduction') . '">';
|
||||
print '<input type="text" class="takepospay" id="reduction_total" name="reduction_total" style="width: 50%;" placeholder="'.$langs->trans('Reduction').'">';
|
||||
?>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
@ -481,7 +481,7 @@ function Search2(keyCodeForEnter) {
|
||||
$("#prodiv" + i).data("rowid", "");
|
||||
continue;
|
||||
}
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref') . ': '); ?>' + data[i]['ref'];
|
||||
var titlestring = '<?php echo dol_escape_js($langs->transnoentities('Ref').': '); ?>' + data[i]['ref'];
|
||||
$("#prodesc" + i).text(data[i]['label']);
|
||||
$("#prodivdesc" + i).show();
|
||||
$("#proimg" + i).attr("title", titlestring);
|
||||
@ -808,7 +808,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
//add temp ticket button
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
{
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'TakeposPrinting(placeid);');
|
||||
} else {
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>', 'action'=>'Print(placeid);');
|
||||
@ -824,7 +824,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
|
||||
$menus[$r++] = array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
|
||||
}
|
||||
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
|
||||
@ -24,12 +24,12 @@
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = __DIR__ . '/';
|
||||
$path = __DIR__.'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
|
||||
exit(- 1);
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@set_time_limit(0); // No timeout for this script
|
||||
@ -37,18 +37,18 @@ define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (empty($argv[3]) || ! in_array($argv[1], array('test','confirm'))) {
|
||||
if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm'))) {
|
||||
print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla\n";
|
||||
print "\n";
|
||||
print "Load joomla news and create them into Dolibarr database (if they don't alreay exist).\n";
|
||||
exit(- 1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$mode = $argv[1];
|
||||
$website = $argv[2];
|
||||
$joomlaserverinfo = $argv[3];
|
||||
|
||||
require $path . "../../htdocs/master.inc.php";
|
||||
require $path."../../htdocs/master.inc.php";
|
||||
|
||||
$langs->load('main');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user