Merge remote-tracking branch 'upstream/develop' into 14a38

This commit is contained in:
Alexandre SPANGARO 2021-04-14 16:43:16 +02:00
commit 89281d4875
225 changed files with 7747 additions and 1275 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

@ -543,17 +543,17 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email').$langs->trans("SendByMail"),
//'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
);
if ($user->rights->adherent->creer) {
$arrayofmassactions['close'] = $langs->trans("Resiliate");
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
}
if ($user->rights->adherent->supprimer) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array();

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

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

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

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

@ -421,12 +421,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
'enable'=>$langs->trans("Enable"),
'disable'=>$langs->trans("Disable"),
//'presend'=>img_picto('', 'email').$langs->trans("SendByMail"),
'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Enable"),
'disable'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Disable"),
);
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();

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

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

@ -355,10 +355,10 @@ $arrayofmassactions = array(
'set_all_events_to_finished' => $langs->trans("SetAllEventsToFinished"),
);
if ($user->rights->agenda->allactions->delete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->agenda->myactions->create) {
$arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array();

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);
}
@ -393,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";
@ -588,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";
@ -647,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

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

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

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

@ -290,14 +290,14 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"),
// 'presend'=>img_picto('', 'email').$langs->trans("SendByMail"),
// 'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
);
if ($user->rights->banque->supprimer) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->banque->modifier) {
$arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array();

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

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

View File

@ -944,10 +944,10 @@ if ($resql) {
$param .= $hookmanager->resPrint;
$arrayofmassactions = array(
'validate'=>$langs->trans("Validate"),
'generate_doc'=>$langs->trans("ReGeneratePDF"),
'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"),
'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'makepayment'=>$langs->trans("InvoicePaymentsLimits"), TODO Blank page when using this
);
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
@ -956,9 +956,9 @@ if ($resql) {
}
if ($user->rights->facture->supprimer) {
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
$arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft");
$arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Deletedraft");
} elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
$arrayofmassactions['predelete'] = $langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
}
if (in_array($massaction, array('presend', 'predelete'))) {

View File

@ -258,7 +258,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
// Last modified supplier invoices
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
$langs->load("boxes");
$facstatic = new FactureFournisseur($db);

View File

@ -165,9 +165,9 @@ if ($object->id) {
$modulepart = 'tax';
$permission = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$permtoedit = $user->rights->tax->charges->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

@ -588,10 +588,10 @@ if (count($amount)) {
if (!empty($conf->supplier_proposal->enabled) && $key > 0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$key.'">'.img_picto($langs->trans("ProposalStats"), "stats").'</a>&nbsp;';
}
if (!empty($conf->fournisseur->enabled) && $key > 0) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $key > 0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?mode=supplier&socid='.$key.'">'.img_picto($langs->trans("OrderStats"), "stats").'</a>&nbsp;';
}
if (!empty($conf->fournisseur->enabled) && $key > 0) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && $key > 0) {
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?mode=supplier&socid='.$key.'">'.img_picto($langs->trans("InvoiceStats"), "stats").'</a>&nbsp;';
}
print '</td>';

View File

@ -151,9 +151,9 @@ if ($object->id) {
print dol_get_fiche_end();
$permission = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$permtoedit = $user->rights->tax->charges->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

@ -167,10 +167,10 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) {
if ($object->thirdparty->fournisseur) {
$thirdTypeArray['supplier'] = $langs->trans("supplier");
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
}
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)) {
$elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders');
}

View File

@ -88,6 +88,8 @@ if ($id > 0) {
$upload_dir = $conf->societe->multidir_output[$object->entity].'/contact/'.dol_sanitizeFileName($object->ref);
$modulepart = 'contact';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contactdocument'));
/*
* Actions

View File

@ -653,15 +653,15 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"),
// 'presend'=>img_picto('', 'email').$langs->trans("SendByMail"),
// 'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->supprimer) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array();

View File

@ -48,6 +48,8 @@ if ($id > 0) {
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('contactcard'));
/*
* Actions

View File

@ -195,7 +195,7 @@ if ($object->id) {
$permission = $user->rights->contrat->creer;
$permtoedit = $user->rights->contrat->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

@ -438,12 +438,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
'generate_doc'=>$langs->trans("ReGeneratePDF"),
'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"),
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($user->rights->contrat->supprimer) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();

View File

@ -1265,42 +1265,6 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) {
}
}
// Closed records
if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissiontoclose) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$result = $objecttmp->cloture($user, 3);
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();
}
}
//var_dump($_POST);var_dump($massaction);exit;
// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before)

View File

@ -68,7 +68,7 @@ if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADH
$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || !empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) {
if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) {
$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
@ -112,10 +112,10 @@ if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUST
if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) {
$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) || !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)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) {
$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) {
$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
@ -130,7 +130,7 @@ if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUST
}
// Vendor payments
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) {
$arrayresult['searchintovendorpayments'] = array(
'position'=>175,
'img'=>'object_payment',

View File

@ -119,7 +119,11 @@ class box_dolibarr_state_board extends ModeleBoxes
'members' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire,
'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS),
'prospects' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS),
'suppliers' => !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
'suppliers' => ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->lire)
|| (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)
|| (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)
)
&& empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS),
'contacts' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire,
'products' => !empty($conf->product->enabled) && $user->rights->produit->lire,
'services' => !empty($conf->service->enabled) && $user->rights->service->lire,

View File

@ -432,7 +432,7 @@ class Conf
$this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
// To prepare split of module fournisseur into module 'fournisseur' + supplier_order + supplier_invoice
if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) { // By default, if module supplier is on, and we don't use yet the new modules, we set artificialy the module properties
if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) { // By default, if module supplier is on, and we don't use yet the new modules, we set artificially the module properties
$this->supplier_order = new stdClass();
$this->supplier_order->enabled = 1;
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");

View File

@ -883,7 +883,7 @@ class Form
$label = array();
$atleastonefavorite = 0;
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";
$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
$sql .= " WHERE active > 0";
//$sql.= " ORDER BY code ASC";
@ -902,7 +902,8 @@ class Form
$countryArray[$i]['code_iso'] = $obj->code_iso;
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
$countryArray[$i]['favorite'] = $obj->favorite;
$countryArray[$i]['favorite'] = $obj->favorite;
$countryArray[$i]['eec'] = $obj->eec;
$favorite[$i] = $obj->favorite;
$label[$i] = dol_string_unaccent($countryArray[$i]['label']);
$i++;
@ -959,9 +960,9 @@ class Form
}
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) {
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" selected data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
} else {
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
}
$out .= $labeltoshow;
$out .= '</option>';
@ -4718,11 +4719,20 @@ class Form
if (empty($morecss)) {
$morecss = 'minwidth100';
}
$show_empty = isset($input['select_show_empty']) ? $input['select_show_empty'] : 1;
$key_in_label = isset($input['select_key_in_label']) ? $input['select_key_in_label'] : 0;
$value_as_key = isset($input['select_value_as_key']) ? $input['select_value_as_key'] : 0;
$translate = isset($input['select_translate']) ? $input['select_translate'] : 0;
$maxlen = isset($input['select_maxlen']) ? $input['select_maxlen'] : 0;
$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
if (!empty($input['label'])) {
$more .= $input['label'].'</div><div class="tagtd left">';
}
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
$more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss);
$more .= '</div></div>'."\n";
} elseif ($input['type'] == 'checkbox') {
$more .= '<div class="tagtr">';

View File

@ -187,7 +187,7 @@ function societe_prepare_head(Societe $object)
}
// Related items
if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
&& empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) {
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");

View File

@ -58,7 +58,7 @@ function contact_prepare_head(Contact $object)
$tab++;
// Related items
if (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
if (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id;
$head[$tab][1] = $langs->trans("Referers");
$head[$tab][2] = 'consumption';

View File

@ -3511,9 +3511,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday',
'info', 'intervention', 'inventory', 'intracommreport',
'images', 'info', 'intervention', 'inventory', 'intracommreport',
'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right',
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom',
@ -3526,7 +3526,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_lot', 'object_mrp', 'object_other',
'object_payment', 'object_pdf', 'object_product', 'object_propal',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_reception', 'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement', 'object_workstation',
@ -3581,7 +3581,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'other'=>'square',
'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'resource'=>'laptop-house',
'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
@ -3657,7 +3657,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande', 'loan'=>'infobox-bank_account',
'eventorganization'=>'infobox-project',
'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal',
'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent',
'reception'=>'flip', 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent',
'resource'=>'infobox-action',
'salary'=>'infobox-bank_account', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
@ -3678,7 +3678,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944',
'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944',
'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa',
'website'=>'#304', 'workstation'=>'#a69944'
);

View File

@ -345,7 +345,7 @@ function getPurchaseInvoicePieChart($socid = 0)
{
global $conf, $db, $langs, $user;
if (!(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if (!((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) {
return '';
}
@ -1119,7 +1119,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$result = '';
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
$facstatic = new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";

View File

@ -28,7 +28,6 @@
*/
function payment_prepare_head(Paiement $object)
{
global $langs, $conf;
$h = 0;
@ -287,6 +286,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
}
}
} elseif ($type == 'member' || $type == 'membersubscription') {
$newtype = 'member';
$out = $urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : '');
if ($mode == 1) {
$out .= 'member_ref';
@ -301,10 +301,10 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
} else {
$out .= '&securekey='.($mode ? '<font color="#666666">' : '');
if ($mode == 1) {
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)";
$out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$newtype."' + member_ref)";
}
if ($mode == 0) {
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2);
$out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$newtype.$ref, 2);
}
$out .= ($mode ? '</font>' : '');
}

