Merge branch 'develop' into batch_mask_product

This commit is contained in:
Christophe Battarel 2021-04-14 08:30:19 +02:00 committed by GitHub
commit ccc05a0a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
578 changed files with 7990 additions and 1467 deletions

1
htdocs/.htaccess Normal file
View File

@ -0,0 +1 @@
Options -Indexes

View File

@ -51,6 +51,7 @@ $confirm = GETPOST('confirm', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int');
$permissiontoadd = $user->rights->accounting->chartofaccount;
$permissiontodelete = $user->rights->accounting->chartofaccount;
// Security check
@ -96,7 +97,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
$accounting = new AccountingAccount($db);
/*
* Actions
*/
@ -118,9 +118,11 @@ if (empty($reshook)) {
if (!empty($cancel)) {
$action = '';
}
$objectclass = 'AccountingAccount';
$uploaddir = $conf->accounting->multidir_output[$conf->entity];
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($action == "delete") {
$action = "";
}
@ -136,7 +138,7 @@ if (empty($reshook)) {
}
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified
if ($chartofaccounts > 0) {
if ($chartofaccounts > 0 && $permissiontoadd) {
// Get language code for this $chartofaccounts
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
$sql .= ' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
@ -180,7 +182,7 @@ if (empty($reshook)) {
}
}
if ($action == 'disable') {
if ($action == 'disable' && $permissiontoadd) {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->accountDeactivate($id, $mode);
@ -190,7 +192,7 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} elseif ($action == 'enable') {
} elseif ($action == 'enable' && $permissiontoadd) {
if ($accounting->fetch($id)) {
$mode = GETPOST('mode', 'int');
$result = $accounting->account_activate($id, $mode);
@ -277,6 +279,7 @@ if (strlen(trim($search_pcgtype))) {
$sql .= natural_search("aa.pcg_type", $search_pcgtype);
}
$sql .= $db->order($sortfield, $sortorder);
//print $sql;
// Count total nb of records
$nbtotalofrecords = '';
@ -454,7 +457,7 @@ if ($resql) {
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
$totalarray['nbfield']++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {

View File

@ -34,7 +34,6 @@ $error = 0;
// Load translation files required by the page
$langs->loadLangs(array("bills", "accountancy", "compta"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$id = GETPOST('id', 'int');
@ -139,7 +138,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
} else {
$result = $object->fetch($id);
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
$sql = 'SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.((int) $conf->global->CHARTOFACCOUNTS);
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result2 = $db->query($sql);
@ -148,7 +147,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
// Clean code
// To manage zero or not at the end of the accounting account
if ($conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
if (isset($conf->global->ACCOUNTING_MANAGE_ZERO) && $conf->global->ACCOUNTING_MANAGE_ZERO == 1) {
$account_number = $account_number;
} else {
$account_number = clean_account($account_number);
@ -169,13 +168,12 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
$object->labelshort = GETPOST('labelshort', 'alpha');
$result = $object->update($user);
if ($result > 0) {
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $urltogo);
exit();
} else {
$mesg = $object->error;
setEventMessages($object->error, null, 'errors');
}
}
} else {
@ -255,13 +253,17 @@ if ($action == 'create') {
print '</td></tr>';
// Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1, 0, 1);
print '</td></tr>';
@ -281,8 +283,6 @@ if ($action == 'create') {
$result = $object->fetch($id, $ref, 1);
if ($result > 0) {
dol_htmloutput_mesg($mesg);
$head = accounting_prepare_head($object);
// Edit mode
@ -316,13 +316,17 @@ if ($action == 'create') {
print '</td></tr>';
// Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
// Category
print '<tr><td>'.$langs->trans("AccountingCategory").'</td>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print '</td>';
print '<td>';
$formaccounting->select_accounting_category($object->account_category, 'account_category', 1);
print '</td></tr>';
@ -368,13 +372,17 @@ if ($action == 'create') {
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
print '<td colspan="2">'.$accp->account_number.' - '.$accp->label.'</td></tr>';
// Category
print "<tr><td>".$langs->trans("AccountingCategory")."</td><td colspan='2'>".$object->account_category_label."</td>";
// Chart of accounts type
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
// Group of accounting account
print '<tr><td>';
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td colspan="2">'.$object->pcg_type.'</td></tr>';
// Custom group of accounting account
print "<tr><td>";
print $form->textwithpicto($langs->trans("AccountingCategory"), $langs->transnoentitiesnoconv("AccountingAccountGroupsDesc"));
print "</td><td colspan='2'>".$object->account_category_label."</td>";
print '</table>';
print '</div>';

View File

@ -55,7 +55,7 @@ $accountingcategory = new AccountancyCategory($db);
* Actions
*/
// si ajout de comptes
// If we add account
if (!empty($selectcpt)) {
$cpts = array();
foreach ($selectcpt as $selectedoption) {
@ -72,6 +72,7 @@ if (!empty($selectcpt)) {
setEventMessages($langs->trans('RecordModifiedSuccessfully'), null, 'mesgs');
}
}
if ($action == 'delete') {
if ($cpt_id) {
if ($accountingcategory->deleteCptCat($cpt_id)) {
@ -93,8 +94,9 @@ $formaccounting = new FormAccounting($db);
llxheader('', $langs->trans('AccountingCategory'));
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$titlepicto = 'setup';
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback);
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback, $titlepicto);
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "accountancy", "hrm"));
@ -52,7 +53,6 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
$listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
$active = 1;
$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
@ -124,11 +124,7 @@ $tabfieldcheck[32] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList = array();
$accountingcategory = new AccountancyCategory($db);
/*
@ -428,7 +424,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$titre = $langs->trans($tablib[$id]);
$linkback = '';
$titlepicto = 'title_accountancy';
$titlepicto = 'setup';
print load_fiche_titre($titre, $linkback, $titlepicto);
@ -438,427 +434,432 @@ print '<span class="opacitymedium">'.$langs->trans("AccountingAccountGroupsDesc"
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id > 0 ? '&search_country_id='.$search_country_id : ''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
//var_dump($elementList);
/*
* Show a dictionary
*/
if ($id) {
// Complete requete recherche valeurs avec critere de tri
$sql = $tabsql[$id];
// Complete requete recherche valeurs avec critere de tri
$sql = $tabsql[$id];
if ($search_country_id > 0) {
if (preg_match('/ WHERE /', $sql)) {
$sql .= " AND ";
} else {
$sql .= " WHERE ";
}
$sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
if ($search_country_id > 0) {
if (preg_match('/ WHERE /', $sql)) {
$sql .= " AND ";
} else {
$sql .= " WHERE ";
}
$sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
}
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') {
$sortfield = 'country_code';
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
//print $sql;
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') {
$sortfield = 'country_code';
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
//print $sql;
$fieldlist = explode(',', $tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Form to add a new line
if ($tabname[$id]) {
$fieldlist = explode(',', $tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow = $langs->trans("Type");
}
}
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'libelle_facture') {
$valuetoshow = $langs->trans("LabelOnDocuments");
}
if ($fieldlist[$field] == 'country') {
$valuetoshow = $langs->trans("Country");
}
if ($fieldlist[$field] == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($fieldlist[$field] == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
}
if ($fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
}
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($fieldlist[$field] == 'range_account') {
$valuetoshow = $langs->trans("Comment");
}
if ($fieldlist[$field] == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '</td>';
}
}
// Form to add a new line
if ($tabname[$id]) {
$fieldlist = explode(',', $tabfield[$id]);
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
$valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow = $langs->trans("Type");
// Line to enter new values
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd', 'alpha')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook)) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
}
print '<td colspan="4" class="right">';
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";
$colspan = count($fieldlist) + 3;
if ($id == 32) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.$search_country_id;
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.$sortorder;
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.$sortfield;
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages
if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// Title line with search boxes
print '<tr class="liste_titre liste_titre_add liste_titre_filter">';
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
if ($showfield) {
if ($value == 'country') {
print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>';
$filterfound++;
} else {
print '<td class="liste_titre"></td>';
}
}
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield = 1; // By defaut
$class = "left";
$sortable = 1;
$valuetoshow = '';
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'source') {
$valuetoshow = $langs->trans("Contact");
}
if ($fieldlist[$field] == 'price') {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($fieldlist[$field] == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
}
$class = 'center';
}
if ($fieldlist[$field] == 'type') {
$valuetoshow = $langs->trans("Type");
}
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'country') {
$valuetoshow = $langs->trans("Country");
}
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
if ($fieldlist[$field] == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($fieldlist[$field] == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
$sortable = 0;
}
if ($fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
$sortable = 0;
}
if ($fieldlist[$field] == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($fieldlist[$field] == 'account_parent') {
$valuetoshow = $langs->trans("Accountsparent");
}
if ($fieldlist[$field] == 'pcg_type') {
$valuetoshow = $langs->trans("Pcg_type");
}
if ($fieldlist[$field] == 'type_template') {
$valuetoshow = $langs->trans("TypeOfTemplate");
}
if ($fieldlist[$field] == 'range_account') {
$valuetoshow = $langs->trans("Comment");
}
if ($fieldlist[$field] == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
// Affiche nom du champ
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
if ($num) {
// Lines with values
while ($i < $num) {
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
// Show fields
if (empty($reshook)) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
}
}
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'libelle_facture') {
$valuetoshow = $langs->trans("LabelOnDocuments");
}
if ($fieldlist[$field] == 'country') {
$valuetoshow = $langs->trans("Country");
}
if ($fieldlist[$field] == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($fieldlist[$field] == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
}
if ($fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
}
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($fieldlist[$field] == 'range_account') {
$valuetoshow = $langs->trans("Comment");
}
if ($fieldlist[$field] == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
print '<td></td>';
print '<td></td>';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook)) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$class = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'category_type') {
$valuetoshow = yn($valuetoshow);
} elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'country') {
if (empty($obj->country_code)) {
$valuetoshow = '-';
} else {
$key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
}
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
$langs->loadLangs(array("propal"));
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
$class = 'tddict';
// Show value for field
if ($showfield) {
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.dol_escape_htmltag($valuetoshow).'</td>';
}
}
}
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code)) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
}
}
$canbemodified = $iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&';
// Active
print '<td class="center" class="nowrap">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
} else {
print $valuetoshow;
print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
// Link to setup the group
print '<td class="center">';
if (empty($obj->formula)) {
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("ListOfAccounts");
print '</a>';
// Count number of accounts into group
$nbofaccountintogroup = 0;
$listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid);
$nbofaccountintogroup = count($listofaccountintogroup);
//if ($nbofaccountintogroup > 0) {
print ' <span class="opacitymedium">('.$langs->trans("NAccounts", $nbofaccountintogroup).')</span>';
//} else {
// print ' <span class="opacitymedium">(0)</span>';
//}
}
print '</td>';
}
print "</tr>\n";
$i++;
}
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line to enter new values
print '<tr class="oddeven nodrag nodrop nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd', 'alpha')) {
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '') {
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook)) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add');
}
print '<td colspan="4" class="right">';
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";
$colspan = count($fieldlist) + 3;
if ($id == 32) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id;
if ($search_country_id > 0) {
$param .= '&search_country_id='.$search_country_id;
}
$paramwithsearch = $param;
if ($sortorder) {
$paramwithsearch .= '&sortorder='.$sortorder;
}
if ($sortfield) {
$paramwithsearch .= '&sortfield='.$sortfield;
}
if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.GETPOST('from', 'alpha');
}
// There is several pages
if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// Title line with search boxes
print '<tr class="liste_titre liste_titre_add liste_titre_filter">';
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
if ($showfield) {
if ($value == 'country') {
print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>';
$filterfound++;
} else {
print '<td class="liste_titre"></td>';
}
}
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) {
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield = 1; // By defaut
$class = "left";
$sortable = 1;
$valuetoshow = '';
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'source') {
$valuetoshow = $langs->trans("Contact");
}
if ($fieldlist[$field] == 'price') {
$valuetoshow = $langs->trans("PriceUHT");
}
if ($fieldlist[$field] == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
$valuetoshow = $langs->trans("Rate");
} else {
$valuetoshow = $langs->trans("Amount");
}
$class = 'center';
}
if ($fieldlist[$field] == 'type') {
$valuetoshow = $langs->trans("Type");
}
if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code");
}
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field] == 'country') {
$valuetoshow = $langs->trans("Country");
}
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
if ($fieldlist[$field] == 'accountancy_code') {
$valuetoshow = $langs->trans("AccountancyCode");
}
if ($fieldlist[$field] == 'accountancy_code_sell') {
$valuetoshow = $langs->trans("AccountancyCodeSell");
$sortable = 0;
}
if ($fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = $langs->trans("AccountancyCodeBuy");
$sortable = 0;
}
if ($fieldlist[$field] == 'fk_pcg_version') {
$valuetoshow = $langs->trans("Pcg_version");
}
if ($fieldlist[$field] == 'account_parent') {
$valuetoshow = $langs->trans("Accountsparent");
}
if ($fieldlist[$field] == 'pcg_type') {
$valuetoshow = $langs->trans("Pcg_type");
}
if ($fieldlist[$field] == 'type_template') {
$valuetoshow = $langs->trans("TypeOfTemplate");
}
if ($fieldlist[$field] == 'range_account') {
$valuetoshow = $langs->trans("Comment");
}
if ($fieldlist[$field] == 'category_type') {
$valuetoshow = $langs->trans("Calculated");
}
// Affiche nom du champ
if ($showfield) {
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' ');
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
if ($num) {
// Lines with values
while ($i < $num) {
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
// Show fields
if (empty($reshook)) {
fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit');
}
print '<td></td>';
print '<td></td>';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook)) {
foreach ($fieldlist as $field => $value) {
$showfield = 1;
$class = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'category_type') {
$valuetoshow = yn($valuetoshow);
} elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
} elseif ($fieldlist[$field] == 'country') {
if (empty($obj->country_code)) {
$valuetoshow = '-';
} else {
$key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
}
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
$langs->loadLangs(array("propal"));
$key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0;
}
$class = 'tddict';
// Show value for field
if ($showfield) {
print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.dol_escape_htmltag($valuetoshow).'</td>';
}
}
}
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (isset($obj->code)) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
}
}
$canbemodified = $iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
$url .= '&';
// Active
print '<td class="center" class="nowrap">';
if ($canbedisabled) {
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
} else {
print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) {
print '<td class="center"><a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
// Link to setup the group
print '<td class="center">';
if (empty($obj->formula)) {
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("ListOfAccounts");
print '</a>';
}
print '</td>';
}
print "</tr>\n";
$i++;
}
}
} else {
dol_print_error($db);
}
print '</table>';
print '</div>';
print '</form>';
} else {
dol_print_error($db);
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
// End of page
@ -879,9 +880,6 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
{
global $conf, $langs, $db;
global $form, $mysoc;
global $region_id;
global $elementList, $sourceList, $localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);

View File

@ -58,17 +58,40 @@ $list_binding = array(
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
);
$error = 0;
/*
* Actions
*/
if (in_array($action, array(
'setBANK_DISABLE_DIRECT_INPUT',
'setACCOUNTANCY_COMBO_FOR_AUX',
'setACCOUNTING_MANAGE_ZERO',
'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOST('value', 'int');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'update') {
$error = 0;
if (!$error) {
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
var_dump($constname);
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
@ -268,11 +291,11 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disabledirectinput&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&disabledirectinput&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setBANK_DISABLE_DIRECT_INPUT&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -282,11 +305,11 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").'</td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enablesubsidiarylist&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&enablesubsidiarylist&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -295,11 +318,11 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&managezero&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&managezero&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_MANAGE_ZERO&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -336,11 +359,11 @@ print "</tr>\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&listsorttodo&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&listsorttodo&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -349,11 +372,11 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&listsortdone&value=0">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&listsortdone&value=1">';
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
@ -385,7 +408,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonsales&value=1">';
@ -398,7 +421,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonpurchases&value=1">';
@ -411,7 +434,7 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', 'warning');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setdisablebindingonexpensereports&value=1">';

View File

@ -418,10 +418,10 @@ class AccountancyCategory // extends CommonObject
/**
* Function to select all accounting accounts from an accounting category
* Function to select into ->lines_display all accounting accounts for a given custom accounting group
*
* @param int $id Id
* @return int <0 if KO, 0 if not found, >0 if OK
* @param int $id Id
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function display($id)
{
@ -453,23 +453,23 @@ class AccountancyCategory // extends CommonObject
}
/**
* Function to select accounting category of an accounting account present in chart of accounts
* Function to fill ->lines_cptbk with accounting account used (into bookkeeping) and not yet into a custom group
*
* @param int $id Id category
*
* @return int <0 if KO, 0 if not found, >0 if OK
* @param int $id Id of custom group
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*
public function getCptBK($id)
{
global $conf;
$sql = "SELECT t.numero_compte, t.label_operation, t.doc_ref";
$sql = "SELECT DISTINCT t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte NOT IN (";
$sql .= " WHERE t.numero_compte NOT IN ("; // account not into a custom group
$sql .= " SELECT t.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$id." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN (";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id)." AND t.entity = ".$conf->entity.")";
$sql .= " AND t.numero_compte IN ("; // account into current chart of account
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
@ -479,7 +479,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
$this->lines_CptBk = array();
$this->lines_cptbk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -500,13 +500,13 @@ class AccountancyCategory // extends CommonObject
return -1;
}
}
*/
/**
* Function to select accounting category of an accounting account present in chart of accounts
* Function to fill ->lines_cptbk with accounting account (defined in chart of account) and not yet into a custom group
*
* @param int $id Id of category to know which account to exclude
*
* @return int <0 if KO, 0 if not found, >0 if OK
* @param int $id Id of category to know which account to exclude
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function getAccountsWithNoCategory($id)
{
@ -515,14 +515,14 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT aa.account_number as numero_compte, aa.label as label_compte";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
$sql .= " WHERE (aa.fk_accounting_category <> ".((int) $id)." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label";
$this->lines_CptBk = array();
$this->lines_cptbk = array();
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -656,7 +656,7 @@ class AccountancyCategory // extends CommonObject
}
/**
* Function to know all category from accounting account
* Function to know all custom groupd from an accounting account
*
* @return array|integer Result in table (array), -1 if KO
*/
@ -785,7 +785,7 @@ class AccountancyCategory // extends CommonObject
}
/**
* Return list of personalized groups that are active
* Return list of custom groups that are active
*
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array|int Array of groups or -1 if error
@ -843,11 +843,11 @@ class AccountancyCategory // extends CommonObject
/**
* Get all accounting account of a group.
* Get all accounting account of a custom group (or a list of custom groups).
* You must choose between first parameter (personalized group) or the second (free criteria filter)
*
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts
* @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts. This value must not come from an input of a user.
* @return array|int Array of accounting accounts or -1 if error
*/
public function getCptsCat($cat_id, $predefinedgroupwhere = '')

View File

@ -50,15 +50,15 @@ $error = 0;
// Editing global variables not related to a specific theme
$constantes = array(
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>'emailtemplate:member',
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_AUTOREGISTER_MAIL
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_VALID
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_COTIS
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', // until Dolibarr 7 it was ADHERENT_MAIL_RESIL
'ADHERENT_EMAIL_TEMPLATE_EXCLUSION' =>'emailtemplate:member',
'ADHERENT_MAIL_FROM' =>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT' =>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL' =>'html',
);
@ -128,7 +128,7 @@ if ($action == 'update' || $action == 'add') {
$form = new Form($db);
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $langs->trans("MembersSetup"), $help_url);

View File

@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject = $langs->transnoentitiesnoconv("MembersTypes");
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $langs->trans("MembersSetup"), $help_url);

View File

@ -183,7 +183,7 @@ if ($id > 0) {
$permission = $user->rights->adherent->creer;
$permtoedit = $user->rights->adherent->creer;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
print "<br><br>";
} else {
dol_print_error($db);

View File

@ -155,42 +155,10 @@ if ($result) {
$db->free();
}
$searchbox = '';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
// Search contact/address
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
$listofsearchfields['search_member'] = array('text'=>'Member');
}
if (count($listofsearchfields)) {
$searchbox .='<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
$searchbox .='<input type="hidden" name="token" value="'.newToken().'">';
$searchbox .='<div class="div-table-responsive-no-min">';
$searchbox .='<table class="noborder nohover centpercent">';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
if ($i == 0) {
$searchbox .='<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
}
$searchbox .='<tr class="oddeven">';
$searchbox .='<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) {
$searchbox .='<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
}
$searchbox .='</tr>';
$i++;
}
$searchbox .='</table>';
$searchbox .='</div>';
$searchbox .='</form>';
$searchbox .='<br>';
}
}
/*
* Statistics
*/
$boxgraph = '';
if ($conf->use_javascript_ajax) {
$boxgraph .='<div class="div-table-responsive-no-min">';
@ -258,7 +226,7 @@ print '<div class="fichecenter fichecenterbis">';
print '<div class="twocolumns">';
print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
print $searchbox;
print $boxgraph;
print $resultboxes['boxlista'];

View File

@ -486,7 +486,7 @@ $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_
$tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled));
$tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled);
$tabcond[19] = !empty($conf->societe->enabled);
$tabcond[20] = (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled));
$tabcond[20] = (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled);
$tabcond[21] = !empty($conf->propal->enabled);
$tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
$tabcond[23] = true;

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -60,7 +60,7 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
);
$error = 0;
@ -75,7 +75,6 @@ if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstorder', 'alpha');
$maskorder = GETPOST('maskorder', 'alpha');
@ -198,6 +197,7 @@ print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, 'even
// Setup page goes here
echo '<span class="opacitymedium">'.$langs->trans("EventOrganizationSetupPage").'</span><br><br>';
if ($action == 'edit') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -207,12 +207,12 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['enabled']==1) {
$setupnotempty++;
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
print '</td><td>';
if ($val['type'] == 'textarea') {
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
@ -257,13 +257,13 @@ if ($action == 'edit') {
$formcompany = new FormCompany($db);
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
} elseif ($val['type'] == 'securekey') {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
print '<input required="required" type="text" class="flat" id="'.$constname.'" name="'.$constname.'" value="'.(GETPOST($constname, 'alpha') ?GETPOST($constname, 'alpha') : $conf->global->{$constname}).'" size="40">';
if (!empty($conf->use_javascript_ajax)) {
print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"');
}
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#generate_token'.$constname.'").click(function() {
$.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
action: \'getrandompassword\',
@ -274,8 +274,8 @@ if ($action == 'edit') {
});
});
});';
print '</script>';
}
print '</script>';
}
} else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
}

