Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
37ea95eb3a
@ -32,7 +32,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
||||
|
||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||
|
||||
- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_DoliWamp)
|
||||
- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp))
|
||||
- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian)
|
||||
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
|
||||
|
||||
|
||||
@ -81,22 +81,22 @@ $list_account[] = '---Others---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
|
||||
if ($conf->banque->enabled) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
|
||||
}
|
||||
if ($conf->don->enabled) {
|
||||
if (!empty($conf->don->enabled)) {
|
||||
$list_account[] = 'DONATION_ACCOUNTINGACCOUNT';
|
||||
}
|
||||
if ($conf->adherent->enabled) {
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
$list_account[] = 'ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT';
|
||||
}
|
||||
if ($conf->loan->enabled) {
|
||||
if (!empty($conf->loan->enabled)) {
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_CAPITAL';
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INTEREST';
|
||||
$list_account[] = 'LOAN_ACCOUNTING_ACCOUNT_INSURANCE';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_SUSPENSE';
|
||||
if ($conf->societe->enabled) {
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$list_account[] = '---Deposits---';
|
||||
$list_account[] = 'ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT';
|
||||
}
|
||||
@ -246,7 +246,7 @@ foreach ($list_account as $key) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->societe->enabled) {
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . img_picto('', 'bill', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnCustomerDeposit") . '</td>';
|
||||
if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_USE_AUXILIARY_ON_DEPOSIT)) {
|
||||
|
||||
@ -108,7 +108,7 @@ if ($action == 'set_default') {
|
||||
$res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
@ -256,7 +256,7 @@ print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VATToUseForSubscriptions").'</td>';
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
@ -63,6 +63,7 @@ $search_email = GETPOST("search_email", 'alpha');
|
||||
$search_categ = GETPOST("search_categ", 'int');
|
||||
$search_filter = GETPOST("search_filter", 'alpha');
|
||||
$search_status = GETPOST("search_status", 'intcomma');
|
||||
$search_import_key = trim(GETPOST("search_import_key", "alpha"));
|
||||
$catid = GETPOST("catid", 'int');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
@ -156,7 +157,8 @@ $arrayfields = array(
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.birth'=>array('label'=>$langs->trans("Birthday"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||
'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'd.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
|
||||
);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
@ -213,6 +215,7 @@ if (empty($reshook)) {
|
||||
$search_categ = "";
|
||||
$search_filter = "";
|
||||
$search_status = "";
|
||||
$search_import_key = '';
|
||||
$catid = "";
|
||||
$sall = "";
|
||||
$toselect = array();
|
||||
@ -318,7 +321,7 @@ $sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe
|
||||
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
|
||||
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
|
||||
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
|
||||
$sql .= " d.note_private, d.note_public,";
|
||||
$sql .= " d.note_private, d.note_public, d.import_key,";
|
||||
$sql .= " s.nom,";
|
||||
$sql .= " ".$db->ifsql("d.societe IS NULL", "s.nom", "d.societe")." as companyname,";
|
||||
$sql .= " t.libelle as type, t.subscription,";
|
||||
@ -427,6 +430,9 @@ if ($search_phone_mobile) {
|
||||
if ($search_country) {
|
||||
$sql .= " AND d.country IN (".$db->sanitize($search_country).')';
|
||||
}
|
||||
if ($search_import_key) {
|
||||
$sql .= natural_search("d.import_key", $search_import_key);
|
||||
}
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
@ -436,8 +442,6 @@ $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);
|
||||
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
@ -447,15 +451,20 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
// Add limit
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("get list", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
@ -464,6 +473,7 @@ if (!$resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
|
||||
@ -473,7 +483,8 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
exit;
|
||||
}
|
||||
|
||||
llxHeader('', $title, 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (GETPOSTISSET("search_status")) {
|
||||
if ($search_status == '-1,1') { // TODO : check this test as -1 == Adherent::STATUS_DRAFT and -2 == Adherent::STATUS_EXLCUDED
|
||||
@ -577,6 +588,9 @@ if ($search_filter && $search_filter != '-1') {
|
||||
if ($search_status != "" && $search_status != -3) {
|
||||
$param .= "&search_status=".urlencode($search_status);
|
||||
}
|
||||
if ($search_import_key != '') {
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
if ($search_type > 0) {
|
||||
$param .= "&search_type=".urlencode($search_type);
|
||||
}
|
||||
@ -603,7 +617,7 @@ if ($user->rights->societe->creer) {
|
||||
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
|
||||
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
@ -669,7 +683,6 @@ if ($massactionbutton) {
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Line for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
@ -807,15 +820,24 @@ if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -3);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
// Action column
|
||||
print '<td class="liste_titre middle">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
|
||||
}
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
@ -895,7 +917,12 @@ if (!empty($arrayfields['d.tms']['checked'])) {
|
||||
if (!empty($arrayfields['d.statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['d.import_key']['label'], $_SERVER["PHP_SELF"], "d.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$i = 0;
|
||||
@ -936,7 +963,7 @@ while ($i < min($num, $limit)) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
|
||||
print '<td class="center">'.$obj->rowid.'</td>';
|
||||
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -1172,21 +1199,31 @@ while ($i < min($num, $limit)) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Action column
|
||||
print '<td class="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;
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
|
||||
print dol_escape_htmltag($obj->import_key);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
// Action column
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="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"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@ -53,8 +53,6 @@ $type = 'bankaccount';
|
||||
// Order display of bank account
|
||||
if ($action == 'setbankorder') {
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -63,15 +61,11 @@ if ($action == 'setbankorder') {
|
||||
// Auto report last num releve on conciliate
|
||||
if ($action == 'setreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'unsetreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -80,15 +74,11 @@ if ($action == 'setreportlastnumreleve') {
|
||||
// Colorize movements
|
||||
if ($action == 'setbankcolorizemovement') {
|
||||
if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 1, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif ($action == 'unsetbankcolorizemovement') {
|
||||
if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 0, 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -427,13 +417,13 @@ print "</td>";
|
||||
// Active
|
||||
if ($conf->global->BANK_COLORIZE_MOVEMENT) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement&token='.newToken().'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -483,13 +473,13 @@ print '</td>';
|
||||
// Active
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve&token='.newToken().'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve&token='.newToken().'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
||||
@ -1490,11 +1490,13 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
$tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
|
||||
|
||||
$tdsoffields .= '<th'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
$tdsoffields .= '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
$tdsoffields .= $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
|
||||
$tdsoffields .= '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif ($tooltiphelp) {
|
||||
$tdsoffields .= $form->textwithpicto($valuetoshow, $tooltiphelp);
|
||||
} else {
|
||||
$tdsoffields .= $valuetoshow;
|
||||
}
|
||||
@ -1643,8 +1645,8 @@ if ($id > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabhelp[$id][$value])) {
|
||||
$tabhelp[$id][$value] = $langs->trans('LabelUsedByDefault');
|
||||
if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabcomplete[$tabname[$id]]['help'][$value])) {
|
||||
$tabcomplete[$tabname[$id]]['help'][$value] = $langs->trans('LabelUsedByDefault');
|
||||
}
|
||||
|
||||
// Determines the name of the field in relation to the possible names
|
||||
@ -1850,10 +1852,12 @@ if ($id > 0) {
|
||||
|
||||
// Show field title
|
||||
if ($showfield) {
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
$newvaluetoshow = '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
$newvaluetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
$tooltiphelp = (isset($tabcomplete[$tabname[$id]]['help'][$value]) ? $tabcomplete[$tabname[$id]]['help'][$value] : '');
|
||||
|
||||
if ($tooltiphelp && preg_match('/^http(s*):/i', $tooltiphelp)) {
|
||||
$newvaluetoshow = '<a href="'.$tooltiphelp.'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif ($tooltiphelp) {
|
||||
$newvaluetoshow = $form->textwithpicto($valuetoshow, $tooltiphelp);
|
||||
} else {
|
||||
$newvaluetoshow = $valuetoshow;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -592,15 +593,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
'recordjoinpiece'=>'AttachJoinedDocumentsToObject',
|
||||
'recordevent'=>'RecordEvent');
|
||||
$arrayoftypesnocondition = $arrayoftypes;
|
||||
if ($conf->projet->enabled) {
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
|
||||
}
|
||||
$arrayoftypesnocondition['project'] = 'CreateLeadAndThirdParty';
|
||||
if ($conf->ticket->enabled) {
|
||||
if (!empty($conf->ticket->enabled)) {
|
||||
$arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
|
||||
}
|
||||
$arrayoftypesnocondition['ticket'] = 'CreateTicketAndThirdParty';
|
||||
if ($conf->recruitment->enabled) {
|
||||
if (!empty($conf->recruitment->enabled)) {
|
||||
$arrayoftypes['candidature'] = 'CreateCandidature';
|
||||
}
|
||||
$arrayoftypesnocondition['candidature'] = 'CreateCandidature';
|
||||
|
||||
@ -528,8 +528,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
|
||||
@ -394,7 +394,7 @@ print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
// Option to force stock to be enough before adding a line into document
|
||||
if ($conf->invoice->enabled) {
|
||||
if (!empty($conf->invoice->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td class="right">';
|
||||
@ -408,7 +408,7 @@ if ($conf->invoice->enabled) {
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($conf->order->enabled) {
|
||||
if (!empty($conf->order->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td class="right">';
|
||||
@ -422,7 +422,7 @@ if ($conf->order->enabled) {
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($conf->expedition->enabled) {
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td class="right">';
|
||||
|
||||
484
htdocs/admin/stocktransfer.php
Normal file
484
htdocs/admin/stocktransfer.php
Normal file
@ -0,0 +1,484 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2021 SuperAdmin
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer/admin/setup.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief StockTransfer setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
global $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer.lib.php';
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "stocks"));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
|
||||
$arrayofparameters = array(
|
||||
'STOCKTRANSFER_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'STOCKTRANSFER_MYPARAM2'=>array('css'=>'minwidth500', 'enabled'=>1)
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ((float) DOL_VERSION >= 6) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
}
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
|
||||
$maskstocktransfer = GETPOST('maskStockTransfer', 'alpha');
|
||||
|
||||
if ($maskconststocktransfer) $res = dolibarr_set_const($db, $maskconststocktransfer, $maskstocktransfer, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
$tmpobjectkey = 'StockTransfer';
|
||||
|
||||
$tmpobject = new $tmpobjectkey($db);
|
||||
$tmpobject->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/stocktransfer/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($tmpobject, $langs) > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
return;
|
||||
} else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
} elseif ($action == 'set') { // Activate a model
|
||||
$ret = addDocumentModel($value, 'stocktransfer', $label, $scandir);
|
||||
} elseif ($action == 'del') {
|
||||
$tmpobjectkey = 'StockTransfer';
|
||||
|
||||
$ret = delDocumentModel($value, 'stocktransfer');
|
||||
if ($ret > 0) {
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'setdoc') { // Set default model
|
||||
$tmpobjectkey = 'StockTransfer';
|
||||
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, 'stocktransfer');
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, 'stocktransfer', $label, $scandir);
|
||||
}
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated
|
||||
// by calling method canBeActivated
|
||||
$tmpobjectkey = 'StockTransfer';
|
||||
$constforval = 'STOCKTRANSFER_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$page_name = "StockTransferSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'stock');
|
||||
|
||||
// Configuration header
|
||||
$head = stocktransferAdminPrepareHead();
|
||||
dol_fiche_head($head, 'settings', '', -1, "stocktransfer@stocktransfer");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">'.$langs->trans("StockTransferSetupPage").'</span>';
|
||||
|
||||
|
||||
/*if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
} else {
|
||||
if (!empty($arrayofparameters))
|
||||
{
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val)
|
||||
{
|
||||
$setupnotempty++;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td>'.$conf->global->$key.'</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
$moduledir = 'stocktransfer';
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects[$moduledir]=array('includerefgeneration'=>1, 'includedocgeneration'=>1);
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if ($myTmpObjectKey == 'MyObject') continue;
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
/*
|
||||
* Orders Numbering model
|
||||
*/
|
||||
$setupnotempty++;
|
||||
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&object='.strtolower($myTmpObjectKey).'&value='.$file.'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$mytmpinstance = new $myTmpObjectKey($db);
|
||||
$mytmpinstance->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
|
||||
$nextval = $module->getNextValue($mytmpinstance);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table><br>\n";
|
||||
}
|
||||
|
||||
if ($myTmpObjectArray['includedocgeneration']) {
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
$setupnotempty++;
|
||||
$type = strtolower($myTmpObjectKey);
|
||||
|
||||
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$realpath = $reldir."core/modules/".$moduledir.$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
if (file_exists($dir.'/'.$file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&object='.$myTmpObjectKey.'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf') {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td class="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'generic').'</a>';
|
||||
} else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($setupnotempty)) {
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
|
||||
// Page end
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -498,7 +498,7 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
if ($conf->banque->enabled) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td> </td><td class="right">';
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
|
||||
/* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017-2020 Laurent Destailleur <eldy@destailleur.fr>
|
||||
* Copyright (C) 2022 charlene benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -139,76 +140,53 @@ class BlockedLog
|
||||
|
||||
$this->trackedevents = array();
|
||||
|
||||
if ($conf->facture->enabled) {
|
||||
if (!empty($conf->facture->enabled)) {
|
||||
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
|
||||
}
|
||||
if ($conf->facture->enabled) {
|
||||
$this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
|
||||
}
|
||||
|
||||
/* Supplier
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
|
||||
if (!empty($conf->fournisseur->enabled)) {
|
||||
$this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
|
||||
$this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
|
||||
$this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
|
||||
$this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
|
||||
$this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
|
||||
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
|
||||
if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($conf->don->enabled) {
|
||||
if (!empty($conf->don->enabled)) {
|
||||
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
|
||||
}
|
||||
if ($conf->don->enabled) {
|
||||
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
|
||||
}
|
||||
//if ($conf->don->enabled) $this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
|
||||
|
||||
if ($conf->don->enabled) {
|
||||
//$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
|
||||
$this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
|
||||
}
|
||||
if ($conf->don->enabled) {
|
||||
$this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
|
||||
}
|
||||
|
||||
/*
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
|
||||
if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
|
||||
if (!empty($conf->salary->enabled)) {
|
||||
$this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
|
||||
$this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
|
||||
}
|
||||
*/
|
||||
|
||||
if ($conf->adherent->enabled) {
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
|
||||
}
|
||||
if ($conf->adherent->enabled) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
|
||||
}
|
||||
if ($conf->adherent->enabled) {
|
||||
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
|
||||
}
|
||||
if ($conf->banque->enabled) {
|
||||
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
|
||||
}
|
||||
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
|
||||
|
||||
@ -1301,6 +1301,7 @@ class BOMLine extends CommonObjectLine
|
||||
*/
|
||||
public $childBom = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -135,7 +135,7 @@ if (GETPOST('exportcsv', 'int')) {
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
|
||||
$sql .= " mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.fk_mailing=".((int) $object->id);
|
||||
$sql .= " WHERE mc.fk_mailing = ".((int) $object->id);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -365,17 +365,19 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
// Check if qualified
|
||||
$qualified = (is_null($obj->enabled) ? 1 : dol_eval($obj->enabled, 1));
|
||||
|
||||
// Check dependencies
|
||||
$qualified = (isset($obj->enabled) ? $obj->enabled : 1);
|
||||
foreach ($obj->require_module as $key) {
|
||||
if (!$conf->$key->enabled || (!$user->admin && $obj->require_admin)) {
|
||||
if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
|
||||
$qualified = 0;
|
||||
//print "Les prerequis d'activation du module mailing ne sont pas respectes. Il ne sera pas actif";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Si le module mailing est qualifie
|
||||
// If module is qualified
|
||||
if ($qualified) {
|
||||
$var = !$var;
|
||||
|
||||
@ -402,7 +404,7 @@ if ($object->fetch($id) >= 0) {
|
||||
}
|
||||
|
||||
print '<div class="tagtd center">';
|
||||
if ($nbofrecipient >= 0) {
|
||||
if ($nbofrecipient === '' || $nbofrecipient >= 0) {
|
||||
print $nbofrecipient;
|
||||
} else {
|
||||
print $langs->trans("Error").' '.img_error($obj->error);
|
||||
|
||||
@ -616,9 +616,18 @@ foreach ($accounts as $key => $type) {
|
||||
|
||||
// Transactions to reconcile
|
||||
if (!empty($arrayfields['toreconcile']['checked'])) {
|
||||
print '<td class="center tdoverflowmax125">';
|
||||
|
||||
$conciliate = $objecttmp->canBeConciliated();
|
||||
|
||||
$labeltoshow = '';
|
||||
if ($conciliate == -2) {
|
||||
$labeltoshow = $langs->trans("CashAccount");
|
||||
} elseif ($conciliate == -3) {
|
||||
$labeltoshow = $langs->trans("Closed");
|
||||
} elseif (empty($objecttmp->rappro)) {
|
||||
$labeltoshow = $langs->trans("ConciliationDisabled");
|
||||
}
|
||||
|
||||
print '<td class="center tdoverflowmax125"'.($labeltoshow ? ' title="'.dol_escape_htmltag($labeltoshow).'"' : '').'>';
|
||||
if ($conciliate == -2) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("CashAccount").'</span>';
|
||||
} elseif ($conciliate == -3) {
|
||||
|
||||
@ -153,16 +153,16 @@ print '</td></tr>';
|
||||
|
||||
if ($object->thirdparty->client) {
|
||||
$thirdTypeArray['customer'] = $langs->trans("customer");
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire) {
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
|
||||
}
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire) {
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
|
||||
}
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire) {
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
|
||||
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
|
||||
}
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire) {
|
||||
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
|
||||
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
|
||||
}
|
||||
}
|
||||
|
||||
478
htdocs/core/class/cgenericdic.class.php
Normal file
478
htdocs/core/class/cgenericdic.class.php
Normal file
@ -0,0 +1,478 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/cgenericdic.class.php
|
||||
* \ingroup resource
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class CGenericDic
|
||||
*
|
||||
* @see CommonObject
|
||||
*/
|
||||
class CGenericDic
|
||||
{
|
||||
/**
|
||||
* @var string Id to identify managed objects
|
||||
*/
|
||||
public $element = 'undefined'; // Will be defined into constructor
|
||||
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'undefined'; // Will be defined into constructor
|
||||
|
||||
/**
|
||||
* @var CtyperesourceLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* @var string Type resource label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
public $active;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
// Don't forget to set this->element and this->table_element after the construction
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$fieldlabel = 'label';
|
||||
if ($this->table_element == 'c_stcomm') {
|
||||
$fieldlabel = 'libelle';
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->label)) {
|
||||
$this->label = trim($this->label);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
|
||||
$sql .= 'code,';
|
||||
$sql .= $fieldlabel;
|
||||
$sql .= 'active';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' '.(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").',';
|
||||
$sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
|
||||
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active);
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
|
||||
|
||||
// Uncomment this and change CTYPERESOURCE to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
//if (!$notrigger) {
|
||||
|
||||
// // Call triggers
|
||||
// $result=$this->call_trigger('CTYPERESOURCE_CREATE',$user);
|
||||
// if ($result < 0) $error++;
|
||||
// // End call triggers
|
||||
//}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $code code
|
||||
* @param string $label Label
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $code = '', $label = '')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$fieldrowid = 'rowid';
|
||||
$fieldlabel = 'label';
|
||||
if ($this->table_element == 'c_stcomm') {
|
||||
$fieldrowid = 'id';
|
||||
$fieldlabel = 'libelle';
|
||||
}
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.".$fieldrowid.",";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.".$fieldlabel." as label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
if ($id) {
|
||||
$sql .= " WHERE t.".$fieldrowid." = ".((int) $id);
|
||||
} elseif ($code) {
|
||||
$sql .= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
} elseif ($label) {
|
||||
$sql .= " WHERE t.label = '".$this->db->escape($label)."'";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->$fieldrowid;
|
||||
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
// $this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$fieldrowid = 'rowid';
|
||||
$fieldlabel = 'label';
|
||||
if ($this->table_element == 'c_stcomm') {
|
||||
$fieldrowid = 'id';
|
||||
$fieldlabel = 'libelle';
|
||||
}
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " t.".$fieldrowid.",";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.".$fieldlabel." as label,";
|
||||
$sql .= " t.active";
|
||||
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= " WHERE ".implode(' '.$this->db->escape($filtermode).' ', $sqlwhere);
|
||||
}
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new self($this->db);
|
||||
|
||||
$line->id = $obj->$fieldrowid;
|
||||
|
||||
$line->code = $obj->code;
|
||||
$line->label = $obj->label;
|
||||
$line->active = $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$fieldrowid = 'rowid';
|
||||
$fieldlabel = 'label';
|
||||
if ($this->table_element == 'c_stcomm') {
|
||||
$fieldrowid = 'id';
|
||||
$fieldlabel = 'libelle';
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
if (isset($this->label)) {
|
||||
$this->label = trim($this->label);
|
||||
}
|
||||
if (isset($this->active)) {
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".$this->db->prefix().$this->table_element.' SET';
|
||||
$sql .= " code = ".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
|
||||
$sql .= " ".$fieldlabel." = ".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").',';
|
||||
$sql .= " active = ".(isset($this->active) ? $this->active : "null");
|
||||
$sql .= " WHERE ".$fieldrowid." = ".((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
// Uncomment this and change CTYPERESOURCE to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
//if (!$error && !$notrigger) {
|
||||
|
||||
// // Call triggers
|
||||
// $result=$this->call_trigger('CTYPERESOURCE_MODIFY',$user);
|
||||
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
// // End call triggers
|
||||
//}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$fieldrowid = 'rowid';
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Uncomment this and change CTYPERESOURCE to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
//if (!$error && !$notrigger) {
|
||||
|
||||
// // Call triggers
|
||||
// $result=$this->call_trigger('CTYPERESOURCE_DELETE',$user);
|
||||
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
// // End call triggers
|
||||
//}
|
||||
|
||||
// If you need to delete child tables to, you can insert them here
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
|
||||
$sql .= " WHERE ".$fieldrowid." = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param User $user User making the clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
$object = new Ctyperesource($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
// Reset object
|
||||
$object->id = 0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$object->context['createfromclone'] = 'createfromclone';
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors = $object->errors;
|
||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
return $object->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
$this->code = 'CODE';
|
||||
$this->label = 'Label';
|
||||
$this->active = 1;
|
||||
}
|
||||
}
|
||||
@ -7378,12 +7378,12 @@ abstract class CommonObject
|
||||
$checked = ' checked ';
|
||||
}
|
||||
$value = '<input type="checkbox" '.$checked.' '.($moreparam ? $moreparam : '').' readonly disabled>';
|
||||
} elseif ($type == 'mail') {
|
||||
} elseif ($type == 'mail' || $type == 'email') {
|
||||
$value = dol_print_email($value, 0, 0, 0, 64, 1, 1);
|
||||
} elseif ($type == 'url') {
|
||||
$value = dol_print_url($value, '_blank', 32, 1);
|
||||
} elseif ($type == 'phone') {
|
||||
$value = dol_print_phone($value, '', 0, 0, '', ' ', 1);
|
||||
$value = dol_print_phone($value, '', 0, 0, '', ' ', 'phone');
|
||||
} elseif ($type == 'price') {
|
||||
if (!is_null($value) && $value !== '') {
|
||||
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
|
||||
|
||||
@ -77,6 +77,9 @@ abstract class CommonObjectLine extends CommonObject
|
||||
public $multilangs;
|
||||
|
||||
public $product_type; // type in line
|
||||
public $fk_product; // product id in line (when line is linked to a product)
|
||||
|
||||
public $product; // To store full product object after a fetch_product() on a line
|
||||
public $product_ref; // ref in product table
|
||||
public $product_label; // label in product table
|
||||
public $product_desc; // desc in product table
|
||||
|
||||
@ -99,30 +99,22 @@ class Ctypent // extends CommonObject
|
||||
$this->module = trim($this->module);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".$this->db->prefix()."c_typent(";
|
||||
|
||||
$sql .= "id,";
|
||||
$sql .= "code,";
|
||||
$sql .= "libelle,";
|
||||
$sql .= "active,";
|
||||
$sql .= "module";
|
||||
|
||||
|
||||
$sql .= ") VALUES (";
|
||||
|
||||
$sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape($this->id)."'").",";
|
||||
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
|
||||
$sql .= " ".(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").",";
|
||||
$sql .= " ".(!isset($this->active) ? 'NULL' : "'".$this->db->escape($this->active)."'").",";
|
||||
$sql .= " ".(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'")."";
|
||||
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
@ -276,7 +268,7 @@ class Ctypent // extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."c_typent";
|
||||
$sql .= " WHERE id=".$this->id;
|
||||
$sql .= " WHERE id = ".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -26,8 +26,6 @@
|
||||
/**
|
||||
* Class Ctyperesource
|
||||
*
|
||||
* Put here description of your class
|
||||
*
|
||||
* @see CommonObject
|
||||
*/
|
||||
class Ctyperesource
|
||||
@ -93,26 +91,15 @@ class Ctyperesource
|
||||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'(';
|
||||
|
||||
$sql .= 'code,';
|
||||
$sql .= 'label';
|
||||
$sql .= 'active';
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
$sql .= ' '.(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").',';
|
||||
$sql .= ' '.(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").',';
|
||||
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active);
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
@ -177,7 +164,6 @@ class Ctyperesource
|
||||
$sql .= " WHERE t.label = '".$this->db->escape($label)."'";
|
||||
}
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
@ -308,12 +294,9 @@ class Ctyperesource
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET';
|
||||
|
||||
$sql .= ' code = '.(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").',';
|
||||
$sql .= ' label = '.(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").',';
|
||||
$sql .= ' active = '.(isset($this->active) ? $this->active : "null");
|
||||
|
||||
|
||||
$sql .= ' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -867,17 +867,17 @@ class Form
|
||||
/**
|
||||
* Return combo list of activated countries, into language of user
|
||||
*
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||
* @param int $hideflags Hide flags
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption More html options on select object
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int|string $showempty Show empty choice
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||
* @param int $hideflags Hide flags
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array(), $hideflags = 0)
|
||||
@ -926,7 +926,11 @@ class Form
|
||||
}
|
||||
|
||||
if ($showempty) {
|
||||
$out .= '<option value=""> </option>'."\n";
|
||||
if (is_numeric($showempty)) {
|
||||
$out .= '<option value=""> </option>'."\n";
|
||||
} else {
|
||||
$out .= '<option value="">'.$langs->trans($showempty).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($addspecialentries) { // Add dedicated entries for groups of countries
|
||||
|
||||
@ -346,7 +346,7 @@ class FormTicket
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->knowledgemanagement->enabled) {
|
||||
if (!empty($conf->knowledgemanagement->enabled)) {
|
||||
// KM Articles
|
||||
print '<tr id="KWwithajax"></tr>';
|
||||
print '<!-- Script to manage change of ticket group -->
|
||||
|
||||
@ -183,6 +183,21 @@ function isASecretKey($keyname)
|
||||
return preg_match('/(_pass|password|_pw|_key|securekey|serverkey|secret\d?|p12key|exportkey|_PW_[a-z]+|token)$/i', $keyname);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a numeric value into an Excel like column number. So 0 return 'A', 1 returns 'B'..., 26 return 'AA'
|
||||
*
|
||||
* @param int|string $n Numeric value
|
||||
* @return string Column in Excel format
|
||||
*/
|
||||
function num2Alpha($n)
|
||||
{
|
||||
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
|
||||
$r = chr($n % 26 + 0x41) . $r;
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return information about user browser
|
||||
*
|
||||
@ -3012,8 +3027,16 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
|
||||
}
|
||||
} else {
|
||||
if (!empty($dictsocialnetworks[$type]['url'])) {
|
||||
$tmpvirginurl = preg_replace('/\/?{socialid}/', '', $dictsocialnetworks[$type]['url']);
|
||||
if ($tmpvirginurl) {
|
||||
$value = preg_replace('/'.preg_quote($tmpvirginurl, '/').'\/?/', '', $value);
|
||||
}
|
||||
$link = str_replace('{socialid}', $value, $dictsocialnetworks[$type]['url']);
|
||||
$htmllink .= ' <a href="'.dol_sanitizeUrl($link).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
|
||||
if (preg_match('/^https?:\/\//i', $link)) {
|
||||
$htmllink .= ' <a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
|
||||
} else {
|
||||
$htmllink .= ' <a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
|
||||
}
|
||||
} else {
|
||||
$htmllink .= dol_escape_htmltag($value);
|
||||
}
|
||||
@ -3768,6 +3791,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||
$url = DOL_URL_ROOT;
|
||||
$theme = isset($conf->theme) ? $conf->theme : null;
|
||||
@ -3786,15 +3810,25 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
} else {
|
||||
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
||||
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
|
||||
|
||||
if (strpos($pictowithouttext, 'fontawesome_') !== false) {
|
||||
$pictowithouttext = explode('_', $pictowithouttext);
|
||||
if (strpos($pictowithouttext, 'fontawesome_') !== false || preg_match('/^fa-/', $pictowithouttext)) {
|
||||
// This is a font awesome image 'fonwtawesome_xxx' or 'fa-xxx'
|
||||
$pictowithouttext = str_replace('fa-', '', $pictowithouttext);
|
||||
$pictowithouttextarray = explode('_', $pictowithouttext);
|
||||
$marginleftonlyshort = 0;
|
||||
|
||||
$fakey = 'fa-'.$pictowithouttext[1];
|
||||
$fa = $pictowithouttext[2] ? $pictowithouttext[2] : 'fa';
|
||||
$facolor = $pictowithouttext[3] ? $pictowithouttext[3] : '';
|
||||
$fasize = $pictowithouttext[4] ? $pictowithouttext[4] : '';
|
||||
if (!empty($pictowithouttextarray[1])) {
|
||||
$fakey = 'fa-'.$pictowithouttextarray[1];
|
||||
$fa = empty($pictowithouttextarray[2]) ? 'fa' : $pictowithouttextarray[2];
|
||||
$facolor = empty($pictowithouttextarray[3]) ? '' : $pictowithouttextarray[3];
|
||||
$fasize = empty($pictowithouttextarray[4]) ? '' : $pictowithouttextarray[4];
|
||||
} else {
|
||||
$fakey = 'fa-'.$pictowithouttext;
|
||||
$fa = 'fa';
|
||||
$facolor = '';
|
||||
$fasize = '';
|
||||
}
|
||||
|
||||
// This snippet only needed since function img_edit accepts only one additional parameter: no separate one for css only.
|
||||
// class/style need to be extracted to avoid duplicate class/style validation errors when $moreatt is added to the end of the attributes.
|
||||
@ -3820,7 +3854,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
return $enabledisablehtml;
|
||||
}
|
||||
|
||||
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
@ -4958,10 +4991,10 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
||||
$liste_titre = 'liste_titre_sel';
|
||||
}
|
||||
|
||||
$out .= '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
|
||||
$tagstart = '<'.$tag.' class="'.$prefix.$liste_titre.'" '.$moreattrib;
|
||||
//$out .= (($field && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && preg_match('/^[a-zA-Z_0-9\s\.\-:&;]*$/', $name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '');
|
||||
$out .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
|
||||
$out .= '>';
|
||||
$tagstart .= ($name && empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) && empty($forcenowrapcolumntitle) && !dol_textishtml($name)) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : '';
|
||||
$tagstart .= '>';
|
||||
|
||||
if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field
|
||||
$options = preg_replace('/sortfield=([a-zA-Z0-9,\s\.]+)/i', '', (is_scalar($moreparam) ? $moreparam : ''));
|
||||
@ -4975,12 +5008,10 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
||||
if ($field1 != $sortfield1) { // We are on another field than current sorted field
|
||||
if (preg_match('/^DESC/i', $sortorder)) {
|
||||
$sortordertouseinlink .= str_repeat('desc,', count(explode(',', $field)));
|
||||
} else // We reverse the var $sortordertouseinlink
|
||||
{
|
||||
} else { // We reverse the var $sortordertouseinlink
|
||||
$sortordertouseinlink .= str_repeat('asc,', count(explode(',', $field)));
|
||||
}
|
||||
} else // We are on field that is the first current sorting criteria
|
||||
{
|
||||
} else { // We are on field that is the first current sorting criteria
|
||||
if (preg_match('/^ASC/i', $sortorder)) { // We reverse the var $sortordertouseinlink
|
||||
$sortordertouseinlink .= str_repeat('desc,', count(explode(',', $field)));
|
||||
} else {
|
||||
@ -5019,19 +5050,19 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
|
||||
if (preg_match('/^DESC/', $sortorder)) {
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>';
|
||||
$sortimg .= '<span class="nowrap">'.img_up("Z-A", 0, 'paddingleft').'</span>';
|
||||
$sortimg .= '<span class="nowrap">'.img_up("Z-A", 0, 'paddingright').'</span>';
|
||||
}
|
||||
if (preg_match('/^ASC/', $sortorder)) {
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>';
|
||||
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>';
|
||||
$sortimg .= '<span class="nowrap">'.img_down("A-Z", 0, 'paddingleft').'</span>';
|
||||
$sortimg .= '<span class="nowrap">'.img_down("A-Z", 0, 'paddingright').'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$out .= $sortimg;
|
||||
$tagend = '</'.$tag.'>';
|
||||
|
||||
$out .= '</'.$tag.'>';
|
||||
$out = $tagstart.$sortimg.$out.$tagend;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
|
||||
$newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0), 'auguria', $tabMenu);
|
||||
|
||||
// We update newmenu for special dynamic menus
|
||||
if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
|
||||
if (!empty($conf->banque->enabled) && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required for to get Account::TYPE_CASH for example
|
||||
|
||||
$sql = "SELECT rowid, label, courant, rappro, courant";
|
||||
|
||||
@ -2049,6 +2049,12 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf->stocktransfer->enabled) {
|
||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"'));
|
||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write);
|
||||
$newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read);
|
||||
}
|
||||
|
||||
// Inventory
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
$langs->load("stocks");
|
||||
|
||||
@ -393,6 +393,9 @@ class ImportCsv extends ModeleImports
|
||||
$newval = $arrayrecord[($key - 1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
|
||||
}
|
||||
|
||||
//var_dump($newval);var_dump($val);
|
||||
//var_dump($objimport->array_import_convertvalue[0][$val]);
|
||||
|
||||
// Make some tests on $newval
|
||||
|
||||
// Is it a required field ?
|
||||
@ -417,7 +420,7 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
|
||||
$newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref
|
||||
//print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n";
|
||||
//print 'Newval is now "'.$newval.'" and is type '.$isidorref."<br>\n";
|
||||
|
||||
if ($isidorref == 'ref') { // If value into input import file is a ref, we apply the function defined into descriptor
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
@ -432,6 +435,11 @@ class ImportCsv extends ModeleImports
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
if ($class == 'CGenericDic') {
|
||||
$classinstance->element = $objimport->array_import_convertvalue[0][$val]['element'];
|
||||
$classinstance->table_element = $objimport->array_import_convertvalue[0][$val]['table_element'];
|
||||
}
|
||||
|
||||
// Try the fetch from code or ref
|
||||
$param_array = array('', $newval);
|
||||
if ($class == 'AccountingAccount') {
|
||||
@ -601,7 +609,7 @@ class ImportCsv extends ModeleImports
|
||||
$modForNumber = new $classModForNumber;
|
||||
|
||||
$tmpobject = null;
|
||||
// Set the object when we can
|
||||
// Set the object with the date property when we can
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) {
|
||||
$pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject'];
|
||||
require_once DOL_DOCUMENT_ROOT.$pathForObject;
|
||||
@ -748,8 +756,9 @@ class ImportCsv extends ModeleImports
|
||||
$tmpsql = $listvalues[$socialkey];
|
||||
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
|
||||
}
|
||||
|
||||
// We add hidden fields (but only if there is at least one field to add into table)
|
||||
// We process here all the fields that were declared into the array ->import_fieldshidden_array of the descriptor file.
|
||||
// We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file.
|
||||
// Previously we processed the ->import_fields_array.
|
||||
if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) {
|
||||
// Loop on each hidden fields to add them into listfields/listvalues
|
||||
@ -810,11 +819,18 @@ class ImportCsv extends ModeleImports
|
||||
$updatedone = false;
|
||||
$insertdone = false;
|
||||
|
||||
$is_table_category_link = false;
|
||||
$fname = 'rowid';
|
||||
if (strpos($tablename, '_categorie_') !== false) {
|
||||
$is_table_category_link = true;
|
||||
$fname='*';
|
||||
}
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) { // No insert done yet for a parent table
|
||||
$sqlSelect = "SELECT rowid FROM ".$tablename;
|
||||
$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
|
||||
|
||||
$data = array_combine($listfields, $listvalues);
|
||||
$where = array();
|
||||
@ -833,6 +849,7 @@ class ImportCsv extends ModeleImports
|
||||
if ($num_rows == 1) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$lastinsertid = $res->rowid;
|
||||
if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
|
||||
$last_insert_id_array[$tablename] = $lastinsertid;
|
||||
} elseif ($num_rows > 1) {
|
||||
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
|
||||
@ -858,7 +875,7 @@ class ImportCsv extends ModeleImports
|
||||
if (empty($keyfield)) {
|
||||
$keyfield = 'rowid';
|
||||
}
|
||||
$sqlSelect .= " WHERE ".$keyfield.' = '.((int) $lastinsertid);
|
||||
$sqlSelect .= " WHERE ".$keyfield." = ".((int) $lastinsertid);
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
@ -894,6 +911,10 @@ class ImportCsv extends ModeleImports
|
||||
}
|
||||
$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
|
||||
|
||||
if ($is_table_category_link) {
|
||||
$sqlend = " WHERE " . implode(' AND ', $where);
|
||||
}
|
||||
|
||||
$sql = $sqlstart.$sqlend;
|
||||
|
||||
// Run update request
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -86,6 +86,10 @@ class ImportXlsx extends ModeleImports
|
||||
|
||||
public $cachefieldtable = array(); // Array to cache list of value found into fields@tables
|
||||
|
||||
public $nbinsert = 0; // # of insert done during the import
|
||||
|
||||
public $nbupdate = 0; // # of update done during the import
|
||||
|
||||
public $workbook; // temporary import file
|
||||
|
||||
public $record; // current record
|
||||
@ -111,20 +115,19 @@ class ImportXlsx extends ModeleImports
|
||||
$this->extension = 'xlsx'; // Extension for generated file by this driver
|
||||
$this->picto = 'mime/xls'; // Picto (This is not used by the example file code as Mime type, too bad ...)
|
||||
$this->version = '1.0'; // Driver version
|
||||
|
||||
// If driver use an external library, put its name here
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/phpoffice/phpspreadsheet/src/autoloader.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/Psr/autoloader.php';
|
||||
require_once PHPEXCELNEW_PATH.'Spreadsheet.php';
|
||||
$this->workbook = new Spreadsheet();
|
||||
|
||||
//if ($this->id == 'excel2007new')
|
||||
{
|
||||
// If driver use an external library, put its name here
|
||||
if (!class_exists('ZipArchive')) { // For Excel2007
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorPHPNeedModule', 'zip');
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
$this->label_lib = 'PhpSpreadSheet';
|
||||
$this->version_lib = '1.8.0';
|
||||
|
||||
@ -363,8 +366,6 @@ class ImportXlsx extends ModeleImports
|
||||
$warning = 0;
|
||||
$this->errors = array();
|
||||
$this->warnings = array();
|
||||
$this->nbinsert = 0;
|
||||
$this->nbupdate = 0;
|
||||
|
||||
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
|
||||
|
||||
@ -438,11 +439,14 @@ class ImportXlsx extends ModeleImports
|
||||
$newval = $arrayrecord[($key)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
|
||||
}
|
||||
|
||||
//var_dump($newval);var_dump($val);
|
||||
//var_dump($objimport->array_import_convertvalue[0][$val]);
|
||||
|
||||
// Make some tests on $newval
|
||||
|
||||
// Is it a required field ?
|
||||
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == '')) {
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', $key);
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', num2Alpha($key - 1));
|
||||
$this->errors[$error]['type'] = 'NOTNULL';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
@ -461,7 +465,7 @@ class ImportXlsx extends ModeleImports
|
||||
$isidorref = 'ref';
|
||||
}
|
||||
$newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref
|
||||
//print 'Val is now '.$newval.' and is type '.$isidorref."<br>\n";
|
||||
//print 'Newval is now "'.$newval.'" and is type '.$isidorref."<br>\n";
|
||||
|
||||
if ($isidorref == 'ref') { // If value into input import file is a ref, we apply the function defined into descriptor
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
@ -476,6 +480,11 @@ class ImportXlsx extends ModeleImports
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
if ($class == 'CGenericDic') {
|
||||
$classinstance->element = $objimport->array_import_convertvalue[0][$val]['element'];
|
||||
$classinstance->table_element = $objimport->array_import_convertvalue[0][$val]['table_element'];
|
||||
}
|
||||
|
||||
// Try the fetch from code or ref
|
||||
$param_array = array('', $newval);
|
||||
if ($class == 'AccountingAccount') {
|
||||
@ -674,7 +683,7 @@ class ImportXlsx extends ModeleImports
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord));
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, $key));
|
||||
$newval = $res; // We get new value computed.
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
|
||||
$newval = price2num($newval);
|
||||
@ -758,19 +767,16 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) {
|
||||
$socialkey = array_search("socialnetworks", $listfields);
|
||||
$socialnetwork = explode("_", $fieldname)[1];
|
||||
if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
|
||||
$socialnetwork = explode("_", $fieldname)[1];
|
||||
$json = new stdClass();
|
||||
$json->$socialnetwork = $newval;
|
||||
$newvalue = json_encode($json);
|
||||
$listvalues[$socialkey] = $newvalue;
|
||||
$listvalues[$socialkey] = json_encode($json);
|
||||
} else {
|
||||
$socialnetwork = explode("_", $fieldname)[1];
|
||||
$jsondata = $listvalues[$socialkey];
|
||||
$jsondata = str_replace("'", "", $jsondata);
|
||||
$json = json_decode($jsondata);
|
||||
$json->$socialnetwork = $this->db->escape($newval);
|
||||
$listvalues[$socialkey] = "'".$this->db->escape(json_encode($json))."'";
|
||||
$json->$socialnetwork = $newval;
|
||||
$listvalues[$socialkey] = json_encode($json);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -789,6 +795,13 @@ class ImportXlsx extends ModeleImports
|
||||
$i++;
|
||||
}
|
||||
|
||||
// We db escape social network field because he isn't in field creation
|
||||
if (in_array("socialnetworks", $listfields)) {
|
||||
$socialkey = array_search("socialnetworks", $listfields);
|
||||
$tmpsql = $listvalues[$socialkey];
|
||||
$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
|
||||
}
|
||||
|
||||
// We add hidden fields (but only if there is at least one field to add into table)
|
||||
// We process here all the fields that were declared into the array $this->import_fieldshidden_array of the descriptor file.
|
||||
// Previously we processed the ->import_fields_array.
|
||||
@ -825,7 +838,7 @@ class ImportXlsx extends ModeleImports
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues));
|
||||
$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $listfields, $key));
|
||||
$fieldArr = explode('.', $fieldname);
|
||||
if (count($fieldArr) > 0) {
|
||||
$fieldname = $fieldArr[1];
|
||||
@ -850,11 +863,19 @@ class ImportXlsx extends ModeleImports
|
||||
if (!empty($listfields)) {
|
||||
$updatedone = false;
|
||||
$insertdone = false;
|
||||
|
||||
$is_table_category_link = false;
|
||||
$fname = 'rowid';
|
||||
if (strpos($tablename, '_categorie_') !== false) {
|
||||
$is_table_category_link = true;
|
||||
$fname='*';
|
||||
}
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) { // No insert done yet for a parent table
|
||||
$sqlSelect = "SELECT rowid FROM " . $tablename;
|
||||
$sqlSelect = "SELECT ".$fname." FROM " . $tablename;
|
||||
|
||||
$data = array_combine($listfields, $listvalues);
|
||||
$where = array();
|
||||
@ -873,6 +894,7 @@ class ImportXlsx extends ModeleImports
|
||||
if ($num_rows == 1) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$lastinsertid = $res->rowid;
|
||||
if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
|
||||
$last_insert_id_array[$tablename] = $lastinsertid;
|
||||
} elseif ($num_rows > 1) {
|
||||
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
|
||||
@ -898,7 +920,7 @@ class ImportXlsx extends ModeleImports
|
||||
if (empty($keyfield)) {
|
||||
$keyfield = 'rowid';
|
||||
}
|
||||
$sqlSelect .= "WHERE " . $keyfield . " = " .((int) $lastinsertid);
|
||||
$sqlSelect .= "WHERE ".$keyfield." = ".((int) $lastinsertid);
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
@ -925,7 +947,7 @@ class ImportXlsx extends ModeleImports
|
||||
$data = array_combine($listfields, $listvalues);
|
||||
$set = array();
|
||||
foreach ($data as $key => $val) {
|
||||
$set[] = $key . ' = ' . $val;
|
||||
$set[] = $key." = ".$val;
|
||||
}
|
||||
$sqlstart .= " SET " . implode(', ', $set);
|
||||
|
||||
@ -934,6 +956,10 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
$sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid);
|
||||
|
||||
if ($is_table_category_link) {
|
||||
$sqlend = " WHERE " . implode(' AND ', $where);
|
||||
}
|
||||
|
||||
$sql = $sqlstart . $sqlend;
|
||||
|
||||
// Run update request
|
||||
|
||||
@ -42,6 +42,8 @@ class mailing_advthirdparties extends MailingTargets
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -198,8 +200,8 @@ class mailing_advthirdparties extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Not use here
|
||||
* @return int Nb of recipients
|
||||
* @param string $sql Not use here
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
@ -210,8 +212,7 @@ class mailing_advthirdparties extends MailingTargets
|
||||
$sql .= " WHERE s.email != ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
|
||||
@ -38,6 +38,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
public $require_module = array("societe"); // Module mailing actif si modules require_module actifs
|
||||
public $require_admin = 0; // Module mailing actif pour user admin ou non
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -92,8 +94,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
|
||||
@ -111,8 +111,8 @@ class mailing_example extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Number of recipient or '?'
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
|
||||
@ -41,6 +41,8 @@ class mailing_fraise extends MailingTargets
|
||||
|
||||
public $require_module = array('adherent');
|
||||
|
||||
public $enabled = '$conf->adherent->enabled';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -91,8 +93,8 @@ class mailing_fraise extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int Nb of recipients
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
@ -100,8 +102,7 @@ class mailing_fraise extends MailingTargets
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,11 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string Condition to be enabled
|
||||
*/
|
||||
public $enabled;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
@ -94,8 +99,8 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
/**
|
||||
* Retourne nombre de destinataires
|
||||
*
|
||||
* @param string $sql Sql request to count
|
||||
* @return int Nb of recipient, or <0 if error
|
||||
* @param string $sql Sql request to count
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql)
|
||||
{
|
||||
|
||||
@ -41,6 +41,8 @@ class mailing_partnership extends MailingTargets
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $enabled = '$conf->partnership->enabled';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -164,8 +166,8 @@ class mailing_partnership extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int Nb of recipients
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
@ -185,8 +187,7 @@ class mailing_partnership extends MailingTargets
|
||||
|
||||
//print $sql;
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
|
||||
@ -89,8 +89,8 @@ class mailing_pomme extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int Number of recipients
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
@ -101,8 +101,7 @@ class mailing_pomme extends MailingTargets
|
||||
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
|
||||
$sql .= " AND u.entity IN (0,".$conf->entity.")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ class mailing_thirdparties extends MailingTargets
|
||||
|
||||
public $require_module = array("societe"); // This module allows to select by categories must be also enabled if category module is not activated
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -209,8 +211,8 @@ class mailing_thirdparties extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int Nb of recipients
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
@ -221,8 +223,7 @@ class mailing_thirdparties extends MailingTargets
|
||||
$sql .= " WHERE s.email <> ''";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
|
||||
// La requete doit retourner un champ "nb" pour etre comprise
|
||||
// par parent::getNbOfRecipients
|
||||
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
|
||||
return parent::getNbOfRecipients($sql);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,8 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
|
||||
public $require_module = array('contrat');
|
||||
|
||||
public $enabled = '$conf->societe->enabled';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -182,8 +184,8 @@ class mailing_thirdparties_services_expired extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int Number of recipients
|
||||
* @param string $sql SQL request to use to count
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
|
||||
@ -77,8 +77,8 @@ class mailing_xinputfile extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Sql request to count
|
||||
* @return string '' means NA
|
||||
* @param string $sql Sql request to count
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
|
||||
@ -77,8 +77,8 @@ class mailing_xinputuser extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Sql request to count
|
||||
* @return string '' means NA
|
||||
* @param string $sql Sql request to count
|
||||
* @return int|string Nb of recipient, or <0 if error, or '' if NA
|
||||
*/
|
||||
public function getNbOfRecipients($sql = '')
|
||||
{
|
||||
|
||||
@ -481,6 +481,7 @@ class modCategorie extends DolibarrModules
|
||||
'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"rowid or label", 'cp.fk_product'=>"rowid or ref");
|
||||
$this->import_updatekeys_array[$r] = array('cp.fk_categorie' => 'Category', 'cp.fk_product' => 'ProductRef');
|
||||
}
|
||||
|
||||
// 1 Suppliers
|
||||
|
||||
@ -586,7 +586,26 @@ class modSociete extends DolibarrModules
|
||||
'class' => 'Account',
|
||||
'method' => 'fetch',
|
||||
'element' => 'BankAccount'
|
||||
// ),
|
||||
),
|
||||
's.fk_stcomm' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/cgenericdic.class.php',
|
||||
'class' => 'CGenericDic',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryProspectStatus',
|
||||
'element' => 'c_stcomm',
|
||||
'table_element' => 'c_stcomm'
|
||||
),
|
||||
/*
|
||||
's.fk_prospectlevel' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/cgenericdic.class.php',
|
||||
'class' => 'CGenericDic',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryProspectLevel',
|
||||
'element' => 'c_prospectlevel',
|
||||
'table_element' => 'c_prospectlevel'
|
||||
),*/
|
||||
// TODO
|
||||
// 's.fk_incoterms' => array(
|
||||
// 'rule' => 'fetchidfromcodeid',
|
||||
@ -594,7 +613,7 @@ class modSociete extends DolibarrModules
|
||||
// 'class' => 'Cincoterm',
|
||||
// 'method' => 'fetch',
|
||||
// 'dict' => 'IncotermLabel'
|
||||
)
|
||||
// )
|
||||
);
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r] = array(//field order as per structure of table llx_societe
|
||||
|
||||
507
htdocs/core/modules/modStockTransfer.class.php
Normal file
507
htdocs/core/modules/modStockTransfer.class.php
Normal file
@ -0,0 +1,507 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 SuperAdmin
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup stocktransfer Module StockTransfer
|
||||
* \brief StockTransfer module descriptor.
|
||||
*
|
||||
* \file htdocs/stocktransfer/core/modules/modStockTransfer.class.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Description and activation file for module StockTransfer
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
/**
|
||||
* Description and activation class for module StockTransfer
|
||||
*/
|
||||
class modStockTransfer extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$this->db = $db;
|
||||
|
||||
$langs->load('stocks');
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 701; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'stocktransfer';
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "other";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '90';
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module label (no space allowed), used if translation string 'ModuleStockTransferName' not found (StockTransfer is name of module).
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
// Module description, used if translation string 'ModuleStockTransferDesc' not found (StockTransfer is name of module).
|
||||
$this->description = $langs->trans("ModuleStockTransferDesc");
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "StockTransfer description (Long)";
|
||||
$this->editor_name = 'Editor name';
|
||||
$this->editor_url = 'https://www.example.com';
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'development';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
// Key used in llx_const table to save module status enabled/disabled (where STOCKTRANSFER is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto = 'stock';
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'triggers' => 0,
|
||||
// Set this to 1 if module has its own login method file (core/login)
|
||||
'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'substitutions' => 0,
|
||||
// Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'menus' => 0,
|
||||
// Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'tpl' => 0,
|
||||
// Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'barcode' => 0,
|
||||
// Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'models' => 1,
|
||||
// Set this to 1 if module has its own theme directory (theme)
|
||||
'theme' => 0,
|
||||
// Set this to relative path of css file if module has its own css file
|
||||
'css' => array(
|
||||
// '/stocktransfer/css/stocktransfer.css.php',
|
||||
),
|
||||
// Set this to relative path of js file if module must load a js on all pages
|
||||
'js' => array(
|
||||
// '/stocktransfer/js/stocktransfer.js.php',
|
||||
),
|
||||
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
|
||||
'hooks' => array(
|
||||
// 'data' => array(
|
||||
// 'hookcontext1',
|
||||
// 'hookcontext2',
|
||||
// ),
|
||||
// 'entity' => '0',
|
||||
),
|
||||
// Set this to 1 if features of module are opened to external users
|
||||
'moduleforexternal' => 0,
|
||||
'contactelement'=>1
|
||||
);
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/stocktransfer/temp","/stocktransfer/subdir");
|
||||
$this->dirs = array("/stocktransfer/temp");
|
||||
// Config pages. Put here list of php page, stored into stocktransfer/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("stocktransfer.php");
|
||||
// Dependencies
|
||||
// A condition to hide module
|
||||
$this->hidden = false;
|
||||
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->depends = array('modStock', 'modProduct');
|
||||
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->langfiles = array("stocktransfer@stocktransfer");
|
||||
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'StockTransferWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(1 => array('STOCKTRANSFER_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
|
||||
// 2 => array('STOCKTRANSFER_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array();
|
||||
|
||||
// Some keys to add into the overwriting translation tables
|
||||
/*$this->overwrite_translation = array(
|
||||
'en_US:ParentCompany'=>'Parent company or reseller',
|
||||
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
||||
)*/
|
||||
|
||||
if (!isset($conf->stocktransfer) || !isset($conf->stocktransfer->enabled)) {
|
||||
$conf->stocktransfer = new stdClass();
|
||||
$conf->stocktransfer->enabled = 0;
|
||||
}
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// Example:
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@stocktransfer:$user->rights->stocktransfer->read:/stocktransfer/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@stocktransfer:$user->rights->othermodule->read:/stocktransfer/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||
//
|
||||
// Where objecttype can be
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'user' to add a tab in user view
|
||||
|
||||
// Dictionaries
|
||||
$this->dictionaries = array();
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs'=>'stocktransfer@stocktransfer',
|
||||
// List of tables we want to see into dictonnary editor
|
||||
'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
|
||||
// Label of tables
|
||||
'tablib'=>array("Table1", "Table2", "Table3"),
|
||||
// Request to select fields
|
||||
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
|
||||
// Sort order
|
||||
'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
|
||||
// List of fields (result of select to show dictionary)
|
||||
'tabfield'=>array("code,label", "code,label", "code,label"),
|
||||
// List of fields (list of fields to edit a record)
|
||||
'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
|
||||
// List of fields (list of fields for insert)
|
||||
'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
|
||||
// Name of columns with primary key (try to always name it 'rowid')
|
||||
'tabrowid'=>array("rowid", "rowid", "rowid"),
|
||||
// Condition to show each dictionary
|
||||
'tabcond'=>array($conf->stocktransfer->enabled, $conf->stocktransfer->enabled, $conf->stocktransfer->enabled)
|
||||
);
|
||||
*/
|
||||
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in stocktransfer/core/boxes that contains a class to show a widget.
|
||||
$this->boxes = array(
|
||||
// 0 => array(
|
||||
// 'file' => 'stocktransferwidget1.php@stocktransfer',
|
||||
// 'note' => 'Widget provided by StockTransfer',
|
||||
// 'enabledbydefaulton' => 'Home',
|
||||
// ),
|
||||
// ...
|
||||
);
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
// 0 => array(
|
||||
// 'label' => 'MyJob label',
|
||||
// 'jobtype' => 'method',
|
||||
// 'class' => '/stocktransfer/class/stocktransfer.class.php',
|
||||
// 'objectname' => 'StockTransfer',
|
||||
// 'method' => 'doScheduledJob',
|
||||
// 'parameters' => '',
|
||||
// 'comment' => 'Comment',
|
||||
// 'frequency' => 2,
|
||||
// 'unitfrequency' => 3600,
|
||||
// 'status' => 0,
|
||||
// 'test' => '$conf->stocktransfer->enabled',
|
||||
// 'priority' => 50,
|
||||
// ),
|
||||
);
|
||||
// Example: $this->cronjobs=array(
|
||||
// 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->stocktransfer->enabled', 'priority'=>50),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->stocktransfer->enabled', 'priority'=>50)
|
||||
// );
|
||||
|
||||
// Permissions provided by this module
|
||||
$this->rights = array();
|
||||
$r = 10;
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = $langs->trans('StockTransferRightRead'); // Permission label
|
||||
$this->rights[$r][4] = 'stocktransfer'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = $langs->trans('StockTransferRightCreateUpdate'); // Permission label
|
||||
$this->rights[$r][4] = 'stocktransfer'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = $langs->trans('StockTransferRightDelete'); // Permission label
|
||||
$this->rights[$r][4] = 'stocktransfer'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->stocktransfer->level1->level2)
|
||||
$r++;
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
|
||||
// Main menu entries to add
|
||||
$langs->load('stocktransfer@stocktransfer');
|
||||
$this->menu = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new menus
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
/*$this->menu[$r++] = array(
|
||||
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>'ModuleStockTransferName',
|
||||
'mainmenu'=>'stocktransfer',
|
||||
'leftmenu'=>'',
|
||||
'url'=>'/stocktransfer/stocktransferindex.php',
|
||||
'langs'=>'stocktransfer@stocktransfer', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000 + $r,
|
||||
'enabled'=>'$conf->stocktransfer->enabled', // Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->stocktransfer->stocktransfer->read' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);*/
|
||||
/* END MODULEBUILDER TOPMENU */
|
||||
/* BEGIN MODULEBUILDER LEFTMENU STOCKTRANSFER
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=stocktransfer', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Top menu entry
|
||||
'titre'=>'StockTransfer',
|
||||
'mainmenu'=>'stocktransfer',
|
||||
'leftmenu'=>'stocktransfer',
|
||||
'url'=>'/stocktransfer/stocktransferindex.php',
|
||||
'langs'=>'stocktransfer@stocktransfer', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->stocktransfer->enabled', // Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->stocktransfer->stocktransfer->read', // Use 'perms'=>'$user->rights->stocktransfer->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=stocktransfer,fk_leftmenu=stocktransfer', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'List StockTransfer',
|
||||
'mainmenu'=>'stocktransfer',
|
||||
'leftmenu'=>'stocktransfer_stocktransfer_list',
|
||||
'url'=>'/stocktransfer/stocktransfer_list.php',
|
||||
'langs'=>'stocktransfer@stocktransfer', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->stocktransfer->enabled', // Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->stocktransfer->stocktransfer->read', // Use 'perms'=>'$user->rights->stocktransfer->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=stocktransfer,fk_leftmenu=stocktransfer', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'New StockTransfer',
|
||||
'mainmenu'=>'stocktransfer',
|
||||
'leftmenu'=>'stocktransfer_stocktransfer_new',
|
||||
'url'=>'/stocktransfer/stocktransfer_card.php?action=create',
|
||||
'langs'=>'stocktransfer@stocktransfer', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->stocktransfer->enabled', // Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->stocktransfer->stocktransfer->write', // Use 'perms'=>'$user->rights->stocktransfer->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
*/
|
||||
|
||||
/*$this->menu[$r++]=array(
|
||||
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=stock',
|
||||
// This is a Left menu entry
|
||||
'type'=>'left',
|
||||
'titre'=>$langs->trans('StockTransferNew'),
|
||||
'mainmenu'=>'products',
|
||||
'leftmenu'=>'stocktransfer_stocktransfer',
|
||||
'url'=>'/stocktransfer/stocktransfer_card.php?action=create',
|
||||
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'langs'=>'stocktransfer@stocktransfer',
|
||||
'position'=>1100+$r,
|
||||
// Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'enabled'=>'$conf->stocktransfer->enabled',
|
||||
// Use 'perms'=>'$user->rights->stocktransfer->level1->level2' if you want your menu with a permission rules
|
||||
'perms'=>'1',
|
||||
'target'=>'',
|
||||
// 0=Menu for internal users, 1=external users, 2=both
|
||||
'user'=>2
|
||||
);
|
||||
$this->menu[$r++]=array(
|
||||
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=stock',
|
||||
// This is a Left menu entry
|
||||
'type'=>'left',
|
||||
'titre'=>$langs->trans('StockTransferList'),
|
||||
'mainmenu'=>'products',
|
||||
'leftmenu'=>'stocktransfer_stocktransferlist',
|
||||
'url'=>'/stocktransfer/stocktransfer_list.php',
|
||||
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'langs'=>'stocktransfer@stocktransfer',
|
||||
'position'=>1100+$r,
|
||||
// Define condition to show or hide menu entry. Use '$conf->stocktransfer->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'enabled'=>'$conf->stocktransfer->enabled',
|
||||
// Use 'perms'=>'$user->rights->stocktransfer->level1->level2' if you want your menu with a permission rules
|
||||
'perms'=>'1',
|
||||
'target'=>'',
|
||||
// 0=Menu for internal users, 1=external users, 2=both
|
||||
'user'=>2,
|
||||
);*/
|
||||
|
||||
/* END MODULEBUILDER LEFTMENU STOCKTRANSFER */
|
||||
|
||||
// Exports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER EXPORT STOCKTRANSFER */
|
||||
/*
|
||||
$langs->load("stocktransfer@stocktransfer");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='StockTransferLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='stocktransfer@stocktransfer';
|
||||
// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
|
||||
$keyforclass = 'StockTransfer'; $keyforclassfile='/stocktransfer/class/stocktransfer.class.php'; $keyforelement='stocktransfer@stocktransfer';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
|
||||
//unset($this->export_fields_array[$r]['t.fieldtoremove']);
|
||||
//$keyforclass = 'StockTransferLine'; $keyforclassfile='/stocktransfer/class/stocktransfer.class.php'; $keyforelement='stocktransferline@stocktransfer'; $keyforalias='tl';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='stocktransfer'; $keyforaliasextra='extra'; $keyforelement='stocktransfer@stocktransfer';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$keyforselect='stocktransferline'; $keyforaliasextra='extraline'; $keyforelement='stocktransferline@stocktransfer';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r] = array('stocktransferline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
//$this->export_special_array[$r] = array('t.field'=>'...');
|
||||
//$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
|
||||
//$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'stocktransfer as t';
|
||||
//$this->export_sql_end[$r] =' LEFT JOIN '.MAIN_DB_PREFIX.'stocktransfer_line as tl ON tl.fk_stocktransfer = t.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('stocktransfer').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT STOCKTRANSFER */
|
||||
|
||||
// Imports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER IMPORT STOCKTRANSFER */
|
||||
/*
|
||||
$langs->load("stocktransfer@stocktransfer");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='StockTransferLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='stocktransfer@stocktransfer';
|
||||
$keyforclass = 'StockTransfer'; $keyforclassfile='/stocktransfer/class/stocktransfer.class.php'; $keyforelement='stocktransfer@stocktransfer';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='stocktransfer'; $keyforaliasextra='extra'; $keyforelement='stocktransfer@stocktransfer';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'stocktransfer as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('stocktransfer').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER IMPORT STOCKTRANSFER */
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$result = $this->_load_tables('/install/mysql/tables/', 'stocktransfer');
|
||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
|
||||
// Create extrafields during init
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result1=$extrafields->addExtraField('stocktransfer_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled');
|
||||
//$result2=$extrafields->addExtraField('stocktransfer_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled');
|
||||
//$result3=$extrafields->addExtraField('stocktransfer_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled');
|
||||
//$result4=$extrafields->addExtraField('stocktransfer_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled');
|
||||
//$result5=$extrafields->addExtraField('stocktransfer_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'stocktransfer@stocktransfer', '$conf->stocktransfer->enabled');
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
// Rôles
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "internal"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$nextid=$this->getNextId();
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "internal", "STRESP", "Responsable du transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STFROM" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$nextid=$this->getNextId();
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STFROM", "Contact expéditeur transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
$resql = $this->db->query('SELECT rowid FROM '.MAIN_DB_PREFIX.'c_type_contact WHERE code = "STDEST" AND element = "StockTransfer" AND source = "external"');
|
||||
$res = $this->db->fetch_object($resql);
|
||||
$nextid=$this->getNextId();
|
||||
if (empty($res)) $this->db->query('INSERT INTO '.MAIN_DB_PREFIX.'c_type_contact(rowid, element, source, code, libelle, active, module, position) VALUES('.((int) $nextid).', "StockTransfer", "external", "STDEST", "Contact destinataire transfert de stocks", 1, NULL, 0)');
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next available id to insert new roles in llx_c_type_contact
|
||||
* @return int > 0 if OK, < 0 if KO
|
||||
*/
|
||||
public function getNextId()
|
||||
{
|
||||
// Get free id for insert
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(rowid) newid from ".MAIN_DB_PREFIX."c_type_contact";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
return $newid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
}
|
||||
1174
htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
Normal file
1174
htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
Normal file
File diff suppressed because it is too large
Load Diff
1635
htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
Normal file
1635
htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php
Normal file
File diff suppressed because it is too large
Load Diff
149
htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
Normal file
149
htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief File containing class for advanced numbering model of StockTransfer
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/stocktransfer/modules_stocktransfer.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage customer Bom numbering rules advanced
|
||||
*/
|
||||
class mod_stocktransfer_advanced extends ModeleNumRefStockTransfer
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
/**
|
||||
* @var string Error message
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string name
|
||||
*/
|
||||
public $name = 'got2be';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the description of the numbering model
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte .= '<input type="hidden" name="maskconststocktransfer" value="STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("StockTransfer"), $langs->transnoentities("StockTransfer"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes2");
|
||||
$tooltip .= $langs->trans("GenericMaskCodes3");
|
||||
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("StockTransfer"), $langs->transnoentities("StockTransfer"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskStockTransfer" value="'.$conf->global->STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
$texte .= '</tr>';
|
||||
|
||||
$texte .= '</table>';
|
||||
$texte .= '</form>';
|
||||
|
||||
return $texte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $conf, $db, $langs, $mysoc;
|
||||
|
||||
$object = new StockTransfer($db);
|
||||
$object->initAsSpecimen();
|
||||
|
||||
/*$old_code_client = $mysoc->code_client;
|
||||
$old_code_type = $mysoc->typent_code;
|
||||
$mysoc->code_client = 'CCCCCCCCCC';
|
||||
$mysoc->typent_code = 'TTTTTTTTTT';*/
|
||||
|
||||
$numExample = $this->getNextValue($object);
|
||||
|
||||
/*$mysoc->code_client = $old_code_client;
|
||||
$mysoc->typent_code = $old_code_type;*/
|
||||
|
||||
if (!$numExample) {
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($object)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// We get cursor rule
|
||||
$mask = $conf->global->STOCKTRANSFER_STOCKTRANSFER_ADVANCED_MASK;
|
||||
|
||||
if (!$mask) {
|
||||
$this->error = 'NotConfigured';
|
||||
return 0;
|
||||
}
|
||||
|
||||
$date = $object->date;
|
||||
|
||||
$numFinal = get_next_value($db, $mask, 'stocktransfer_stocktransfer', 'ref', '', null, $date);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
}
|
||||
154
htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
Normal file
154
htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/stocktransfer/mod_stocktransfer_standard.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief File of class to manage StockTransfer numbering rules standard
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/stocktransfer/modules_stocktransfer.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage customer order numbering rules standard
|
||||
*/
|
||||
class mod_stocktransfer_standard extends ModeleNumRefStockTransfer
|
||||
{
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
*/
|
||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||
|
||||
public $prefix = 'ST';
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string name
|
||||
*/
|
||||
public $name = 'standard';
|
||||
|
||||
|
||||
/**
|
||||
* Return description of numbering module
|
||||
*
|
||||
* @return string Text with description
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in the database do not
|
||||
* cause conflicts that would prevent this numbering working.
|
||||
*
|
||||
* @param Object $object Object we need next value for
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated($object)
|
||||
{
|
||||
global $conf, $langs, $db;
|
||||
|
||||
$coyymm = ''; $max = '';
|
||||
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."stocktransfer_stocktransfer";
|
||||
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
} elseif ($object->ismultientitymanaged == 2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) { $coyymm = substr($row[0], 0, 6); $max = $row[0]; }
|
||||
}
|
||||
if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($object)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
// first we get the max value
|
||||
$posindice = strlen($this->prefix) + 6;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."stocktransfer_stocktransfer";
|
||||
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
} elseif ($object->ismultientitymanaged == 2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $max = intval($obj->max);
|
||||
else $max = 0;
|
||||
} else {
|
||||
dol_syslog("mod_stocktransfer_standard::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//$date=time();
|
||||
$date = $object->date_creation;
|
||||
$yymm = strftime("%y%m", $date);
|
||||
|
||||
if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||
else $num = sprintf("%04s", $max + 1);
|
||||
|
||||
dol_syslog("mod_stocktransfer_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
}
|
||||
151
htdocs/core/modules/stocktransfer/modules_stocktransfer.php
Normal file
151
htdocs/core/modules/stocktransfer/modules_stocktransfer.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
* or see https://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/stocktransfer/modules_stocktransfer.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief File that contains parent class for stocktransfers document models and parent class for stocktransfers numbering models
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
|
||||
|
||||
|
||||
/**
|
||||
* Parent class for documents models
|
||||
*/
|
||||
abstract class ModelePDFStockTransfer extends CommonDocGenerator
|
||||
{
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
public static function liste_modeles($db, $maxfilenamelength = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'stocktransfer';
|
||||
$list = array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$list = getListOfModels($db, $type, $maxfilenamelength);
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parent class to manage numbering of StockTransfer
|
||||
*/
|
||||
abstract class ModeleNumRefStockTransfer
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default description of the numbering template
|
||||
*
|
||||
* @return string Texte descripif
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("stocktransfer@stocktransfer");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an example of numbering
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("stocktransfer@stocktransfer");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the numbers already in the database do not
|
||||
* cause conflicts that would prevent this numbering working.
|
||||
*
|
||||
* @param Object $object Object we need next value for
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
public function canBeActivated($object)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next assigned value
|
||||
*
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getNextValue($object)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns version of numbering module
|
||||
*
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
if ($this->version) return $this->version;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2021 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2022 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
// Need global variable $urllogo, $title and $titletruedolibarrversion to be defined by caller (like dol_loginfunction in security2.lib.php)
|
||||
// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
|
||||
|
||||
// $titletruedolibarrversion must be defined
|
||||
|
||||
if (!defined('NOBROWSERNOTIF')) {
|
||||
define('NOBROWSERNOTIF', 1);
|
||||
@ -71,6 +71,12 @@ $php_self .= dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmlt
|
||||
if (!preg_match('/mainmenu=/', $php_self)) {
|
||||
$php_self .= (preg_match('/\?/', $php_self) ? '&' : '?').'mainmenu=home';
|
||||
}
|
||||
if (preg_match('/'.preg_quote('core/modules/oauth', '/').'/', $php_self)) {
|
||||
$php_self = DOL_URL_ROOT.'/index.php?mainmenu=home';
|
||||
}
|
||||
$php_self = preg_replace('/(\?|&|&)action=[^&]+/', '\1', $php_self);
|
||||
$php_self = preg_replace('/(\?|&|&)massaction=[^&]+/', '\1', $php_self);
|
||||
$php_self = preg_replace('/(\?|&|&)token=[^&]+/', '\1', $php_self);
|
||||
|
||||
// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
|
||||
$arrayofjs = array(
|
||||
|
||||
@ -101,7 +101,7 @@ if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "cp.rowid";
|
||||
$sortfield = "cp.ref";
|
||||
}
|
||||
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
|
||||
@ -799,6 +799,7 @@ if ($step == 4 && $datatoimport) {
|
||||
$minpos = min(count($fieldssource), count($fieldstarget));
|
||||
//var_dump($array_match_file_to_database);
|
||||
|
||||
|
||||
$initialloadofstep4 = false;
|
||||
if (empty($_SESSION['dol_array_match_file_to_database_select'])) {
|
||||
$initialloadofstep4 = true;
|
||||
@ -971,6 +972,7 @@ if ($step == 4 && $datatoimport) {
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank" rel="noopener noreferrer">';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print $filetoimport;
|
||||
print img_picto($langs->trans("Download"), 'download', 'class="paddingleft opacitymedium"');
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1052,21 +1054,19 @@ if ($step == 4 && $datatoimport) {
|
||||
print '</td><td width="50%" class="nopaddingrightimp">';
|
||||
|
||||
// Set the list of all possible target fields in Dolibarr.
|
||||
$optionsnotused = "";
|
||||
$optionsall = array();
|
||||
foreach ($fieldstarget as $code => $line) {
|
||||
$text = '<option value="'.$code.'">';
|
||||
$text .= $langs->trans($line["label"]);
|
||||
if ($line["required"]) {
|
||||
$text .= "*";
|
||||
//var_dump($line);
|
||||
$labeltoshow = $langs->trans($line["label"]);
|
||||
$optionsall[$code] = array('label'=>$labeltoshow, 'required'=>(empty($line["required"]) ? 0 : 1), 'position'=>!empty($line['position']) ? $line['position'] : 0);
|
||||
// TODO Get type from an new array into module descriptor.
|
||||
//$picto = 'email';
|
||||
$picto = '';
|
||||
if ($picto) {
|
||||
$optionsall[$code]['picto'] = $picto;
|
||||
}
|
||||
$text .= '</option>';
|
||||
if (!$line["imported"]) {
|
||||
$optionsnotused .= $text;
|
||||
}
|
||||
$optionsall[$code] = array('label'=>$langs->trans($line["label"]), 'required'=>(empty($line["required"]) ? 0 : 1), 'position'=>!empty($line['position']) ? $line['position'] : 0);
|
||||
}
|
||||
// $optionsall is an array of all possible fields. key=>array('label'=>..., 'xxx')
|
||||
// $optionsall is an array of all possible target fields. key=>array('label'=>..., 'xxx')
|
||||
|
||||
$height = '32px'; //needs px for css height attribute below
|
||||
$i = 0;
|
||||
@ -1119,7 +1119,11 @@ if ($step == 4 && $datatoimport) {
|
||||
|
||||
$j = 0;
|
||||
foreach ($optionsall as $tmpcode => $tmpval) { // Loop on each entry to add into each combo list.
|
||||
$label = $tmpval['required'] ? '<strong>' : '';
|
||||
$label = '';
|
||||
if ($tmpval['picto']) {
|
||||
$label .= img_picto('', $tmpval['picto'], 'class="pictofixedwidth"');
|
||||
}
|
||||
$label .= $tmpval['required'] ? '<strong>' : '';
|
||||
$label .= $tmpval['label'];
|
||||
$label .= $tmpval['required'] ? '*</strong>' : '';
|
||||
|
||||
@ -1599,6 +1603,7 @@ if ($step == 5 && $datatoimport) {
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'&step=4'.$param.'" target="_blank" rel="noopener noreferrer">';
|
||||
print img_mime($file, '', 'pictofixedwidth');
|
||||
print $filetoimport;
|
||||
print img_picto($langs->trans("Download"), 'download', 'class="paddingleft opacitymedium"');
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1743,9 +1748,9 @@ if ($step == 5 && $datatoimport) {
|
||||
}
|
||||
//print $code.'-'.$label;
|
||||
$alias = preg_replace('/(\..*)$/i', '', $label);
|
||||
$listfields[$i] = $langs->trans("Field").' '.$code.'->'.$label;
|
||||
$listfields[$i] = $langs->trans("Column").' '.num2Alpha($code - 1).' -> '.$label;
|
||||
}
|
||||
print count($listfields) ? (join(', ', $listfields)) : $langs->trans("Error");
|
||||
print count($listfields) ? (join(', ', $listfields)) : $langs->trans("Error");
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -2349,20 +2354,6 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a numeric into an Excel like column number
|
||||
*
|
||||
* @param string $n Numeric value
|
||||
* @return string Column in Excel format
|
||||
*/
|
||||
function num2Alpha($n)
|
||||
{
|
||||
for ($r = ""; $n >= 0; $n = intval($n / 26) - 1)
|
||||
$r = chr($n%26 + 0x41) . $r;
|
||||
return $r;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return not used field number
|
||||
*
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD INDEX idx_stocktransfer_stocktransfer_rowid (rowid);
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD INDEX idx_stocktransfer_stocktransfer_ref (ref);
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD INDEX idx_stocktransfer_stocktransfer_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD INDEX idx_stocktransfer_stocktransfer_fk_project (fk_project);
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD CONSTRAINT llx_stocktransfer_stocktransfer_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer ADD INDEX idx_stocktransfer_stocktransfer_status (status);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
--ALTER TABLE llx_stocktransfer_stocktransfer ADD UNIQUE INDEX uk_stocktransfer_stocktransfer_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_stocktransfer_stocktransfer ADD CONSTRAINT llx_stocktransfer_stocktransfer_fk_field FOREIGN KEY (fk_field) REFERENCES llx_stocktransfer_myotherobject(rowid);
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_stocktransfer_stocktransfer(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
|
||||
label varchar(255),
|
||||
fk_soc integer,
|
||||
fk_project integer,
|
||||
fk_warehouse_source integer,
|
||||
fk_warehouse_destination integer,
|
||||
description text,
|
||||
note_public text,
|
||||
note_private text,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
date_creation datetime NOT NULL,
|
||||
date_prevue_depart date DEFAULT NULL,
|
||||
date_reelle_depart date DEFAULT NULL,
|
||||
date_prevue_arrivee date DEFAULT NULL,
|
||||
date_reelle_arrivee date DEFAULT NULL,
|
||||
lead_time_for_warning integer DEFAULT NULL,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14),
|
||||
model_pdf varchar(255),
|
||||
last_main_doc varchar(255),
|
||||
status smallint NOT NULL,
|
||||
fk_incoterms integer, -- for incoterms
|
||||
location_incoterms varchar(255)
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
@ -0,0 +1,19 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_stocktransfer_stocktransfer_extrafields ADD INDEX idx_fk_object(fk_object);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
@ -0,0 +1,23 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
create table llx_stocktransfer_stocktransfer_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_stocktransfer_stocktransferline ADD INDEX idx_stocktransfer_stocktransferline_rowid (rowid);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
--ALTER TABLE llx_stocktransfer_stocktransferline ADD UNIQUE INDEX uk_stocktransfer_stocktransferline_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_stocktransfer_stocktransferline ADD CONSTRAINT llx_stocktransfer_stocktransferline_fk_field FOREIGN KEY (fk_field) REFERENCES llx_stocktransfer_myotherobject(rowid);
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
CREATE TABLE llx_stocktransfer_stocktransferline(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
amount double DEFAULT NULL,
|
||||
qty real,
|
||||
fk_warehouse_source integer NOT NULL,
|
||||
fk_warehouse_destination integer NOT NULL,
|
||||
fk_stocktransfer integer NOT NULL,
|
||||
fk_product integer NOT NULL,
|
||||
batch varchar(128) DEFAULT NULL, -- Lot or serial number
|
||||
pmp double,
|
||||
rang integer DEFAULT 0,
|
||||
fk_parent_line integer NULL
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
@ -0,0 +1,19 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_stocktransfer_stocktransferline_extrafields ADD INDEX idx_fk_object(fk_object);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
@ -0,0 +1,23 @@
|
||||
-- Copyright (C) ---Put here your own copyright and developer email---
|
||||
-- Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
create table llx_stocktransfer_stocktransferline_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -1949,7 +1949,7 @@ EnterAnyCode=This field contains a reference to identify the line. Enter any val
|
||||
Enter0or1=Enter 0 or 1
|
||||
UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For example: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364]
|
||||
ColorFormat=The RGB color is in HEX format, eg: FF0000
|
||||
PictoHelp=Icon name in dolibarr format ('image.png' if into the current theme directory, 'image.png@nom_du_module' if into the directory /img/ of a module)
|
||||
PictoHelp=Icon name in format:<br>- image.png for an image file into the current theme directory<br>- image.png@module if file is into the directory /img/ of a module<br>- fa-xxx for a FontAwesome fa-xxx picto<br>- fonwtawesome_xxx_fa_color_size for a FontAwesome fa-xxx picto (with prefix, color and size set)
|
||||
PositionIntoComboList=Position of line into combo lists
|
||||
SellTaxRate=Sales tax rate
|
||||
RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases.
|
||||
@ -2262,3 +2262,4 @@ IconOnlyTextOnHover=Icon only - Text of icon appears under icon on mouse hover t
|
||||
IconOnly=Icon only - Text on tooltip only
|
||||
INVOICE_ADD_ZATCA_QR_CODE=Show the ZATCA QR code on invoices
|
||||
INVOICE_ADD_ZATCA_QR_CODEMore=Some Arabic countries need this QR Code on their invoices
|
||||
UrlSocialNetworksDesc=Url link of social network. Use {socialid} for the variable part that contains the social network ID.
|
||||
@ -163,14 +163,14 @@ ProfId5CL=-
|
||||
ProfId6CL=-
|
||||
ProfId1CM=Id. prof. 1 (Trade Register)
|
||||
ProfId2CM=Id. prof. 2 (Taxpayer No.)
|
||||
ProfId3CM=Id. prof. 3 (Decree of creation)
|
||||
ProfId4CM=Id. prof. 4 (Certificate of deposits)
|
||||
ProfId3CM=Id. prof. 3 (No. of creation decree)
|
||||
ProfId4CM=Id. prof. 4 (Deposit certificate No.)
|
||||
ProfId5CM=Id. prof. 5 (Others)
|
||||
ProfId6CM=-
|
||||
ProfId1ShortCM=Trade Register
|
||||
ProfId2ShortCM=Taxpayer No.
|
||||
ProfId3ShortCM=Decree of creation
|
||||
ProfId4ShortCM=Certificate of deposits
|
||||
ProfId3ShortCM=No. of creation decree
|
||||
ProfId4ShortCM=Deposit certificate No.
|
||||
ProfId5ShortCM=Others
|
||||
ProfId6ShortCM=-
|
||||
ProfId1CO=Prof Id 1 (R.U.T.)
|
||||
|
||||
@ -82,7 +82,7 @@ SelectFormat=Choose this import file format
|
||||
RunImportFile=Import Data
|
||||
NowClickToRunTheImport=Check the results of the import simulation. Correct any errors and re-test.<br>When the simulation reports no errors you may proceed to import the data into the database.
|
||||
DataLoadedWithId=The imported data will have an additional field in each database table with this import id: <b>%s</b>, to allow it to be searchable in the case of investigating a problem related to this import.
|
||||
ErrorMissingMandatoryValue=Mandatory data is empty in the source file for field <b>%s</b>.
|
||||
ErrorMissingMandatoryValue=Mandatory data is empty in the source file in column <b>%s</b>.
|
||||
TooMuchErrors=There are still <b>%s</b> other source lines with errors but output has been limited.
|
||||
TooMuchWarnings=There are still <b>%s</b> other source lines with warnings but output has been limited.
|
||||
EmptyLine=Empty line (will be discarded)
|
||||
@ -92,9 +92,9 @@ YouCanUseImportIdToFindRecord=You can find all the imported records in your data
|
||||
NbOfLinesOK=Number of lines with no errors and no warnings: <b>%s</b>.
|
||||
NbOfLinesImported=Number of lines successfully imported: <b>%s</b>.
|
||||
DataComeFromNoWhere=Value to insert comes from nowhere in source file.
|
||||
DataComeFromFileFieldNb=Value to insert comes from field number <b>%s</b> in source file.
|
||||
DataComeFromIdFoundFromRef=Value that comes from field number <b>%s</b> of source file will be used to find the id of the parent object to use (so the object <b>%s</b> that has the ref. from source file must exist in the database).
|
||||
DataComeFromIdFoundFromCodeId=Code that comes from field number <b>%s</b> of source file will be used to find the id of the parent object to use (so the code from source file must exist in the dictionary <b>%s</b>). Note that if you know the id, you can also use it in the source file instead of the code. Import should work in both cases.
|
||||
DataComeFromFileFieldNb=Value to insert comes from column <b>%s</b> in source file.
|
||||
DataComeFromIdFoundFromRef=Value that comes from column <b>%s</b> of source file will be used to find the id of the parent object to use (so the object <b>%s</b> that has the ref. from source file must exist in the database).
|
||||
DataComeFromIdFoundFromCodeId=Code that comes from column <b>%s</b> of source file will be used to find the id of the parent object to use (so the code from source file must exist in the dictionary <b>%s</b>). Note that if you know the id, you can also use it in the source file instead of the code. Import should work in both cases.
|
||||
DataIsInsertedInto=Data coming from source file will be inserted into the following field:
|
||||
DataIDSourceIsInsertedInto=The id of the parent object, that was found using the data in the source file, will be inserted into the following field:
|
||||
DataCodeIDSourceIsInsertedInto=The id of the parent line, that was found from code, will be inserted into the following field:
|
||||
|
||||
@ -1176,4 +1176,5 @@ CommercialsAffected=Sales representatives affected
|
||||
CommercialAffected=Sales representative affected
|
||||
YourMessage=Votre message
|
||||
YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible.
|
||||
UrlToCheck=Url to check
|
||||
UrlToCheck=Url to check
|
||||
Automation=Automation
|
||||
@ -271,4 +271,46 @@ ErrorCantFindCodeInInventory=Can't find the following code in inventory
|
||||
QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool.
|
||||
StockChangeDisabled=Change on stock disabled
|
||||
NoWarehouseDefinedForTerminal=No warehouse defined for terminal
|
||||
ClearQtys=Clear all quantities
|
||||
ClearQtys=Clear all quantities
|
||||
ModuleStockTransferName=Stocks Transfer
|
||||
ModuleStockTransferDesc=Creation of stocks transfer objects, with generation of transfer sheet
|
||||
StockTransferNew=New stocks transfer
|
||||
StockTransferList=Stocks transfers list
|
||||
ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with reference <STRONG>%s</STRONG> ?
|
||||
ConfirmDestock=Decrease of stocks with transfer %s
|
||||
ConfirmDestockCancel=Cancel decrease of stocks with transfer %s
|
||||
DestockAllProduct=Decrease of stocks
|
||||
DestockAllProductCancel=Cancel decrease of stocks
|
||||
ConfirmAddStock=Increase stocks with transfer %s
|
||||
ConfirmAddStockCancel=Cancel increase of stocks with transfer %s
|
||||
AddStockAllProduct=Increase of stocks
|
||||
AddStockAllProductCancel=Cancel increase of stocks
|
||||
DatePrevueDepart=Intended date of departure
|
||||
DateReelleDepart=Real date of departure
|
||||
DatePrevueArrivee=Intended date of arrival
|
||||
DateReelleArrivee=Real date of arrival
|
||||
HelpWarehouseStockTransferSource=If this warehouse is set, only itself and its children will be available as source warehouse
|
||||
HelpWarehouseStockTransferDestination=If this warehouse is set, only itself and its children will be available as destination warehouse
|
||||
LeadTimeForWarning=Lead time before alert (in days)
|
||||
TypeContact_stocktransfer_internal_STFROM=Sender of stocks transfer
|
||||
TypeContact_stocktransfer_internal_STDEST=Recipient of stocks transfer
|
||||
TypeContact_stocktransfer_internal_STRESP=Responsible of stocks transfer
|
||||
StockTransferSheet=Stocks transfer sheet
|
||||
StockTransferSheetProforma=Proforma stocks transfer sheet
|
||||
StockTransferDecrementation=Decrease source warehouses
|
||||
StockTransferIncrementation=Increase destination warehouses
|
||||
StockTransferDecrementationCancel=Cancel decrease of source warehouses
|
||||
StockTransferIncrementationCancel=Cancel increase of destination warehouses
|
||||
StockStransferDecremented=Source warehouses decreased
|
||||
StockStransferDecrementedCancel=Decrease of source warehouses canceled
|
||||
StockStransferIncremented=Closed - Stocks transfered
|
||||
StockStransferIncrementedShort=Stocks transfered
|
||||
StockStransferIncrementedShortCancel=Increase of destination warehouses canceled
|
||||
StockTransferNoBatchForProduct=Product %s doesn't use batch, clear batch on line and retry
|
||||
StockTransferSetup = Stocks Transfer module configuration
|
||||
Settings=Settings
|
||||
StockTransferSetupPage = Configuration page for stocks transfer module
|
||||
StockTransferRightRead=Read stocks transfers
|
||||
StockTransferRightCreateUpdate=Create/Update stocks transfers
|
||||
StockTransferRightDelete=Delete stocks transfers
|
||||
BatchNotFound=Lot / serial not found for this product
|
||||
|
||||
@ -271,4 +271,45 @@ ErrorCantFindCodeInInventory=Impossible de trouver le code suivant dans l'invent
|
||||
QtyWasAddedToTheScannedBarcode=Succès !! La quantité a été ajoutée à tous les codes-barres demandés. Vous pouvez fermer l'outil Scanner.
|
||||
StockChangeDisabled=Changement sur stock désactivé
|
||||
NoWarehouseDefinedForTerminal=Aucun entrepôt défini pour le terminal
|
||||
ModuleStockTransferName = Transferts de stocks
|
||||
ModuleStockTransferDesc = Création d'objets transfert de stocks, avec génération de bons de transfert
|
||||
StockTransferNew=Nouveau transfert de stocks
|
||||
StockTransferList=Liste des transferts de stocks
|
||||
ConfirmValidateStockTransfer=Êtes-vous sûr de vouloir valider ce transfert de stocks sous la référence <STRONG>%s</STRONG> ?
|
||||
ConfirmDestock=Décrémentation des stocks via transfert %s
|
||||
ConfirmDestockCancel=Annulation décrémentation des stocks via transfert %s
|
||||
DestockAllProduct=Décrémentation des stocks
|
||||
DestockAllProductCancel=Annulation décrémentation des stocks
|
||||
ConfirmAddStock=Incrémentation des stocks via transfert %s
|
||||
ConfirmAddStockCancel=Annulation incrémentation des stocks via transfert %s
|
||||
AddStockAllProduct=Incrémentation des stocks
|
||||
AddStockAllProductCancel=Annulation incrémentation des stocks
|
||||
DatePrevueDepart=Date prévue de départ
|
||||
DateReelleDepart=Date réelle de départ
|
||||
DatePrevueArrivee=Date prévue d'arrivée
|
||||
DateReelleArrivee=Date réelle d'arrivée
|
||||
HelpWarehouseStockTransferSource=Si renseigné, seul cet entrepôt source et ses enfants seront sélectionnables pour l'ajout des lignes
|
||||
HelpWarehouseStockTransferDestination=Si renseigné, seul cet entrepôt de destination et ses enfants seront sélectionnables pour l'ajout des lignes
|
||||
LeadTimeForWarning=Délai pour alerte (en jours)
|
||||
TypeContact_stocktransfer_internal_STFROM=Contact expéditeur transfert de stocks
|
||||
TypeContact_stocktransfer_internal_STDEST=Contact destinataire transfert de stocks
|
||||
TypeContact_stocktransfer_internal_STRESP=Responsable du transfert de stocks
|
||||
StockTransferSheet=Bon de transfert
|
||||
StockTransferSheetProforma=Bon de transfert proforma
|
||||
StockTransferDecrementation=Décrémenter les entrepôts sources
|
||||
StockTransferIncrementation=Incrémenter les entrepôts de destination
|
||||
StockTransferDecrementationCancel=Annuler décrémentation des entrepôts sources
|
||||
StockTransferIncrementationCancel=Annuler incrémentation des entrepôts de destination
|
||||
StockStransferDecremented=Entrepôts sources décrémentés
|
||||
StockStransferDecrementedCancel=Décrémentation entrepôts source annulée
|
||||
StockStransferIncremented=Clôturé - Stocks transférés
|
||||
StockStransferIncrementedShort=Stocks transférés
|
||||
StockStransferIncrementedShortCancel=Incrémentation entrepôts de destination annulée
|
||||
StockTransferNoBatchForProduct=Le produit %s ne gère pas les numéros de lot, retirez le lot sur la ligne avant d'exécuter à nouveau cette action
|
||||
StockTransferSetup = Configuration du module transferts de stocks
|
||||
StockTransferSetupPage = Page de configuration du module transferts de stocks
|
||||
StockTransferRightRead=Lire les transferts de stocks
|
||||
StockTransferRightCreateUpdate=Créer/Mettre à jour les transferts de stocks
|
||||
StockTransferRightDelete=Supprimer les transferts de stocks
|
||||
BatchNotFound=Lot / série non trouvé(e) pour ce produit
|
||||
ClearQtys=Effacer toutes les quantités
|
||||
|
||||
@ -24,7 +24,8 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
|
||||
// CHANGE THIS: Set to 1 if selector is available for admin users only
|
||||
public $require_admin = 0;
|
||||
|
||||
public $enabled = 0;
|
||||
public $enabled = '$conf->mymodule->enabled';
|
||||
|
||||
public $require_module = array();
|
||||
|
||||
/**
|
||||
|
||||
@ -477,7 +477,7 @@ $arrayofmassactions = array(
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($permissiontodelete) {
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
@ -500,8 +500,8 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
@ -674,6 +674,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
|
||||
@ -4896,14 +4896,14 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
if ($this->status) {
|
||||
if ($this->status && isset($this->accountancy_code_sell)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$label .= '<br>';
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellCode').':</b> '.length_accountg($this->accountancy_code_sell);
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellIntraCode').':</b> '.length_accountg($this->accountancy_code_sell_intra);
|
||||
$label .= '<br><b>'.$langs->trans('ProductAccountancySellExportCode').':</b> '.length_accountg($this->accountancy_code_sell_export);
|
||||
}
|
||||
if ($this->status_buy) {
|
||||
if ($this->status_buy && isset($this->accountancy_code_buy)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
if (empty($this->status)) {
|
||||
$label .= '<br>';
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
@ -144,9 +144,10 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
$product_fourn = new ProductFournisseur($db);
|
||||
$productstatic = new Product($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// action recherche des produits par mot-cle et/ou par categorie
|
||||
if ($action == 'search') {
|
||||
@ -201,8 +202,10 @@ if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$head = product_prepare_head($object);
|
||||
|
||||
$titre = $langs->trans("CardProduct".$object->type);
|
||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
||||
|
||||
print dol_get_fiche_head($head, 'subproduct', $titre, -1, $picto);
|
||||
|
||||
|
||||
@ -218,10 +221,11 @@ if ($id > 0 || !empty($ref)) {
|
||||
$shownav = 0;
|
||||
}
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '', '', '', 0, '', '', 0);
|
||||
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', '');
|
||||
|
||||
if ($object->type != Product::TYPE_SERVICE || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
@ -229,23 +233,33 @@ if ($id > 0 || !empty($ref)) {
|
||||
// Type
|
||||
if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
|
||||
$typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Nature
|
||||
if ($object->type != Product::TYPE_SERVICE) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Nature").'</td><td>';
|
||||
print $object->getLibFinished();
|
||||
print '</td></tr>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||
print $object->getLibFinished();
|
||||
//print $formproduct->selectProductNature('finished', $object->finished);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
// Price
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("SellingPrice").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("SellingPrice").'</td><td>';
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
|
||||
} else {
|
||||
@ -265,16 +279,13 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
|
||||
$prodsfather = $object->getFather(); // Parent Products
|
||||
$object->get_sousproduits_arbo(); // Load $object->sousprods
|
||||
@ -552,7 +563,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
|
||||
print '</tr>'."\n";
|
||||
} else {
|
||||
$colspan = 8;
|
||||
$colspan = 10;
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
$colspan++;
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ restrictedArea($user, 'produit|service', 0, 'product&product', '', '');
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$tmpproduct = new Product($db);
|
||||
|
||||
$helpurl = '';
|
||||
if ($type == '0') {
|
||||
@ -124,7 +125,7 @@ $infoprod = array();
|
||||
|
||||
|
||||
// Add lines for object
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, SUM(pd.qty) as c";
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, p.tobuy, p.tosell, p.tobatch, p.barcode, SUM(pd.qty) as c";
|
||||
$textforqty = 'Qty';
|
||||
if ($mode == 'facture') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as pd";
|
||||
@ -141,7 +142,7 @@ $sql .= " AND p.rowid = pd.fk_product";
|
||||
if ($type !== '') {
|
||||
$sql .= " AND fk_product_type = ".((int) $type);
|
||||
}
|
||||
$sql .= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type";
|
||||
$sql .= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type, p.tobuy, p.tosell, p.tobatch, p.barcode";
|
||||
|
||||
$num = 0;
|
||||
$totalnboflines = 0;
|
||||
@ -163,7 +164,7 @@ if (!empty($mode) && $mode != '-1') {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$infoprod[$objp->rowid] = array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label);
|
||||
$infoprod[$objp->rowid] = array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label, 'tobuy'=>$objp->tobuy, 'tosell'=>$objp->tobuy, 'tobatch'=>$objp->tobatch, 'barcode'=>$objp->barcode);
|
||||
$infoprod[$objp->rowid]['nbline'] = $objp->c;
|
||||
|
||||
$i++;
|
||||
@ -181,7 +182,7 @@ $arrayofmode = array(
|
||||
'commande' => 'Orders',
|
||||
'facture' => 'Facture'
|
||||
);
|
||||
$title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1);
|
||||
$title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1, 0, 0, '', 1);
|
||||
$title .= ' <input type="submit" class="button small" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
|
||||
|
||||
@ -228,23 +229,28 @@ if ($mode && $mode != '-1') {
|
||||
}
|
||||
}
|
||||
|
||||
$tmpproduct->ref = $vals['ref'];
|
||||
$tmpproduct->label = $vals['label'];
|
||||
$tmpproduct->type = $vals['type'];
|
||||
$tmpproduct->status = $vals['tosell'];
|
||||
$tmpproduct->status_buy = $vals['tobuy'];
|
||||
$tmpproduct->status_batch = $vals['tobatch'];
|
||||
$tmpproduct->barcode = $vals['barcode'];
|
||||
|
||||
print "<tr>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/card.php?id='.$prodid.'">';
|
||||
if ($vals['type'] == 1) {
|
||||
print img_object($langs->trans("ShowService"), "service");
|
||||
} else {
|
||||
print img_object($langs->trans("ShowProduct"), "product");
|
||||
}
|
||||
print " ";
|
||||
print $vals['ref'].'</a></td>';
|
||||
print '<td>';
|
||||
if ($vals['type'] == 1) {
|
||||
print $langs->trans("Service");
|
||||
} else {
|
||||
print $langs->trans("Product");
|
||||
}
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td>'.$vals['label'].'</td>';
|
||||
print '<td>';
|
||||
$s = '';
|
||||
if ($vals['type'] == 1) {
|
||||
$s .= img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"');
|
||||
} else {
|
||||
$s .= img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"');
|
||||
}
|
||||
print $s;
|
||||
print '</td>';
|
||||
print '<td>'.dol_escape_htmltag($vals['label']).'</td>';
|
||||
print '<td class="right">'.$vals['nbline'].'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
@ -33,11 +33,18 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('products', 'stocks', 'productbatch'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
|
||||
$sref = GETPOST("sref", 'alpha');
|
||||
$snom = GETPOST("snom", 'alpha');
|
||||
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
@ -52,25 +59,21 @@ $fourn_id = GETPOST("fourn_id", 'int');
|
||||
$sbarcode = GETPOST("sbarcode", 'int');
|
||||
$search_stock_physique = GETPOST('search_stock_physique', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "p.ref";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
$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;
|
||||
|
||||
// Load sale and categ filters
|
||||
// Initialize array of search criterias
|
||||
$object = new Product($db);
|
||||
$search_sale = GETPOST("search_sale");
|
||||
if (GETPOSTISSET('catid')) {
|
||||
$search_categ = GETPOST('catid', 'int');
|
||||
@ -78,6 +81,40 @@ if (GETPOSTISSET('catid')) {
|
||||
$search_categ = GETPOST('search_categ', 'int');
|
||||
}
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) {
|
||||
reset($object->fields); // Reset is required to avoid key() to return null.
|
||||
$sortfield = "p.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
}
|
||||
}
|
||||
$key = 'sellby';
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
$key = 'eatby';
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
|
||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||
$canvas = GETPOST("canvas");
|
||||
$objcanvas = null;
|
||||
@ -98,21 +135,66 @@ $result = restrictedArea($user, 'produit|service', 0, 'product&product');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$sref = "";
|
||||
$snom = "";
|
||||
$sall = "";
|
||||
$tosell = "";
|
||||
$tobuy = "";
|
||||
$search_sale = "";
|
||||
$search_categ = "";
|
||||
$toolowstock = '';
|
||||
$search_batch = '';
|
||||
$search_warehouse = '';
|
||||
$fourn_id = '';
|
||||
$sbarcode = '';
|
||||
$search_stock_physique = '';
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$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 (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = '';
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$search['sellby_dtstart'] = '';
|
||||
$search['eatby_dtstart'] = '';
|
||||
$search['sellby_dtend'] = '';
|
||||
$search['eatby_dtend'] = '';
|
||||
$sref = "";
|
||||
$snom = "";
|
||||
$sall = "";
|
||||
$tosell = "";
|
||||
$tobuy = "";
|
||||
$search_sale = "";
|
||||
$search_categ = "";
|
||||
$toolowstock = '';
|
||||
$search_batch = '';
|
||||
$search_warehouse = '';
|
||||
$fourn_id = '';
|
||||
$sbarcode = '';
|
||||
$search_stock_physique = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
/*$objectclass = 'MyObject';
|
||||
$objectlabel = 'MyObject';
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -122,8 +204,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
|
||||
$sql .= ' p.fk_product_type, p.tms as datem,';
|
||||
@ -193,6 +279,37 @@ if ($search_warehouse) {
|
||||
if ($search_batch) {
|
||||
$sql .= natural_search("pb.batch", $search_batch);
|
||||
}
|
||||
|
||||
foreach ($search as $key => $val) {
|
||||
if (array_key_exists($key, $object->fields)) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
|
||||
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if ($columnName == 'eatby' || $columnName == 'sellby') {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND pl.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND pl.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
|
||||
$sql .= " p.fk_product_type, p.tms,";
|
||||
$sql .= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,";
|
||||
@ -217,317 +334,386 @@ if ($search_stock_physique != '') {
|
||||
if (!empty($sql_having)) {
|
||||
$sql .= $sql_having;
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
//print $sql;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num == 1 && GETPOST('autojumpifoneonly') && ($sall or $snom or $sref)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
header("Location: card.php?id=$objp->rowid");
|
||||
exit;
|
||||
}
|
||||
$i = 0;
|
||||
|
||||
if (isset($type)) {
|
||||
if ($type == 1) {
|
||||
$texte = $langs->trans("Services");
|
||||
} else {
|
||||
$texte = $langs->trans("Products");
|
||||
}
|
||||
if ($num == 1 && GETPOST('autojumpifoneonly') && ($sall or $snom or $sref)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
header("Location: card.php?id=$objp->rowid");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($type)) {
|
||||
if ($type == 1) {
|
||||
$texte = $langs->trans("Services");
|
||||
} else {
|
||||
$texte = $langs->trans("ProductsAndServices");
|
||||
$texte = $langs->trans("Products");
|
||||
}
|
||||
$texte .= ' ('.$langs->trans("StocksByLotSerial").')';
|
||||
} else {
|
||||
$texte = $langs->trans("ProductsAndServices");
|
||||
}
|
||||
$texte .= ' ('.$langs->trans("StocksByLotSerial").')';
|
||||
|
||||
$param = '';
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($sall) {
|
||||
$param .= "&sall=".urlencode($sall);
|
||||
}
|
||||
if ($tosell) {
|
||||
$param .= "&tosell=".urlencode($tosell);
|
||||
}
|
||||
if ($tobuy) {
|
||||
$param .= "&tobuy=".urlencode($tobuy);
|
||||
}
|
||||
if ($type != '') {
|
||||
$param .= "&type=".urlencode($type);
|
||||
}
|
||||
if ($fourn_id) {
|
||||
$param .= "&fourn_id=".urlencode($fourn_id);
|
||||
}
|
||||
if ($snom) {
|
||||
$param .= "&snom=".urlencode($snom);
|
||||
}
|
||||
if ($sref) {
|
||||
$param .= "&sref=".urlencode($sref);
|
||||
}
|
||||
if ($search_batch) {
|
||||
$param .= "&search_batch=".urlencode($search_batch);
|
||||
}
|
||||
if ($sbarcode) {
|
||||
$param .= "&sbarcode=".urlencode($sbarcode);
|
||||
}
|
||||
if ($search_warehouse) {
|
||||
$param .= "&search_warehouse=".urlencode($search_warehouse);
|
||||
}
|
||||
if ($toolowstock) {
|
||||
$param .= "&toolowstock=".urlencode($toolowstock);
|
||||
}
|
||||
if ($search_sale) {
|
||||
$param .= "&search_sale=".urlencode($search_sale);
|
||||
}
|
||||
if (!empty($search_categ) && $search_categ != '-1') {
|
||||
$param .= "&search_categ=".urlencode($search_categ);
|
||||
}
|
||||
if ($search_stock_physique) {
|
||||
$param .= '&search_stock_physique=' . urlencode($search_stock_physique);
|
||||
}
|
||||
/*if ($eatby) $param.="&eatby=".$eatby;
|
||||
if ($sellby) $param.="&sellby=".$sellby;*/
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($sall) {
|
||||
$param .= "&sall=".urlencode($sall);
|
||||
}
|
||||
if ($tosell) {
|
||||
$param .= "&tosell=".urlencode($tosell);
|
||||
}
|
||||
if ($tobuy) {
|
||||
$param .= "&tobuy=".urlencode($tobuy);
|
||||
}
|
||||
if ($type != '') {
|
||||
$param .= "&type=".urlencode($type);
|
||||
}
|
||||
if ($fourn_id) {
|
||||
$param .= "&fourn_id=".urlencode($fourn_id);
|
||||
}
|
||||
if ($snom) {
|
||||
$param .= "&snom=".urlencode($snom);
|
||||
}
|
||||
if ($sref) {
|
||||
$param .= "&sref=".urlencode($sref);
|
||||
}
|
||||
if ($search_batch) {
|
||||
$param .= "&search_batch=".urlencode($search_batch);
|
||||
}
|
||||
if ($sbarcode) {
|
||||
$param .= "&sbarcode=".urlencode($sbarcode);
|
||||
}
|
||||
if ($search_warehouse) {
|
||||
$param .= "&search_warehouse=".urlencode($search_warehouse);
|
||||
}
|
||||
if ($toolowstock) {
|
||||
$param .= "&toolowstock=".urlencode($toolowstock);
|
||||
}
|
||||
if ($search_sale) {
|
||||
$param .= "&search_sale=".urlencode($search_sale);
|
||||
}
|
||||
if (!empty($search_categ) && $search_categ != '-1') {
|
||||
$param .= "&search_categ=".urlencode($search_categ);
|
||||
}
|
||||
if ($search_stock_physique) {
|
||||
$param .= '&search_stock_physique=' . urlencode($search_stock_physique);
|
||||
}
|
||||
/*if ($eatby) $param.="&eatby=".$eatby;
|
||||
if ($sellby) $param.="&sellby=".$sellby;*/
|
||||
|
||||
llxHeader("", $title, $helpurl, $texte);
|
||||
llxHeader("", $title, $helpurl, $texte);
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<form id="searchFormList" action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">'."\n";
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'product', 0, '', '', $limit, 0, 0, 1);
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'product', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
|
||||
if ($search_categ > 0) {
|
||||
print "<div id='ways'>";
|
||||
$c = new Categorie($db);
|
||||
$c->fetch($search_categ);
|
||||
$ways = $c->print_all_ways(' > ', 'product/reassortlot.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
}
|
||||
if ($search_categ > 0) {
|
||||
print "<div id='ways'>";
|
||||
$c = new Categorie($db);
|
||||
$c->fetch($search_categ);
|
||||
$ways = $c->print_all_ways(' > ', 'product/reassortlot.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
|
||||
$moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
//$moreforfilter.=$langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock?' checked':'').'>';
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
|
||||
$moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
//$moreforfilter.=$langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock?' checked':'').'>';
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sref" size="6" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="snom" size="8" value="'.$snom.'">';
|
||||
print '</td>';
|
||||
if (!empty($conf->service->enabled) && $type == 1) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="sref" size="6" value="'.$sref.'">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="snom" size="8" value="'.$snom.'">';
|
||||
}
|
||||
print '<td class="liste_titre"><input class="flat" type="text" name="search_warehouse" size="6" value="'.$search_warehouse.'"></td>';
|
||||
print '<td class="liste_titre center"><input class="flat" type="text" name="search_batch" size="6" value="'.$search_batch.'"></td>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td class="liste_titre center">';
|
||||
$key = 'sellby';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
if (!empty($conf->service->enabled) && $type == 1) {
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre"><input class="flat" type="text" name="search_warehouse" size="6" value="'.$search_warehouse.'"></td>';
|
||||
print '<td class="liste_titre center"><input class="flat" type="text" name="search_batch" size="6" value="'.$search_batch.'"></td>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
// Physical stock
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).'">';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td class="liste_titre center">';
|
||||
$key = 'eatby';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
// Physical stock
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Action column
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//Line for column titles
|
||||
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->service->enabled) && $type == 1) {
|
||||
print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", '', $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right );
|
||||
print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", '', $param, "", $sortfield, $sortorder, 'right ');
|
||||
// TODO Add info of running suppliers/customers orders
|
||||
//print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right ');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$product_static = new Product($db);
|
||||
$product_lot_static = new Productlot($db);
|
||||
$warehousetmp = new Entrepot($db);
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active
|
||||
$sql = "SELECT label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql .= " WHERE fk_product = ".((int) $objp->rowid);
|
||||
$sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$objtp = $db->fetch_object($result);
|
||||
if (!empty($objtp->label)) {
|
||||
$objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->label = $objp->label;
|
||||
$product_static->type = $objp->fk_product_type;
|
||||
$product_static->entity = $objp->entity;
|
||||
$product_static->status = $objp->tosell;
|
||||
$product_static->status_buy = $objp->tobuy;
|
||||
$product_static->status_batch = $objp->tobatch;
|
||||
|
||||
$product_lot_static->batch = $objp->batch;
|
||||
$product_lot_static->product_id = $objp->rowid;
|
||||
$product_lot_static->id = $objp->lotid;
|
||||
$product_lot_static->eatby = $objp->eatby;
|
||||
$product_lot_static->sellby = $objp->sellby;
|
||||
|
||||
|
||||
$warehousetmp->id = $objp->fk_entrepot;
|
||||
$warehousetmp->ref = $objp->warehouse_ref;
|
||||
$warehousetmp->label = $objp->warehouse_ref;
|
||||
$warehousetmp->fk_parent = $objp->warehouse_parent;
|
||||
|
||||
print '<tr>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap">';
|
||||
print $product_static->getNomUrl(1, '', 16);
|
||||
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
|
||||
if (!empty($conf->service->enabled) && $type == 1) {
|
||||
print '<td class="center">';
|
||||
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationYear");
|
||||
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationDay");
|
||||
} else {
|
||||
print $objp->duration;
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
//print '<td class="right">'.$objp->stock_theorique.'</td>';
|
||||
//print '<td class="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||
//print '<td class="right">'.$objp->desiredstock.'</td>';
|
||||
|
||||
// Warehouse
|
||||
print '<td class="nowrap">';
|
||||
if ($objp->fk_entrepot > 0) {
|
||||
print $warehousetmp->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Lot
|
||||
print '<td class="center nowrap">';
|
||||
if ($product_lot_static->batch) {
|
||||
print $product_lot_static->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">';
|
||||
//if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $objp->stock_physique;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"');
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$product_static->id.'&search_warehouse='.$objp->fk_entrepot.'&search_batch='.($objp->batch != 'Undefined' ? $objp->batch : 'Undefined').'">'.$langs->trans("Movements").'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowrap">'.$product_static->LibStatut($objp->statut, 5, 0).'</td>';
|
||||
|
||||
print '<td class="right nowrap">'.$product_static->LibStatut($objp->tobuy, 5, 1).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
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->service->enabled) && $type == 1) {
|
||||
print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", '', $param, "", $sortfield, $sortorder);
|
||||
//print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right );
|
||||
print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pl.sellby", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pl.eatby", '', $param, "", $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", '', $param, "", $sortfield, $sortorder, 'right ');
|
||||
// TODO Add info of running suppliers/customers orders
|
||||
//print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right ');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
$product_static = new Product($db);
|
||||
$product_lot_static = new Productlot($db);
|
||||
$warehousetmp = new Entrepot($db);
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active
|
||||
// TODO Use a cache
|
||||
$sql = "SELECT label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql .= " WHERE fk_product = ".((int) $objp->rowid);
|
||||
$sql .= " AND lang = '".$db->escape($langs->getDefaultLang())."'";
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$objtp = $db->fetch_object($result);
|
||||
if (!empty($objtp->label)) {
|
||||
$objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->label = $objp->label;
|
||||
$product_static->type = $objp->fk_product_type;
|
||||
$product_static->entity = $objp->entity;
|
||||
$product_static->status = $objp->tosell;
|
||||
$product_static->status_buy = $objp->tobuy;
|
||||
$product_static->status_batch = $objp->tobatch;
|
||||
|
||||
$product_lot_static->batch = $objp->batch;
|
||||
$product_lot_static->product_id = $objp->rowid;
|
||||
$product_lot_static->id = $objp->lotid;
|
||||
$product_lot_static->eatby = $objp->eatby;
|
||||
$product_lot_static->sellby = $objp->sellby;
|
||||
|
||||
|
||||
$warehousetmp->id = $objp->fk_entrepot;
|
||||
$warehousetmp->ref = $objp->warehouse_ref;
|
||||
$warehousetmp->label = $objp->warehouse_ref;
|
||||
$warehousetmp->fk_parent = $objp->warehouse_parent;
|
||||
|
||||
print '<tr>';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap">';
|
||||
print $product_static->getNomUrl(1, '', 16);
|
||||
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
|
||||
print '</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
|
||||
if (!empty($conf->service->enabled) && $type == 1) {
|
||||
print '<td class="center">';
|
||||
if (preg_match('/([0-9]+)y/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationYear");
|
||||
} elseif (preg_match('/([0-9]+)m/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationMonth");
|
||||
} elseif (preg_match('/([0-9]+)d/i', $objp->duration, $regs)) {
|
||||
print $regs[1].' '.$langs->trans("DurationDay");
|
||||
} else {
|
||||
print $objp->duration;
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
//print '<td class="right">'.$objp->stock_theorique.'</td>';
|
||||
//print '<td class="right">'.$objp->seuil_stock_alerte.'</td>';
|
||||
//print '<td class="right">'.$objp->desiredstock.'</td>';
|
||||
|
||||
// Warehouse
|
||||
print '<td class="nowrap">';
|
||||
if ($objp->fk_entrepot > 0) {
|
||||
print $warehousetmp->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Lot
|
||||
print '<td class="center nowrap">';
|
||||
if ($product_lot_static->batch) {
|
||||
print $product_lot_static->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
|
||||
}
|
||||
|
||||
print '<td class="right">';
|
||||
//if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' ';
|
||||
print $objp->stock_physique;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right">';
|
||||
print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"');
|
||||
print '<a href="'.DOL_URL_ROOT.'/product/stock/movement_list.php?idproduct='.$product_static->id.'&search_warehouse='.$objp->fk_entrepot.'&search_batch='.($objp->batch != 'Undefined' ? $objp->batch : 'Undefined').'">'.$langs->trans("Movements").'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nowrap">'.$product_static->LibStatut($objp->statut, 5, 0).'</td>';
|
||||
|
||||
print '<td class="right nowrap">'.$product_static->LibStatut($objp->tobuy, 5, 1).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -55,9 +55,10 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -76,7 +77,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) {
|
||||
$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
$sortfield = "t.fk_product,t.batch"; // Set here default search field. By default 1st field in definition.
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
@ -89,6 +90,10 @@ foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -104,12 +109,13 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$visible = dol_eval($val['visible'], 1, 1, '1');
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'position'=>$val['position']
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -147,7 +153,8 @@ if (!$permissiontoread) accessforbidden();
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
$action = 'list';
|
||||
$massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
@ -167,6 +174,10 @@ if (empty($reshook)) {
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = '';
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
@ -185,7 +196,7 @@ if (empty($reshook)) {
|
||||
|
||||
|
||||
/*
|
||||
* VIEW
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
@ -194,20 +205,19 @@ $form = new Form($db);
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_Lot_/_Serial|FR:Module_Lot_/_Série';
|
||||
|
||||
$title = $langs->trans('LotSerialList');
|
||||
$morejs = array();
|
||||
$morecss = array();
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= "t.".$key.", ";
|
||||
}
|
||||
$sql .= $object->getFieldList('t');
|
||||
// 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.', ' : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
@ -216,9 +226,13 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if ( !empty($extrafields->attributes[$object->table_element]['label']) && ($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && 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 (t.rowid = ef.fk_object)";
|
||||
}
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
} else {
|
||||
@ -237,17 +251,17 @@ foreach ($search as $key => $val) {
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
} else {
|
||||
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
|
||||
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
|
||||
if (preg_match('/_dtstart$/', $key)) {
|
||||
$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
|
||||
$sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
if (preg_match('/_dtend$/', $key)) {
|
||||
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
|
||||
$sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,21 +279,22 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql .= "t.".$key.", ";
|
||||
}
|
||||
// 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.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val) {
|
||||
$sql .= "t.".$db->escape($key).", ";
|
||||
}
|
||||
// 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.', ' : '');
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -290,14 +305,23 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
*/
|
||||
/* The slow method does not consume memory on mysql (not tested on pgsql) */
|
||||
/*$resql = $db->query($sql, 0, 'auto', 1);
|
||||
while ($db->fetch_object($resql)) {
|
||||
$nbtotalofrecords++;
|
||||
}*/
|
||||
while ($db->fetch_object($resql)) {
|
||||
if (empty($nbtotalofrecords)) {
|
||||
$nbtotalofrecords = 1; // We can't make +1 because init value is ''
|
||||
} else {
|
||||
$nbtotalofrecords++;
|
||||
}
|
||||
}*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-z0-9\._\s\(\),]+FROM/i', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
@ -319,6 +343,7 @@ if (!$resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$i = 0;
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
@ -332,11 +357,14 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
@ -346,9 +374,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} elseif ($search[$key] != '') {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
@ -357,6 +387,10 @@ if ($optioncss != '') {
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
@ -382,8 +416,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
//print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/product/stock/productlot_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
@ -397,12 +432,16 @@ $trackid = 'lot'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
/*$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||
@ -419,21 +458,32 @@ if (empty($reshook)) {
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$searchkey = empty($search[$key]) ? '' : $search[$key];
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
@ -441,17 +491,28 @@ foreach ($object->fields as $key => $val) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, !empty($search[$key])?$search[$key]:0, '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(!empty($search[$key])?$search[$key]:'').'">';
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
|
||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
} elseif ($key == 'lang') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
$formadmin = new FormAdmin($db);
|
||||
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
|
||||
} else {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -463,46 +524,61 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
/*if (!empty($arrayfields['anotherfield']['checked'])) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}*/
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
$totalarray['nbfield']++;
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
$needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
@ -514,9 +590,10 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray['nbfield'] = 0;
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
@ -526,9 +603,22 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
@ -541,17 +631,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status'))) {
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield)) {
|
||||
print ' title="'.dol_escape_htmltag($object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'rowid') {
|
||||
print $object->id;
|
||||
print $object->showOutputField($val, $key, $object->id, '');
|
||||
} else {
|
||||
if ($key == 'batch') {
|
||||
print $object->getNomUrl(1);
|
||||
@ -584,15 +678,17 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// 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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -613,14 +709,14 @@ if ($num == 0) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
1067
htdocs/product/stock/stocktransfer/class/stocktransfer.class.php
Normal file
1067
htdocs/product/stock/stocktransfer/class/stocktransfer.class.php
Normal file
File diff suppressed because it is too large
Load Diff
1091
htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
Normal file
1091
htdocs/product/stock/stocktransfer/class/stocktransferline.class.php
Normal file
File diff suppressed because it is too large
Load Diff
67
htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php
Normal file
67
htdocs/product/stock/stocktransfer/lib/stocktransfer.lib.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/* Copyright (C) 2021 SuperAdmin
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer/lib/stocktransfer.lib.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Library files with common functions for StockTransfer
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare admin pages header
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function stocktransferAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load("stocks");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/admin/stocktransfer.php", 1);
|
||||
$head[$h][1] = $langs->trans("Settings");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/stocktransfer/admin/myobject_extrafields.php", 1);
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'myobject_extrafields';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
/*$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/admin/about.php", 1);
|
||||
$head[$h][1] = $langs->trans("About");
|
||||
$head[$h][2] = 'about';
|
||||
$h++;*/
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
//$this->tabs = array(
|
||||
// 'entity:+tabname:Title:@stocktransfer:/stocktransfer/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@stocktransfer:/stocktransfer/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'stocktransfer');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file lib/stocktransfer_stocktransfer.lib.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Library files with common functions for StockTransfer
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array of tabs for StockTransfer
|
||||
*
|
||||
* @param StockTransfer $object StockTransfer
|
||||
* @return array Array of tabs
|
||||
*/
|
||||
function stocktransferPrepareHead($object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$langs->load("stocks");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_card.php", 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_contact.php', 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) $nbNote++;
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_note.php', 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->stocktransfer->dir_output."/stocktransfer/".dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_document.php", 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_agenda.php", 1).'?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Events");
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
//$this->tabs = array(
|
||||
// 'entity:+tabname:Title:@stocktransfer:/stocktransfer/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@stocktransfer:/stocktransfer/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'stocktransfer@stocktransfer');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'stocktransfer@stocktransfer', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
247
htdocs/product/stock/stocktransfer/stocktransfer_agenda.php
Normal file
247
htdocs/product/stock/stocktransfer/stocktransfer_agenda.php
Normal file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer_agenda.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Page of StockTransfer events
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("stocks", "other"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
} else {
|
||||
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
$search_agenda_label = GETPOST('search_agenda_label');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
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 (!$sortfield) $sortfield = 'a.datep,a.id';
|
||||
if (!$sortorder) $sortorder = 'DESC,DESC';
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new StockTransfer($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('stocktransferagenda', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer');
|
||||
|
||||
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id'=>$id);
|
||||
$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 (empty($reshook)) {
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$actioncode = '';
|
||||
$search_agenda_label = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($object->id > 0) {
|
||||
$title = $langs->trans("Agenda");
|
||||
//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (!empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = stocktransferPrepareHead($object);
|
||||
|
||||
|
||||
dol_fiche_head($head, 'agenda', $langs->trans("StockTransfer"), -1, $object->picto);
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/stocktransfer/stocktransfer_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ': '.$proj->getNomUrl();
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
$object->info($object->id);
|
||||
dol_print_object_info($object, 1);
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Actions buttons
|
||||
|
||||
$objthirdparty = $object;
|
||||
$objcon = new stdClass();
|
||||
|
||||
$out = '&origin='.$object->element.'&originid='.$object->id;
|
||||
$permok = $user->rights->agenda->myactions->create;
|
||||
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') $out .= '&socid='.$objthirdparty->id;
|
||||
$out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1';
|
||||
//$out.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
//$out.="</a>";
|
||||
}
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
|
||||
$param = '&id='.$object->id.'&socid='.$socid;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
|
||||
|
||||
//print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', '');
|
||||
|
||||
// List of all actions
|
||||
$filters = array();
|
||||
$filters['search_agenda_label'] = $search_agenda_label;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, '');
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
1098
htdocs/product/stock/stocktransfer/stocktransfer_card.php
Normal file
1098
htdocs/product/stock/stocktransfer/stocktransfer_card.php
Normal file
File diff suppressed because it is too large
Load Diff
194
htdocs/product/stock/stocktransfer/stocktransfer_contact.php
Normal file
194
htdocs/product/stock/stocktransfer/stocktransfer_contact.php
Normal file
@ -0,0 +1,194 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||
* Copyright (C) 2005-2016 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/propal/contact.php
|
||||
* \ingroup propal
|
||||
* \brief Tab to manage contacts/adresses of proposal
|
||||
*/
|
||||
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('facture', 'orders', 'sendings', 'companies', 'stocks'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
|
||||
$result = restrictedArea($user, 'stocktransfer', $id, '', 'stocktransfer');
|
||||
|
||||
$object = new StockTransfer($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret == 0) {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
|
||||
$error++;
|
||||
} elseif ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$object->fetch_thirdparty();
|
||||
} else {
|
||||
header('Location: '.dol_buildpath('/stocktransfer/stocktransfer_list.php', 1));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add a new contact
|
||||
*/
|
||||
|
||||
if ($action == 'addcontact' && $user->rights->stocktransfer->stocktransfer->write) {
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
||||
$result = $object->add_contact($contactid, !empty($_POST["typecontact"]) ? $_POST["typecontact"] : $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
} else {
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'swapstatut' && $user->rights->stocktransfer->stocktransfer->write) { // Toggle the status of a contact
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
} elseif ($action == 'deletecontact' && $user->rights->stocktransfer->stocktransfer->write) { // Deletes a contact
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
/*
|
||||
elseif ($action == 'setaddress' && $user->rights->stocktransfer->stocktransfer->write)
|
||||
{
|
||||
$result=$object->setDeliveryAddress($_POST['fk_address']);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans('ModuleStockTransferName'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
if ($object->id > 0) {
|
||||
$head = stocktransferPrepareHead($object);
|
||||
dol_fiche_head($head, 'contact', $langs->trans("StockTransfer"), -1, 'stock');
|
||||
|
||||
|
||||
// Proposal card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
if (!empty($object->thirdparty)) {
|
||||
$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
|
||||
}
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->stocktransfer->stocktransfer->write) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$user->rights->stocktransfer->write = $user->rights->stocktransfer->stocktransfer->write;
|
||||
// Contacts lines (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
|
||||
foreach ($dirtpls as $reldir) {
|
||||
$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
|
||||
if ($res) break;
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
207
htdocs/product/stock/stocktransfer/stocktransfer_document.php
Normal file
207
htdocs/product/stock/stocktransfer/stocktransfer_document.php
Normal file
@ -0,0 +1,207 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer_document.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Tab for documents linked to StockTransfer
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("stocks", "companies", "other", "mails"));
|
||||
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm');
|
||||
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Get parameters
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "name";
|
||||
//if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new StockTransfer($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('stocktransferdocument', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity?$object->entity:$conf->entity] . "/stocktransfer/" . dol_sanitizeFileName($object->id);
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity ? $object->entity : $conf->entity]."/stocktransfer/".dol_sanitizeFileName($object->ref);
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'stocktransfer', $object->id);
|
||||
|
||||
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("ModuleStockTransferName").' - '.$langs->trans("Files");
|
||||
$help_url = '';
|
||||
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if ($object->id) {
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
$head = stocktransferPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'document', $langs->trans("StockTransfer"), -1, $object->picto);
|
||||
|
||||
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize = 0;
|
||||
foreach ($filearray as $key => $file) {
|
||||
$totalsize += $file['size'];
|
||||
}
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/stocktransfer/stocktransfer_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ': '.$proj->getNomUrl();
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Number of files
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
|
||||
// Total size
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
$modulepart = 'stocktransfer';
|
||||
//$permission = $user->rights->stocktransfer->stocktransfer->write;
|
||||
$permission = 1;
|
||||
//$permtoedit = $user->rights->stocktransfer->stocktransfer->write;
|
||||
$permtoedit = 1;
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
//$relativepathwithnofile='stocktransfer/' . dol_sanitizeFileName($object->id).'/';
|
||||
$relativepathwithnofile = 'stocktransfer/'.dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
} else {
|
||||
accessforbidden('', 0, 1);
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
572
htdocs/product/stock/stocktransfer/stocktransfer_list.php
Normal file
572
htdocs/product/stock/stocktransfer/stocktransfer_list.php
Normal file
@ -0,0 +1,572 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer_list.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief List page for stocktransfer
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
|
||||
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
|
||||
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
|
||||
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
||||
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL', '1'); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
// load stocktransfer libraries
|
||||
require_once __DIR__.'/class/stocktransfer.class.php';
|
||||
|
||||
// for other modules
|
||||
//dol_include_once('/othermodule/class/otherobject.class.php');
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("stocks", "other"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'stocktransferlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new StockTransfer($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('stocktransferlist')); // Note that conf->hooks_modules contains array
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
//var_dump($object->fields);
|
||||
// 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) {
|
||||
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]),
|
||||
'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$permissiontoread = $user->rights->stocktransfer->stocktransfer->read;
|
||||
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write;
|
||||
$permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete;
|
||||
|
||||
// Security check
|
||||
if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
|
||||
$socid = 0;
|
||||
if ($user->socid > 0) { // Protection if external user
|
||||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
//$result = restrictedArea($user, 'stocktransfer', $id, '');
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
|
||||
$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 (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass = 'StockTransfer';
|
||||
$objectlabel = 'StockTransfer';
|
||||
$uploaddir = $conf->stocktransfer->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
//$help_url="EN:Module_StockTransfer|FR:Module_StockTransfer_FR|ES:Módulo_StockTransfer";
|
||||
$help_url = '';
|
||||
$title = $langs->trans('StockTransferList');
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= "t.".$key.", ";
|
||||
}
|
||||
// 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.', ' : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
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 (t.rowid = ef.fk_object)";
|
||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
else $sql .= " WHERE 1 = 1";
|
||||
foreach ($search as $key => $val) {
|
||||
if ($key == 'status' && $search[$key] == -1) continue;
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||
if ($search[$key] == '-1') $search[$key] = '';
|
||||
$mode_search = 2;
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
|
||||
// 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, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
/* If a group by is required
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$sql.="t.".$key.", ";
|
||||
}
|
||||
// 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.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql=preg_replace('/,\s*$/','', $sql);
|
||||
*/
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
function init_myfunc()
|
||||
{
|
||||
jQuery("#myid").removeAttr(\'disabled\');
|
||||
jQuery("#myid").attr(\'disabled\',\'disabled\');
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'validate'=>$langs->trans("Validate"),
|
||||
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
//print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
// Add code for pre mass action (confirmation or email presend form)
|
||||
$topicmail = "SendStockTransferRef";
|
||||
$modelmail = "stocktransfer";
|
||||
$objecttmp = new StockTransfer($db);
|
||||
$trackid = 'xxxx'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
/*$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
|
||||
$moreforfilter.= '</div>';*/
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'status') print $object->getLibStatut(5);
|
||||
else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
|
||||
$date_prevue_depart = $object->$key;
|
||||
$date_prevue_depart_plus_delai = $date_prevue_depart;
|
||||
if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
|
||||
if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
$totalarray['val']['t.'.$key] += $object->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// 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($object->id, $arrayofselected)) $selected = 1;
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// Show list of available documents
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource .= str_replace('&', '&', $param);
|
||||
|
||||
$filedir = $diroutputmassaction;
|
||||
$genallowed = $permissiontoread;
|
||||
$delallowed = $permissiontoadd;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_stocktransfer', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
162
htdocs/product/stock/stocktransfer/stocktransfer_note.php
Normal file
162
htdocs/product/stock/stocktransfer/stocktransfer_note.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file stocktransfer_note.php
|
||||
* \ingroup stocktransfer
|
||||
* \brief Car with notes on StockTransfer
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
|
||||
if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
|
||||
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
||||
if (!$res) die("Include of main fails");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("stocks", "companies"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new StockTransfer($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
$hookmanager->initHooks(array('stocktransfernote', 'globalcard')); // Note that conf->hooks_modules contains array
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Security check - Protection if external user
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
//if ($user->socid > 0) $socid = $user->socid;
|
||||
//$result = restrictedArea($user, 'stocktransfer', $id);
|
||||
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
|
||||
|
||||
$permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans('ModuleStockTransferName'), $help_url);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head = stocktransferPrepareHead($object);
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("StockTransfer"), -1, $object->picto);
|
||||
|
||||
// Object card
|
||||
// ------------------------------------------------------------
|
||||
$linkback = '<a href="'.dol_buildpath('/stocktransfer/stocktransfer_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($permissiontoadd)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= ': '.$proj->getNomUrl();
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
$cssclass = "titlefield";
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -120,7 +120,7 @@ class RecruitmentCandidature extends CommonObject
|
||||
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
|
||||
'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1,),
|
||||
'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,),
|
||||
'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email'),
|
||||
'email' => array('type'=>'email', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'picto'=>'email', 'csslist'=>'tdoverflowmax200'),
|
||||
'phone' => array('type'=>'phone', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'picto'=>'phone'),
|
||||
'date_birth' => array('type'=>'date', 'label'=>'DateOfBirth', 'enabled'=>'1', 'position'=>70, 'visible'=>-1,),
|
||||
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
|
||||
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
||||
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
||||
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
||||
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
||||
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
|
||||
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
|
||||
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
||||
@ -129,11 +129,11 @@ $arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$visible = (int) dol_eval($val['visible'], 1, 1, '1');
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
@ -318,7 +318,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
*/
|
||||
@ -326,8 +326,15 @@ $sql = preg_replace('/,\s*$/', '', $sql);
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
@ -543,7 +550,7 @@ $arrayofmassactions = array(
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($permissiontodelete) {
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
@ -560,12 +567,17 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
//print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
@ -577,10 +589,13 @@ $trackid = 'recruitmentapplication'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all) {
|
||||
$setupstring = '';
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
$setupstring .= $key."=".$val.";";
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -603,7 +618,7 @@ if (!empty($moreforfilter)) {
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
@ -613,8 +628,16 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
$searchkey = empty($search[$key]) ? '' : $search[$key];
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
@ -655,10 +678,12 @@ $parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
$totalarray = array();
|
||||
@ -667,6 +692,9 @@ $totalarray['nbfield'] = 0;
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
@ -675,21 +703,25 @@ foreach ($object->fields as $key => $val) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
}
|
||||
$totalarray['nbfield']++;
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -735,7 +767,19 @@ while ($i < $imaxinloop) {
|
||||
} else {
|
||||
// Show here line of result
|
||||
$j = 0;
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
@ -756,7 +800,11 @@ while ($i < $imaxinloop) {
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield)) {
|
||||
print ' title="'.dol_escape_htmltag($object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'rowid') {
|
||||
@ -789,15 +837,17 @@ while ($i < $imaxinloop) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// 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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
if (empty($conf->global->MAIN_CHECKBOX_LEFT_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($object->id, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@ -826,7 +876,7 @@ if ($num == 0) {
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
@ -427,8 +427,8 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/^&mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/^&mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/^&mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentjobposition_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||
|
||||
|
||||
@ -678,20 +678,28 @@ $parameters = array('fieldstosearchall' => $fieldstosearchall);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
// Count total nb of records with no order and no limits
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
// Complete request and execute it with limit
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -701,6 +709,7 @@ if (!$resql) {
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') {
|
||||
@ -860,8 +869,8 @@ if (GETPOST('delsoc')) {
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->creer) {
|
||||
@ -1668,7 +1677,8 @@ while ($i < min($num, $limit)) {
|
||||
if (!empty($arrayfields['s.fk_stcomm']['checked'])) {
|
||||
// Prospect status
|
||||
print '<td class="center nowrap"><div class="nowrap">';
|
||||
print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
|
||||
print '<div class="inline-block">';
|
||||
print $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
|
||||
print '</div> - <div class="inline-block">';
|
||||
foreach ($prospectstatic->cacheprospectstatus as $key => $val) {
|
||||
$titlealt = 'default';
|
||||
|
||||
@ -149,7 +149,8 @@ select.vmenusearchselectcombo {
|
||||
background-color: unset;
|
||||
}
|
||||
|
||||
table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre:not(.maxwidthsearch) {
|
||||
table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre:not(.maxwidthsearch),
|
||||
table.liste th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), table.liste td.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch) {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 100px;
|
||||
|
||||
@ -403,7 +403,8 @@ textarea.cke_source:focus
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre:not(.maxwidthsearch) {
|
||||
th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre:not(.maxwidthsearch),
|
||||
th.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch), td.wrapcolumntitle.liste_titre_sel:not(.maxwidthsearch) {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
max-width: 120px;
|
||||
|
||||
@ -29,10 +29,6 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
|
||||
|
||||
if (!$user->rights->user->user->lire && !$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Load translation files required by page
|
||||
$langs->loadLangs(array('users', 'companies'));
|
||||
|
||||
@ -51,7 +47,6 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa
|
||||
// Load mode employee
|
||||
$mode = GETPOST("mode", 'alpha');
|
||||
|
||||
$userstatic = new User($db);
|
||||
$search_statut = GETPOST('search_statut', 'int');
|
||||
|
||||
if ($search_statut == '' || $search_statut == '0') {
|
||||
@ -62,9 +57,16 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
||||
$search_statut = "";
|
||||
}
|
||||
|
||||
$userstatic = new User($db);
|
||||
|
||||
// Define value to know what current user can do on users
|
||||
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||
|
||||
if (!$user->rights->user->user->lire && !$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$childids = $user->getAllChildIds(1);
|
||||
|
||||
|
||||
/*
|
||||
@ -73,19 +75,25 @@ $canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("Users").' - '.$langs->trans("HierarchicView");
|
||||
$help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
|
||||
$title = $langs->trans("Users");
|
||||
$arrayofjs = array(
|
||||
'/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
|
||||
'/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js',
|
||||
);
|
||||
$arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
|
||||
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'bodyforlist');
|
||||
llxHeader('', $title, $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', 'bodyforlist');
|
||||
|
||||
|
||||
// Load hierarchy of users
|
||||
$user_arbo = $userstatic->get_full_tree(0, ($search_statut != '' && $search_statut >= 0) ? "statut = ".$search_statut : '');
|
||||
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = count($user_arbo);
|
||||
|
||||
|
||||
if (!is_array($user_arbo) && $user_arbo < 0) {
|
||||
setEventMessages($userstatic->error, $userstatic->errors, 'warnings');
|
||||
} else {
|
||||
@ -142,12 +150,12 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
|
||||
|
||||
//var_dump($data);
|
||||
|
||||
$param = "search_statut=".urlencode($search_statut);
|
||||
$param = "&search_statut=".urlencode($search_statut);
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=', '', $canadduser);
|
||||
|
||||
@ -155,18 +163,19 @@ if (!is_array($user_arbo) && $user_arbo < 0) {
|
||||
$num = 0;
|
||||
$limit = 0;
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="liste nohover centpercent">';
|
||||
|
||||
@ -562,7 +562,7 @@ if ($search_api_key != '') {
|
||||
if ($search_supervisor > 0) {
|
||||
$param .= "&search_supervisor=".urlencode($search_supervisor);
|
||||
}
|
||||
if ($search_statut != '' && $search_statut >= 0) {
|
||||
if ($search_statut != '') {
|
||||
$param .= "&search_statut=".urlencode($search_statut);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
@ -613,9 +613,9 @@ if (!empty($socid)) {
|
||||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.(($search_statut != '' && $search_statut >= 0) ? '&search_statut='.$search_statut : '').preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
|
||||
|
||||
|
||||
@ -166,6 +166,26 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testNum2Alpha
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNum2Alpha()
|
||||
{
|
||||
$result = num2Alpha(0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'A', 'Check num2Alpha 0');
|
||||
|
||||
$result = num2Alpha(5);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'F', 'Check num2Alpha 5');
|
||||
|
||||
$result = num2Alpha(26);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals($result, 'AA', 'Check num2Alpha 26');
|
||||
}
|
||||
|
||||
/**
|
||||
* testIsValidEmail
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user