View File

@ -58,7 +58,7 @@ function product_prepare_head($object)
}
if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->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->fournisseur->lire)
|| (!empty($conf->margin->enabled) && $user->rights->margin->liretous)
) {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
@ -430,7 +430,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// Supplier 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)) {
$nblines++;
$ret = $product->load_stats_commande_fournisseur($socid);
if ($ret < 0) {
@ -468,7 +468,7 @@ function show_stats_for_company($product, $socid)
print '</tr>';
}
// Supplier invoices
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) {
$nblines++;
$ret = $product->load_stats_facture_fournisseur($socid);
if ($ret < 0) {

View File

@ -122,7 +122,7 @@ function project_prepare_head(Project $project)
$h++;
}
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))
|| !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) {

View File

@ -371,7 +371,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'commande_fournisseur') {
if (!$user->rights->fournisseur->commande->creer) {
if (!$user->rights->fournisseur->commande->creer || !$user->rights->supplier_order->creer) {
$createok = 0;
$nbko++;
}

View File

@ -9,7 +9,7 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__;
-- table llx_menu
--
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&amp;leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || $conf->fournisseur->enabled || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur|supplier_order|supplier_invoice', '($conf->societe->enabled && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) || !empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled || $conf->supplier_invoice->enabled))', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&amp;leftmenu=', 'ProductsPipeServices', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('bom|mrp', '$conf->bom->enabled || $conf->mrp->enabled', 16__+MAX_llx_menu__, __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&amp;leftmenu=', 'MRP', -1, 'mrp', '$user->rights->bom->read||$user->rights->mrp->read', '', 0, 31, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 32, __ENTITY__);
@ -166,18 +166,18 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1652__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/supplier_proposal/list.php?leftmenu=supplier_proposals', 'List', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1653__+MAX_llx_menu__, 'commercial', '', 1650__+MAX_llx_menu__, '/comm/propal/stats/index.php?leftmenu=supplier_proposals&amp;mode=supplier', 'Statistics', 1, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 2, __ENTITY__);
-- Commercial - Supplier's orders
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&amp;leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5103__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5104__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5105__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=2', 'StatusOrderApprovedShort', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5106__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=3', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5107__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=4', 'StatusOrderReceivedPartiallyShort', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5108__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=5', 'StatusOrderReceivedAll', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5109__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=6,7', 'StatusOrderCanceled', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5110__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=9', 'StatusOrderRefused', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 9, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5111__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;mode=supplier', 'Statistics', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?mainmenu=commercial&amp;leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers', 'List', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5103__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=0', 'StatusOrderDraftShort', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5104__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=1', 'StatusOrderValidated', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5105__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=2', 'StatusOrderApprovedShort', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5106__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=3', 'StatusOrderOnProcessShort', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5107__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=4', 'StatusOrderReceivedPartiallyShort', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->creer)', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5108__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=5', 'StatusOrderReceivedAll', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5109__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=6,7', 'StatusOrderCanceled', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 8, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled && $leftmenu=="orders_suppliers"', __HANDLER__, 'left', 5110__+MAX_llx_menu__, 'commercial', '', 5102__+MAX_llx_menu__, '/fourn/commande/list.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;statut=9', 'StatusOrderRefused', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 9, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5111__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&amp;leftmenu=orders_suppliers&amp;mode=supplier', 'Statistics', 1, 'orders', '($user->rights->fournisseur->commande->lire || $user->rights->supplier_order->lire)', '', 2, 7, __ENTITY__);
-- Commercial - Contracts
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?mainmenu=commercial&amp;leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?mainmenu=commercial&amp;action=create&amp;leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);