View File

@ -61,7 +61,7 @@ $modules = array(
$conditions = array(
'SOCIETE' => 1,
'PRODUCTDESC' => (!empty($conf->product->enabled) || !empty($conf->service->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'DETAILS' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (!empty($conf->facture->enabled) || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)),

View File

@ -293,7 +293,7 @@ $found = 0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
@ -311,7 +311,7 @@ $found++;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
@ -356,7 +356,7 @@ if (!empty($conf->reception->enabled)) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {

View File

@ -111,8 +111,8 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array(
'family'=>'classify_supplier_proposal',
'position'=>60,
'enabled'=>(!empty($conf->supplier_proposal->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'propal',
'enabled'=>(!empty($conf->supplier_proposal->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'supplier_proposal',
'warning'=>''
),
@ -120,8 +120,8 @@ $workflowcodes = array(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array(
'family'=>'classify_supplier_order',
'position'=>62,
'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'picto'=>'order',
'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)),
'picto'=>'supplier_order',
'warning'=>''
),
@ -129,8 +129,8 @@ $workflowcodes = array(
'WORKFLOW_BILL_ON_RECEPTION'=>array(
'family'=>'classify_reception',
'position'=>64,
'enabled'=>(!empty($conf->reception->enabled) && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'bill'
'enabled'=>(!empty($conf->reception->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
'picto'=>'reception'
),
// Automatic classification shipping
@ -229,7 +229,7 @@ foreach ($workflowcodes as $key => $params) {
print '<tr class="oddeven">';
print '<td>';
print img_object('', $params['picto']);
print img_object('', $params['picto'], 'class="pictofixedwidth"');
print ' '.$langs->trans('desc'.$key);
if (!empty($params['warning'])) {

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -129,7 +129,7 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->asset->write;
$permtoedit = $user->rights->asset->write;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}

View File

@ -1 +0,0 @@

View File

@ -239,7 +239,10 @@ if (empty($reshook)) {
$form = new Form($db);
$formfile = new FormFile($db);
llxHeader('', $langs->trans("BOM"), '');
$title = $langs->trans('BOM');
llxHeader('', $title, '');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">

View File

@ -151,7 +151,7 @@ if ($object->id) {
//$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
accessforbidden('', 0, 1);
}

View File

@ -79,9 +79,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
$form = new Form($db);
$title = $langs->trans('BillOfMaterials');
$help_url = 'EN:Module_BOM';
llxHeader('', $langs->trans('BillOfMaterials'), $help_url);
llxHeader('', $title, $help_url);
if ($id > 0 || !empty($ref)) {
$object->fetch_thirdparty();

View File

View File

@ -1 +0,0 @@

View File

@ -49,6 +49,8 @@ if (is_numeric($type)) {
$type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
}
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categoryindex'));
/*
* View

View File

@ -201,10 +201,10 @@ class CActionComm
if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) {
$qualified = 0;
}
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled)) && empty($user->fournisseur->facture->lire)) {
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->facture->lire)) || (!empty($conf->supplier_invoice->enabled) && empty($user->supplier_invoice->lire)))) {
$qualified = 0;
}
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled)) && empty($user->fournisseur->commande->lire)) {
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->commande->lire)) || (empty($conf->supplier_order->enabled) && empty($user->supplier_order->lire)))) {
$qualified = 0;
}
if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) {

View File

@ -287,7 +287,7 @@ if ($object->id > 0) {
$modulepart = 'actions';
$permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
print $langs->trans("ErrorUnknown");
}

View File

@ -90,7 +90,7 @@ if (!empty($conf->supplier_proposal->enabled)) {
if (!empty($conf->commande->enabled)) {
$orderstatic = new Commande($db);
}
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$supplierorderstatic = new CommandeFournisseur($db);
}
@ -100,59 +100,6 @@ print load_fiche_titre($langs->trans("CommercialArea"), '', 'commercial');
print '<div class="fichecenter"><div class="fichethirdleft">';
// This is useless due to the global search combo
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
// Search proposal
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$listofsearchfields['search_proposal'] = array('text'=>'Proposal');
}
// Search customer order
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$listofsearchfields['search_customer_order'] = array('text'=>'CustomerOrder');
}
// Search supplier proposal
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
$listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort');
}
// Search supplier order
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) {
$listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder');
}
// Search intervention
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
$listofsearchfields['search_intervention'] = array('text'=>'Intervention');
}
// Search contract
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$listofsearchfields['search_contract'] = array('text'=>'Contract');
}
if (count($listofsearchfields)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
if ($i == 0) {
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
}
print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) {
print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>';
}
print '</tr>';
$i++;
}
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
}
/*
* Draft customer proposals
*/
@ -446,7 +393,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
/*
* Draft purchase orders
*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -641,7 +588,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
/*
* Last suppliers
*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) {
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@ -700,7 +647,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
{
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>';
}*/
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) {
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>';
}
print $s;

View File

@ -57,7 +57,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
//if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
//{
// Recherche emails
// Search into emailings
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/mailing/list.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';

View File

@ -122,7 +122,7 @@ $usercancreateorder = $user->rights->commande->creer;
$usercancreateinvoice = $user->rights->facture->creer;
$usercancreatecontract = $user->rights->contrat->creer;
$usercancreateintervention = $user->rights->ficheinter->creer;
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@ -623,7 +623,7 @@ if (empty($reshook)) {
// Classify billed
$db->begin();
$result = $object->cloture($user, $object::STATUS_BILLED, '');
$result = $object->classifyBilled($user, 0, '');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
@ -639,12 +639,12 @@ if (empty($reshook)) {
if (!(GETPOST('statut', 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'closeas';
} else {
} elseif (GETPOST('statut', 'int') == $object::STATUS_SIGNED || GETPOST('statut', 'int') == $object::STATUS_NOTSIGNED) {
// prevent browser refresh from closing proposal several times
if ($object->statut == $object::STATUS_VALIDATED) {
$db->begin();
$result = $object->signature($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml'));
$result = $object->closeProposal($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
@ -2534,7 +2534,7 @@ if ($action == 'create') {
// Create a purchase order
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) {
if (!empty($conf->fournisseur->enabled) && $object->statut == Propal::STATUS_SIGNED) {
if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) {
if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
}

View File

@ -766,7 +766,7 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->propal->cloture(DolibarrApiAccess::$user, $status, $note_private, $notrigger);
$result = $this->propal->closeProposal(DolibarrApiAccess::$user, $status, $note_private, $notrigger);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already closed');
}

View File

@ -118,6 +118,13 @@ class Propal extends CommonObject
*/
public $statut;
/**
* Status of the quote
* @var int
* @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
*/
public $status;
/**
* @deprecated
* @see $date_creation
@ -2502,15 +2509,15 @@ class Propal extends CommonObject
}
/**
* Sign the commercial proposal
* Close/set the commercial proposal to status signed or refused (fill also date signature)
*
* @param User $user Object user that close
* @param int $statut Status
* @param int $status Status (self::STATUS_BILLED or self::STATUS_REFUSED)
* @param string $note Complete private note with this note
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
public function signature($user, $statut, $note = '', $notrigger = 0)
public function closeProposal($user, $status, $note = '', $notrigger = 0)
{
global $langs,$conf;
@ -2522,15 +2529,16 @@ class Propal extends CommonObject
$newprivatenote = dol_concatdesc($this->note_private, $note);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id;
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id;
$sql .= " WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
// Status self::STATUS_REFUSED by default
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf;
$trigger_name = 'PROPAL_CLOSE_REFUSED';
if ($statut == self::STATUS_SIGNED) {
if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED
$trigger_name = 'PROPAL_CLOSE_SIGNED';
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->model_pdf;
@ -2561,7 +2569,8 @@ class Propal extends CommonObject
if (!$error) {
$this->oldcopy= clone $this;
$this->statut = $statut;
$this->statut = $status;
$this->status = $status;
$this->date_signature = $now;
$this->note_private = $newprivatenote;
}
@ -2580,6 +2589,7 @@ class Propal extends CommonObject
return 1;
} else {
$this->statut = $this->oldcopy->statut;
$this->status = $this->oldcopy->statut;
$this->date_signature = $this->oldcopy->date_signature;
$this->note_private = $this->oldcopy->note_private;
@ -2587,100 +2597,6 @@ class Propal extends CommonObject
return -1;
}
} else {
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
/**
* Close the commercial proposal
*
* @param User $user Object user that close
* @param int $status Status
* @param string $note Complete private note with this note
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
public function cloture($user, $status, $note = "", $notrigger = 0)
{
global $langs, $conf;
$error = 0;
$now = dol_now();
$this->db->begin();
$newprivatenote = dol_concatdesc($this->note_private, $note);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".((int) $status).", note_private = '".$this->db->escape($newprivatenote)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql .= " WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf;
$triggerName = 'PROPAL_CLOSE_REFUSED';
if ($status == self::STATUS_SIGNED) {
$triggerName = 'PROPAL_CLOSE_SIGNED';
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf;
// The connected company is classified as a client
$soc = new Societe($this->db);
$soc->id = $this->socid;
$result = $soc->set_as_client();
if ($result < 0) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -2;
}
}
if ($status == self::STATUS_BILLED) { // ->cloture() can also be called when we set it to billed, after setting it to signed
$triggerName = 'PROPAL_CLASSIFY_BILLED';
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language
$outputlangs = $langs;
if (!empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id', 'aZ09') ? GETPOST('lang_id', 'aZ09') : $this->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
}
if (!$error) {
$this->oldcopy = clone $this;
$this->statut = $status;
$this->date_cloture = $now;
$this->note_private = $newprivatenote;
}
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger($triggerName, $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error) {
$this->db->commit();
return 1;
} else {
$this->statut = $this->oldcopy->statut;
$this->date_cloture = $this->oldcopy->date_cloture;
$this->note_private = $this->oldcopy->note_private;
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -1;
@ -2688,36 +2604,66 @@ class Propal extends CommonObject
}
/**
* Class invoiced the Propal
* Classify the proposal to status Billed
*
* @param User $user Object user
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 si ko, >0 si ok
* @param string $note Complete private note with this note
* @return int <0 if KO, 0 = nothing done, >0 if OK
*/
public function classifyBilled(User $user, $notrigger = 0)
public function classifyBilled(User $user, $notrigger = 0, $note = '')
{
global $conf, $langs;
$error = 0;
$now = dol_now();
$num = 0;
$triggerName = 'PROPAL_CLASSIFY_BILLED';
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
$newprivatenote = dol_concatdesc($this->note_private, $note);
$sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED.", ";
$sql .= " note_private = '".$this->db->escape($newprivatenote)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_SIGNED;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = $this->db->error();
$error++;
} else {
$num = $this->db->affected_rows($resql);
}
if (!$error) {
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf;
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language
$outputlangs = $langs;
if (!empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id', 'aZ09') ? GETPOST('lang_id', 'aZ09') : $this->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
}
$this->oldcopy = clone $this;
$this->statut = self::STATUS_BILLED;
$this->date_cloture = $now;
$this->note_private = $newprivatenote;
}
if (!$notrigger && empty($error)) {
// Call trigger
$result = $this->call_trigger('PROPAL_MODIFY', $user);
$result = $this->call_trigger($triggerName, $user);
if ($result < 0) {
$error++;
}
@ -2726,7 +2672,7 @@ class Propal extends CommonObject
if (!$error) {
$this->db->commit();
return 1;
return $num;
} else {
foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
@ -2922,7 +2868,7 @@ class Propal extends CommonObject
}
if (count($linkedInvoices) > 0) {
$sql = "SELECT rowid as facid, ref, total, datef as df, fk_user_author, fk_statut, paye";
$sql = "SELECT rowid as facid, ref, total_ht as total, datef as df, fk_user_author, fk_statut, paye";
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $linkedInvoices)).")";

View File

@ -189,7 +189,7 @@ if ($object->id > 0) {
$permission = $user->rights->propal->creer;
$permtoedit = $user->rights->propal->creer;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
print $langs->trans("ErrorUnknown");
}

View File

@ -65,32 +65,10 @@ print load_fiche_titre($langs->trans("ProspectionArea"), '', 'propal');
print '<div class="fichecenter">';
print '<div class="fichethirdleft">';
// This is useless due to the global search combo
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
print '<div class="div-table-responsive-no-min">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("Proposal").':</td>';
print '<td><input type="text" class="flat" name="sall" size=18></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
print '</table>';
print '</div>';
print '</form>';
print '<br>';
}
/*
* Statistics
*/
$listofstatus = array(Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED);
$sql = "SELECT count(p.rowid) as nb, p.fk_statut as status";

View File

@ -73,6 +73,7 @@ $search_societe_alias = GETPOST('search_societe_alias', 'alpha');
$search_montant_ht = GETPOST('search_montant_ht', 'alpha');
$search_montant_vat = GETPOST('search_montant_vat', 'alpha');
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
$search_warehouse = GETPOST('search_warehouse', 'alpha');
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
@ -125,11 +126,6 @@ if (!$sortorder) {
$sortorder = 'DESC';
}
$permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->write;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
// Security check
$module = 'propal';
$dbtable = '';
@ -218,6 +214,12 @@ $arrayfields = array(
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$permissiontoread = $user->rights->propal->lire;
$permissiontoadd = $user->rights->propal->write;
$permissiontodelete = $user->rights->propal->supprimer;
$permissiontoclose = $user->rights->propal->cloturer;
/*
* Actions
@ -253,6 +255,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_montant_ht = '';
$search_montant_vat = '';
$search_montant_ttc = '';
$search_warehouse = '';
$search_multicurrency_code = '';
$search_multicurrency_tx = '';
$search_multicurrency_montant_ht = '';
@ -295,7 +298,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
if ($action == 'validate') {
if ($action == 'validate' && $permissiontoadd) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
@ -325,16 +328,16 @@ if ($action == 'validate') {
}
}
if ($action == "sign") {
if ($action == "sign" && $permissiontoclose) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
@ -356,16 +359,16 @@ if ($action == "sign") {
}
}
}
if ($action == "nosign") {
if ($action == "nosign" && $permissiontoclose) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 3;
if ($tmpproposal->update($user)) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {
dol_print_error($db);
@ -388,6 +391,43 @@ if ($action == "nosign") {
}
}
// Closed records
if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$result = $objecttmp->classifyBilled($user, 0);
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else {
$nbok++;
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();
}
}
/*
* View
@ -520,6 +560,9 @@ if ($search_montant_vat != '') {
if ($search_montant_ttc != '') {
$sql .= natural_search("p.total_ttc", $search_montant_ttc, 1);
}
if ($search_warehouse != '' && $search_warehouse > 0) {
$sql .= natural_search("p.fk_warehouse", $search_warehouse, 1);
}
if ($search_multicurrency_code != '') {
$sql .= ' AND p.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
}
@ -776,15 +819,16 @@ if ($resql) {
'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"),
'prevalidate'=>$langs->trans("Validate"),
'presign'=>$langs->trans("Sign"),
'nopresign'=>$langs->trans("NoSign"),
);
if ($user->rights->propal->cloturer) {
$arrayofmassactions['presign']=$langs->trans("Sign");
$arrayofmassactions['nopresign']=$langs->trans("NoSign");
$arrayofmassactions['setbilled'] = $langs->trans("ClassifyBilled");
}
if ($user->rights->propal->supprimer) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
}
if ($user->rights->propal->cloturer) {
$arrayofmassactions['closed'] = $langs->trans("Close");
}
if (in_array($massaction, array('presend', 'predelete', 'closed'))) {
$arrayofmassactions = array();
}
@ -870,6 +914,14 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
$moreforfilter .= '</div>';
}
if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Warehouse');
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle);
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {

View File

@ -114,7 +114,7 @@ $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancr
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
$usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer;
$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer);
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
@ -2501,7 +2501,7 @@ if ($action == 'create' && $usercancreate) {
// Create a purchase order
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
if (!empty($conf->fournisseur->enabled) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
}

View File

@ -184,7 +184,7 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->commande->creer;
$permtoedit = $user->rights->commande->creer;
$param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}

View File

@ -50,6 +50,12 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
// Maximum elements of the tables
$maxDraftCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
$maxLatestEditCount = 5;
$maxOpenCount = empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD;
/*
@ -70,19 +76,6 @@ print load_fiche_titre($langs->trans("OrdersArea"), '', 'order');
print '<div class="fichecenter"><div class="fichethirdleft">';
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
// Search customer orders
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("CustomerOrder").':</td><td><input type="text" class="flat" name="sall" size=18></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "</table></div></form><br>\n";
}
/*
* Statistics
*/

View File

@ -452,7 +452,7 @@ if ($search_total_vat != '') {
if ($search_total_ttc != '') {
$sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
}
if ($search_warehouse != '' && $search_warehouse != '-1') {
if ($search_warehouse != '' && $search_warehouse > 0) {
$sql .= natural_search('c.fk_warehouse', $search_warehouse, 1);
}
if ($search_multicurrency_code != '') {
@ -838,7 +838,7 @@ if ($resql) {
$formproduct = new FormProduct($db);
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Warehouse');
$moreforfilter .= img_picto($tmptitle, 'warehouse', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle);
$moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle);
$moreforfilter .= '</div>';
}
$parameters = array();
@ -1631,7 +1631,7 @@ if ($resql) {
}
$stock_order = $generic_product->stats_commande['qty'];
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
$generic_product->load_stats_commande_fournisseur(0, '3');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
@ -1653,7 +1653,7 @@ if ($resql) {
} else {
$text_info .= '<span class="ok">'.$langs->trans('Available').'&nbsp;:&nbsp;'.$text_stock_reel.'</span>';
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$text_info .= '&nbsp;'.$langs->trans('SupplierOrder').'&nbsp;:&nbsp;'.$stock_order_supplier.'<br>';
} else {
$text_info .= '<br>';

View File

@ -188,7 +188,7 @@ if ($id > 0 || !empty($ref)) {
$param = '&id='.$object->id.'&num='.urlencode($numref);
$moreparam = '&num='.urlencode($numref);
$relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/";
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}

View File

@ -139,7 +139,7 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->banque->modifier;
$permtoedit = $user->rights->banque->modifier;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}

View File

@ -1 +0,0 @@

View File

@ -152,7 +152,7 @@ if ($object->id) {
$modulepart = 'banque';
$permission = $user->rights->banque->modifier;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
print $langs->trans("ErrorUnknown");
}

View File

@ -1 +0,0 @@

View File

@ -1 +0,0 @@

View File

@ -128,7 +128,7 @@ if ($object->id) {
$modulepart = 'deplacement';
$permission = $user->rights->deplacement->creer;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
print $langs->trans("ErrorUnknown");
}

View File

@ -182,7 +182,7 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->facture->creer;
$permtoedit = $user->rights->facture->creer;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
}

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