View File

@ -388,7 +388,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$nature = "sells";
}
if ($objp->nature == 3
&& (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))
&& ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))
&& empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
$nature = "purchases";
}

View File

@ -122,9 +122,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
'enabled'=> ((!empty($conf->societe->enabled) &&
(empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
)
|| (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
|| ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
),
'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire)),
'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire) || !empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->supplier_proposal->lire)),
'module'=>'societe|fournisseur'
);
$menu_arr[] = array(
@ -852,10 +852,10 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
// Suppliers
if (!empty($conf->societe->enabled) && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) {
if (!empty($conf->societe->enabled) && (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) || !empty($conf->supplier_proposal->enabled))) {
$langs->load("suppliers");
$newmenu->add("/societe/list.php?type=f&amp;leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire), '', $mainmenu, 'suppliers');
$newmenu->add("/societe/card.php?leftmenu=suppliers&amp;action=create&amp;type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire));
$newmenu->add("/societe/list.php?type=f&amp;leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers');
$newmenu->add("/societe/card.php?leftmenu=suppliers&amp;action=create&amp;type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire));
}
// Categories
@ -873,7 +873,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/categories/index.php?leftmenu=cat&amp;type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
// Categories suppliers
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)) {
$newmenu->add("/categories/index.php?leftmenu=catfournish&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire);
}
}
@ -889,7 +889,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire);
}
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)) {
$newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire);
}
$newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire);
@ -1043,7 +1043,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->societe->enabled) && !empty($conf->supplier_invoice->enabled)) {
$langs->load("bills");
$newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&amp;action=create", $langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&amp;action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
@ -1201,7 +1201,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->banque->enabled)) {
$newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70);
}
if (!empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))) {
if (!empty($conf->facture->enabled) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
$newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80);
}
if (!empty($conf->tax->enabled)) {
@ -1271,7 +1271,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$nature = "sells";
}
if ($objp->nature == 3
&& (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled))
&& ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))
&& empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
$nature = "purchases";
}
@ -1374,7 +1374,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') {
$modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
}
if ($modecompta && $conf->fournisseur->enabled) {
if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
$newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire);
$newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
@ -1384,7 +1384,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$modecompta = 'RECETTES-DEPENSES';
//if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED
if ($modecompta && $conf->fournisseur->enabled) {
if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) {
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) {
$newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire);
$newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire);
@ -1548,7 +1548,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (!empty($conf->variants->enabled)) {
$newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire);
}
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) {
if (!empty($conf->propal->enabled) || (!empty($conf->commande->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire);
}
@ -1565,7 +1565,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"'));
$newmenu->add("/product/card.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
$newmenu->add("/product/list.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->rights->service->lire);
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) {
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) {
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire);
}
// Categories

View File

@ -300,7 +300,11 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -342,7 +342,11 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -342,7 +342,11 @@ class pdf_crabe extends ModelePDFFactures
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -351,7 +351,11 @@ class pdf_sponge extends ModelePDFFactures
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -162,7 +162,7 @@ class modBanque extends DolibarrModules
"s.nom"=>"company", "s.code_compta"=>"company", "s.code_compta_fournisseur"=>"company"
);
$this->export_special_array[$r] = array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG');
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)) {
unset($this->export_fields_array[$r]['s.code_compta_fournisseur']);
unset($this->export_entities_array[$r]['s.code_compta_fournisseur']);
}

View File

@ -130,7 +130,7 @@ class modCategorie extends DolibarrModules
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$typeexample .= ($typeexample ? " / " : "")."0=Product-Service";
}
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)) {
$typeexample .= ($typeexample ? "/" : "")."1=Supplier";
}
if (!empty($conf->societe->enabled)) {
@ -484,7 +484,7 @@ class modCategorie extends DolibarrModules
}
// 1 Suppliers
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)) {
$r++;
$this->import_code[$r] = $this->rights_class.'_1_'.Categorie::$MAP_ID_TO_CODE[1];
$this->import_label[$r] = "CatSupLinks"; // Translation key

View File

@ -0,0 +1,485 @@
<?php
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Dorian Laurent <i.merraha@sofimedmaroc.com>
* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \defgroup partnership Module Partnership
* \brief Partnership module descriptor.
*
* \file htdocs/partnership/core/modules/modPartnership.class.php
* \ingroup partnership
* \brief Description and activation file for module Partnership
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
/**
* Description and activation class for module Partnership
* This module is base on this specification :
* https://wiki.dolibarr.org/index.php?title=Draft:Module_Partnership_management#Note
*/
class modPartnership extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $langs, $conf;
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'partnership';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page
$this->family = "crm";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '90';
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
// Module label (no space allowed), used if translation string 'ModulePartnershipName' not found (Partnership is name of module).
$this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModulePartnershipDesc' not found (Partnership is name of module).
$this->description = "PartnershipDescription";
// Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "PartnershipDescriptionLong";
// // Author
// $this->editor_name = 'Editor name';
// $this->editor_url = 'https://www.example.com';
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
$this->version = 'development';
// Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
// Key used in llx_const table to save module status enabled/disabled (where PARTNERSHIP is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
$this->picto = 'generic';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array(
// Set this to 1 if module has its own trigger directory (core/triggers)
'triggers' => 0,
// Set this to 1 if module has its own login method file (core/login)
'login' => 0,
// Set this to 1 if module has its own substitution function file (core/substitutions)
'substitutions' => 0,
// Set this to 1 if module has its own menus handler directory (core/menus)
'menus' => 0,
// Set this to 1 if module overwrite template dir (core/tpl)
'tpl' => 0,
// Set this to 1 if module has its own barcode directory (core/modules/barcode)
'barcode' => 0,
// Set this to 1 if module has its own models directory (core/modules/xxx)
'models' => 1,
// Set this to 1 if module has its own printing directory (core/modules/printing)
'printing' => 0,
// Set this to 1 if module has its own theme directory (theme)
'theme' => 0,
// Set this to relative path of css file if module has its own css file
'css' => array(
// '/partnership/css/partnership.css.php',
),
// Set this to relative path of js file if module must load a js on all pages
'js' => array(
// '/partnership/js/partnership.js.php',
),
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
'hooks' => array(
// 'data' => array(
// 'hookcontext1',
// 'hookcontext2',
// ),
// 'entity' => '0',
),
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 0,
);
// Data directories to create when module is enabled.
// Example: this->dirs = array("/partnership/temp","/partnership/subdir");
$this->dirs = array("/partnership/temp");
// Config pages. Put here list of php page, stored into partnership/admin directory, to use to setup module.
$this->config_page_url = array("setup.php@partnership");
// Dependencies
// A condition to hide module
$this->hidden = false;
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
$this->depends = array();
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
// The language file dedicated to your module
$this->langfiles = array("partnership@partnership");
// Prerequisites
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
// Messages at activation
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
//$this->automatic_activation = array('FR'=>'PartnershipWasAutomaticallyActivatedBecauseOfYourCountryChoice');
//$this->always_enabled = true; // If true, can't be disabled
// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example: $this->const=array(1 => array('PARTNERSHIP_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
// 2 => array('PARTNERSHIP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
// );
$this->const = array();
// Some keys to add into the overwriting translation tables
/*$this->overwrite_translation = array(
'en_US:ParentCompany'=>'Parent company or reseller',
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
)*/
if (!isset($conf->partnership) || !isset($conf->partnership->enabled)) {
$conf->partnership = new stdClass();
$conf->partnership->enabled = 0;
}
// Array to add new pages in new tabs
$this->tabs = array();
$tabtoadd = ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') ? 'member' : 'thirdparty';
if ($tabtoadd == 'member') {
$this->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__');
$fk_mainmenu = "members";
} else {
$this->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__');
$fk_mainmenu = "companies";
}
// Example:
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@partnership:$user->rights->partnership->read:/partnership/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@partnership:$user->rights->othermodule->read:/partnership/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
//
// Where objecttype can be
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
// 'contact' to add a tab in contact view
// 'contract' to add a tab in contract view
// 'group' to add a tab in group view
// 'intervention' to add a tab in intervention view
// 'invoice' to add a tab in customer invoice view
// 'invoice_supplier' to add a tab in supplier invoice view
// 'member' to add a tab in fundation member view
// 'opensurveypoll' to add a tab in opensurvey poll view
// 'order' to add a tab in customer order view
// 'order_supplier' to add a tab in supplier order view
// 'payment' to add a tab in payment view
// 'payment_supplier' to add a tab in supplier payment view
// 'product' to add a tab in product view
// 'propal' to add a tab in propal view
// 'project' to add a tab in project view
// 'stock' to add a tab in stock view
// 'thirdparty' to add a tab in third party view
// 'user' to add a tab in user view
// Dictionaries
$this->dictionaries = array();
/* Example:
$this->dictionaries=array(
'langs'=>'partnership@partnership',
// List of tables we want to see into dictonnary editor
'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"),
// Label of tables
'tablib'=>array("Table1", "Table2", "Table3"),
// Request to select fields
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
// Sort order
'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
// List of fields (result of select to show dictionary)
'tabfield'=>array("code,label", "code,label", "code,label"),
// List of fields (list of fields to edit a record)
'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
// List of fields (list of fields for insert)
'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
// Name of columns with primary key (try to always name it 'rowid')
'tabrowid'=>array("rowid", "rowid", "rowid"),
// Condition to show each dictionary
'tabcond'=>array($conf->partnership->enabled, $conf->partnership->enabled, $conf->partnership->enabled)
);
*/
// Boxes/Widgets
// Add here list of php file(s) stored in partnership/core/boxes that contains a class to show a widget.
$this->boxes = array(
// 0 => array(
// 'file' => 'partnershipwidget1.php@partnership',
// 'note' => 'Widget provided by Partnership',
// 'enabledbydefaulton' => 'Home',
// ),
// ...
);
// Cronjobs (List of cron jobs entries to add when module is enabled)
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
$statusatinstall=0;
$arraydate=dol_getdate(dol_now());
$datestart=dol_mktime(21, 15, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array(
0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>$statusatinstall, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart),
);
// Permissions provided by this module
$this->rights = array();
$r = 0;
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read objects of Partnership'; // Permission label
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->partnership->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of Partnership'; // Permission label
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->partnership->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of Partnership'; // Permission label
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->partnership->level1->level2)
$r++;
/* END MODULEBUILDER PERMISSIONS */
// Main menu entries to add
$this->menu = array();
$r = 0;
// Add here entries to declare new menus
/* BEGIN MODULEBUILDER TOPMENU */
// $this->menu[$r++]=array(
// // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
// 'fk_menu'=>'fk_mainmenu=partnership',
// // This is a Left menu entry
// 'type'=>'left',
// 'titre'=>'List Partnership',
// 'mainmenu'=>'partnership',
// 'leftmenu'=>'partnership',
// 'url'=>'/partnership/partnership_list.php',
// // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'langs'=>'partnership@partnership',
// 'position'=>1100+$r,
// // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
// 'enabled'=>'$conf->partnership->enabled',
// // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules
// 'perms'=>'1',
// 'target'=>'',
// // 0=Menu for internal users, 1=external users, 2=both
// 'user'=>2,
// );
$this->menu[$r++] = array(
'fk_menu'=>'fk_mainmenu='.$fk_mainmenu, // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Top menu entry
'titre'=>'Partnership',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'mainmenu'=>$fk_mainmenu,
'leftmenu'=>'partnership',
'url'=>'/partnership/partnership_list.php',
'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100 + $r,
'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
$this->menu[$r++] = array(
'fk_menu'=>'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'NewPartnership',
'mainmenu'=>$fk_mainmenu,
'leftmenu'=>'partnership_new',
'url'=>'/partnership/partnership_card.php?action=create',
'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100 + $r,
'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->partnership->write', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
$this->menu[$r++] = array(
'fk_menu'=>'fk_mainmenu='.$fk_mainmenu.',fk_leftmenu=partnership', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'ListOfPartnerships',
'mainmenu'=>$fk_mainmenu,
'leftmenu'=>'partnership_list',
'url'=>'/partnership/partnership_list.php',
'langs'=>'partnership', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100 + $r,
'enabled'=>'$conf->partnership->enabled', // Define condition to show or hide menu entry. Use '$conf->partnership->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->partnership->read', // Use 'perms'=>'$user->rights->partnership->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
/* END MODULEBUILDER LEFTMENU PARTNERSHIP */
// Exports profiles provided by this module
$r = 1;
/* BEGIN MODULEBUILDER EXPORT PARTNERSHIP */
/*
$langs->load("partnership@partnership");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='partnership@partnership';
// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
$keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
//unset($this->export_fields_array[$r]['t.fieldtoremove']);
//$keyforclass = 'PartnershipLine'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnershipline@partnership'; $keyforalias='tl';
//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$keyforselect='partnershipline'; $keyforaliasextra='extraline'; $keyforelement='partnershipline@partnership';
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$this->export_dependencies_array[$r] = array('partnershipline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
//$this->export_special_array[$r] = array('t.field'=>'...');
//$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
//$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'partnership as t';
//$this->export_sql_end[$r] =' LEFT JOIN '.MAIN_DB_PREFIX.'partnership_line as tl ON tl.fk_partnership = t.rowid';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('partnership').')';
$r++; */
/* END MODULEBUILDER EXPORT PARTNERSHIP */
// Imports profiles provided by this module
$r = 1;
/* BEGIN MODULEBUILDER IMPORT PARTNERSHIP */
/*
$langs->load("partnership@partnership");
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='PartnershipLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='partnership@partnership';
$keyforclass = 'Partnership'; $keyforclassfile='/partnership/class/partnership.class.php'; $keyforelement='partnership@partnership';
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
$keyforselect='partnership'; $keyforaliasextra='extra'; $keyforelement='partnership@partnership';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'partnership as t';
$this->export_sql_end[$r] .=' WHERE 1 = 1';
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('partnership').')';
$r++; */
/* END MODULEBUILDER IMPORT PARTNERSHIP */
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
global $conf, $langs;
$result = $this->_load_tables('/partnership/sql/');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Create extrafields during init
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
//$extrafields = new ExtraFields($this->db);
//$result1=$extrafields->addExtraField('partnership_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled');
//$result2=$extrafields->addExtraField('partnership_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled');
//$result3=$extrafields->addExtraField('partnership_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled');
//$result4=$extrafields->addExtraField('partnership_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled');
//$result5=$extrafields->addExtraField('partnership_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'partnership@partnership', '$conf->partnership->enabled');
// Permissions
$this->remove($options);
$sql = array();
// Document templates
$moduledir = 'partnership';
$myTmpObjects = array();
$myTmpObjects['Partnership'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if ($myTmpObjectKey == 'Partnership') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/partnership/template_partnerships.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/partnership';
$dest = $dirodt.'/template_partnerships.odt';
if (file_exists($src) && !file_exists($dest)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result = dol_copy($src, $dest, 0, 0);
if ($result < 0) {
$langs->load("errors");
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
return 0;
}
}
$sql = array_merge($sql, array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
));
}
}
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function remove($options = '')
{
$sql = array();
return $this->_remove($sql, $options);
}
}

View File

@ -203,7 +203,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (!empty($conf->stock->enabled)) {
@ -216,7 +216,7 @@ class modProduct extends DolibarrModules
$keyforelement = 'product';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
@ -250,7 +250,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -269,7 +269,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -284,7 +284,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -305,7 +305,7 @@ class modProduct extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
}
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
}
if (!empty($conf->stock->enabled)) {
@ -609,7 +609,7 @@ class modProduct extends DolibarrModules
));
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (is_object($mysoc) && $usenpr) {
@ -702,7 +702,7 @@ class modProduct extends DolibarrModules
'p.desiredstock' => ''
));
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
}
if (is_object($mysoc) && $usenpr) {
@ -741,7 +741,7 @@ class modProduct extends DolibarrModules
$this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
// Import suppliers prices (note: this code is duplicated in module Service)
$r++;
$this->import_code[$r] = $this->rights_class.'_supplierprices';

View File

@ -168,7 +168,7 @@ class modService extends DolibarrModules
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (!empty($conf->stock->enabled)) {
@ -181,7 +181,7 @@ class modService extends DolibarrModules
$keyforelement = 'product';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
}
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
@ -213,7 +213,7 @@ class modService extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -232,7 +232,7 @@ class modService extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -247,7 +247,7 @@ class modService extends DolibarrModules
if (!empty($conf->barcode->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
}
if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -268,7 +268,7 @@ class modService extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
}
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
}
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
@ -564,7 +564,7 @@ class modService extends DolibarrModules
));
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
}
if (is_object($mysoc) && $usenpr) {
@ -655,7 +655,7 @@ class modService extends DolibarrModules
'p.desiredstock' => ''
));
}
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled) || !empty($conf->margin->enabled)) {
$import_sample = array_merge($import_sample, array('p.cost_price'=>'90'));
}
if (is_object($mysoc) && $usenpr) {
@ -698,7 +698,7 @@ class modService extends DolibarrModules
}
if (empty($conf->product->enabled)) { // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
// Import suppliers prices (note: this code is duplicated in module Service)
$r++;
$this->import_code[$r] = $this->rights_class.'_supplierprices';

View File

@ -384,7 +384,7 @@ class modSociete extends DolibarrModules
's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company",
't.libelle'=>"company"
); // We define here only fields that use another picto
if (empty($conf->fournisseur->enabled)) {
if (empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
unset($this->export_fields_array[$r]['s.code_fournisseur']);
unset($this->export_entities_array[$r]['s.code_fournisseur']);
}

View File

@ -84,6 +84,16 @@ class mod_lot_advanced extends ModeleNumRefBatch
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
// Option to enable custom masks per product
$texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&amp;value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&amp;value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
$texte .= ' '.$langs->trans('CustomMasks')."\n";
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';

View File

@ -84,6 +84,16 @@ class mod_sn_advanced extends ModeleNumRefBatch
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
// Option to enable custom masks per product
$texte .= '<td class="right">';
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&amp;value=0">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
$texte .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&amp;value=1">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
$texte .= ' '.$langs->trans('CustomMasks')."\n";
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';

View File

@ -49,10 +49,10 @@ if (!empty($conf->facture->enabled)) {
if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
}
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)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
}
if (!empty($conf->contrat->enabled)) {
@ -964,13 +964,13 @@ class doc_generic_project_odt extends ModelePDFProjects
'title' => "ListSupplierOrdersAssociatedProject",
'table' => 'commande_fournisseur',
'class' => 'CommandeFournisseur',
'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire
'test' => (!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)
),
'invoice_supplier' => array(
'title' => "ListSupplierInvoicesAssociatedProject",
'table' => 'facture_fourn',
'class' => 'FactureFournisseur',
'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire
'test' => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)
),
'contract' => array(
'title' => "ListContractAssociatedProject",

View File

@ -400,7 +400,7 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire,
'test'=>(!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),
'lang'=>'orders'),
'invoice_supplier'=>array(
'name'=>"BillsSuppliers",
@ -409,7 +409,7 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'minus',
'table'=>'facture_fourn',
'datefieldname'=>'datef',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire,
'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire),
'lang'=>'bills'),
'contract'=>array(
'name'=>"Contracts",

View File

@ -50,10 +50,10 @@ if (!empty($conf->facture->enabled)) {
if (!empty($conf->commande->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
}
if (!empty($conf->fournisseur->enabled)) {
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
}
if (!empty($conf->contrat->enabled)) {

View File

@ -30,6 +30,7 @@
* \ingroup propale
* \brief File of Class to generate PDF proposal with Azur template
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
@ -332,7 +333,11 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -337,7 +337,11 @@ class pdf_cyan extends ModelePDFPropales
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->multidir_output[$object->entity].'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$logodir = $conf->mycompany->dir_output;
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
$logodir = $conf->mycompany->multidir_output[$object->entity];
}
$pagecount = $pdf->setSourceFile($logodir.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}

View File

@ -879,7 +879,7 @@ class pdf_squille extends ModelePdfReception
$origin_id = $object->origin_id;
// TODO move to external function
if (!empty($conf->fournisseur->enabled)) { // commonly $origin='commande'
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) { // commonly $origin='commande'
$outputlangs->load('orders');
$classname = 'CommandeFournisseur';

View File

@ -44,9 +44,17 @@ if ($module == 'propal') {
} elseif ($module == 'fichinter') {
$permission = $user->rights->ficheinter->creer;
} elseif ($module == 'order_supplier') {
$permission = $user->rights->fournisseur->commande->creer;
} elseif ($module == 'invoice_supplier') {
$permission = $user->rights->fournisseur->facture->creer;
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->commande->creer;
} else {
$permission = $user->rights->supplier_order->creer;
}
} elseif ($module == 'invoice_supplier' && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
} else {
$permission = $user->rights->supplier_invoice->creer;
}
} elseif ($module == 'project') {
$permission = $user->rights->projet->creer;
} elseif ($module == 'action') {

View File

@ -76,9 +76,6 @@ if ($action == 'delete') {
);
}
$formfile = new FormFile($db);
// We define var to enable the feature to add prefix of uploaded files.
// Caller of this include can make
// $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
@ -115,6 +112,10 @@ if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_
}
}
if (!is_object($formfile)) {
$formfile = new FormFile($db);
}
// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject) ? '' : '&withproject=1').(empty($moreparam) ? '' : $moreparam),

View File

@ -162,10 +162,18 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
$permok = !empty($user->rights->$keyforperm->creer) || !empty($user->rights->$keyforperm->create) || !empty($user->rights->$keyforperm->write);
}
if ($object->element == 'order_supplier') {
$permok = $user->rights->fournisseur->commande->creer;
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permok = $user->rights->fournisseur->commande->creer;
} else {
$permok = $user->rights->supplier_order->creer;
}
}
if ($object->element == 'invoice_supplier') {
$permok = $user->rights->fournisseur->facture->creer;
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permok = $user->rights->fournisseur->facture->creer;
} else {
$permok = $user->rights->supplier_invoice->creer;
}
}
if ($object->element == 'shipping') {
$permok = $user->rights->expedition->creer;

View File

@ -73,21 +73,23 @@ print '<div class="inline-block toolbarbutton centpercent">';
if ($permtoadd) {
$websitekeyandpageid = (!empty($websitekey) ? '&website='.$websitekey : '').(!empty($pageid) ? '&pageid='.$pageid : '');
print '<a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&module='.urlencode($module).$websitekeyandpageid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1'.$websitekeyandpageid).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans('ECMAddSection')).'">';
print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print img_picto('', 'folder-plus', '', false, 0, 0, '', 'size15x marginrightonly');
print '</a>';
} else {
print '<a href="#" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.$langs->trans("NotAllowed").'">';
print '<img class="toolbarbutton disabled" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
print img_picto('', 'folder-plus', 'disabled', false, 0, 0, '', 'size15x marginrightonly');
print '</a>';
}
if ($module == 'ecm') {
$tmpurl = ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&amp;module='.$module : '').($section ? '&amp;section='.$section : '')));
print '<a href="'.$tmpurl.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans('ReSyncListOfDir')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly');
print '</a>';
}
if ($permtoadd) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=confirmconvertimgwebp&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'"><span class="fa fa-cogs"><span></a>';
if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site
print '<a href="'.$_SERVER["PHP_SELF"].'?action=confirmconvertimgwebp&website='.$website->ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">';
print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly');
print '</a>';
}
// Start "Add new file" area

View File

@ -70,9 +70,17 @@ if ($module == 'propal') {
} elseif ($module == 'project_task') {
$permission = $user->rights->projet->creer;
} elseif ($module == 'invoice_supplier') {
$permission = $user->rights->fournisseur->facture->creer;
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->facture->creer;
} else {
$permission = $user->rights->supplier_invoice->creer;
}
} elseif ($module == 'order_supplier') {
$permission = $user->rights->fournisseur->commande->creer;
if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) {
$permission = $user->rights->fournisseur->commande->creer;
} else {
$permission = $user->rights->supplier_order->creer;
}
} elseif ($module == 'societe') {
$permission = $user->rights->societe->creer;
} elseif ($module == 'contact') {

View File

@ -192,7 +192,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// First classify billed the order to allow the proposal classify process
if (!empty($conf->fournisseur->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) {
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) {
$object->fetchObjectLinked('', 'order_supplier', $object->id, $object->element);
if (!empty($object->linkedObjects)) {
$totalonlinkedelements = 0;

View File

@ -132,9 +132,9 @@ class InterfaceNotification extends DolibarrTriggers
$element = $obj->elementtype;
// Exclude events if related module is disabled
if ($element == 'order_supplier' && empty($conf->fournisseur->enabled)) {
if ($element == 'order_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))) {
$qualified = 0;
} elseif ($element == 'invoice_supplier' && empty($conf->fournisseur->enabled)) {
} elseif ($element == 'invoice_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled))) {
$qualified = 0;
} elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) {
$qualified = 0;

View File

@ -188,10 +188,10 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'don';
$permission = $user->rights->don->lire;
$permission = $user->rights->don->creer;
$permtoedit = $user->rights->don->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

@ -330,11 +330,11 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (!empty($conf->supplier_proposal->enabled)) {
$langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
}
if (!empty($conf->fournisseur->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
}
if (!empty($conf->fournisseur->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
}
if (!empty($conf->tax->enabled)) {
$langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
@ -393,7 +393,7 @@ print '<div class="inline-block toolbarbutton centpercent">';
// Toolbar
$url = ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&amp;module='.$module : '').($section ? '&amp;section='.$section : '')));
print '<a href="'.$url.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
print '<img id="refreshbutton" class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
print img_picto('', 'refresh', 'id="refreshbutton"', false, 0, 0, '', 'size15x marginrightonly');
print '</a>';
print '</div>';

View File

@ -128,11 +128,11 @@ if (!empty($conf->facture->enabled)) {
if (!empty($conf->supplier_proposal->enabled)) {
$langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals")));
}
if (!empty($conf->fournisseur->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
}
if (!empty($conf->fournisseur->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
}
if (!empty($conf->tax->enabled)) {
$langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));

View File

@ -494,11 +494,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_soc']); // Hide field already shown in banner
global $dolibarr_main_url_root;
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id=';
$key = 'DV3PH';
$link_subscription .= dol_encode($id, $key);
$link_subscription .= '&securekey='.urlencode($conf->global->EVENTORGANIZATION_SECUREKEY);
$object->fields['pubregister'] = array('type'=>'url', 'label'=>'Lien public d\'enregistrement à une conférence', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
$object->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
$object->pubregister = $link_subscription;
$keyforbreak='pubregister';

View File

@ -573,13 +573,13 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
//'validate'=>$langs->trans("Validate"),
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
//'validate'=>img_picto('', 'check').$langs->trans("Validate"),
//'generate_doc'=>img_picto('', 'pdf').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email').$langs->trans("SendByMail"),
);
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();

View File

@ -580,13 +580,13 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
//'validate'=>$langs->trans("Validate"),
//'generate_doc'=>$langs->trans("ReGeneratePDF"),
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
//'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();

View File

@ -60,7 +60,9 @@ $result = restrictedArea($user, 'eventorganization');
$form = new Form($db);
$formfile = new FormFile($db);
llxHeader("", $langs->trans("EventOrganizationArea"));
$title = $langs->trans('EventOrganizationArea');
llxHeader('', $title, '');
print load_fiche_titre($langs->trans("EventOrganizationArea"), '', 'eventorganization.png@eventorganization');

View File

@ -180,7 +180,7 @@ if ($id > 0 || !empty($ref)) {
$permission = $user->rights->expedition->creer;
$permtoedit = $user->rights->expedition->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