Merge branch 'develop' of github.com:Dolibarr/dolibarr into new_setup_form_help_class

This commit is contained in:
John BOTELLA 2021-10-24 01:38:42 +02:00
commit aaa7fd5b3a
239 changed files with 1395 additions and 1838 deletions

View File

@ -38,6 +38,7 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
$search_account = GETPOST('search_account', 'alpha');
@ -438,43 +439,37 @@ if ($resql) {
print $searchpicto;
print '</td>';
print '</tr>';
$totalarray = array();
print '<tr class="liste_titre">';
if (!empty($arrayfields['aa.account_number']['checked'])) {
print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.label']['checked'])) {
print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.labelshort']['checked'])) {
print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.account_parent']['checked'])) {
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
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) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['aa.active']['checked'])) {
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
$totalarray = array();
$totalarray['nbfield'] = 0;
$i = 0;
while ($i < min($num, $limit)) {

View File

@ -744,7 +744,7 @@ if ($resql) {
print '<td></td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('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;

View File

@ -109,7 +109,7 @@ foreach ($list_account_main as $key) {
print '</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
print '</td>';
print '</tr>';
}

View File

@ -186,7 +186,7 @@ foreach ($list_account as $key) {
print '<td width="50%">'.$label.'</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print '</td>';
print '</tr>';
}

View File

@ -52,7 +52,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) {
accessforbidden();
}
if (!$user->rights->accounting->fiscalyear->write) { // If we can read accounting records, we should be able to see fiscal year.
if (empty($user->rights->accounting->fiscalyear->write)) { // If we can read accounting records, we should be able to see fiscal year.
accessforbidden();
}

View File

@ -33,7 +33,7 @@ $langs->loadLangs(array("admin", "compta"));
if ($user->socid > 0) {
accessforbidden();
}
if (!$user->rights->accounting->fiscalyear->write) {
if (empty($user->rights->accounting->fiscalyear->write)) {
accessforbidden();
}

View File

@ -612,7 +612,7 @@ if ($id) {
print '</td>';
} else {
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$parameters = array('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;

View File

@ -70,6 +70,7 @@ $search_onpurchase = GETPOST('search_onpurchase', 'alpha');
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
$btn_changetype = GETPOST('changetype', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
if (empty($accounting_product_mode)) {
$accounting_product_mode = 'ACCOUNTANCY_SELL';
@ -253,35 +254,35 @@ $form = new FormAccounting($db);
// so we need to get those the rowid of those default value first
$accounting = new AccountingAccount($db);
// TODO: we should need to check if result is already exists accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
$aarowid_servbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT'), 1);
$aarowid_servbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT'), 1);
$aarowid_servbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT'), 1);
$aarowid_prodbuy = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT'), 1);
$aarowid_prodbuy_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT'), 1);
$aarowid_prodbuy_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT'), 1);
$aarowid_servsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT'), 1);
$aarowid_servsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT'), 1);
$aarowid_servsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT'), 1);
$aarowid_prodsell = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT'), 1);
$aarowid_prodsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT'), 1);
$aarowid_prodsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT'), 1);
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_servbuy_intra = getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_servbuy_export = getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodbuy = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodbuy_intra = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodbuy_export = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_servsell = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_servsell_intra = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_servsell_export = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodsell = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodsell_intra = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
$aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
llxHeader('', $langs->trans("ProductsBinding"));
$pcgverid = $conf->global->CHARTOFACCOUNTS;
$pcgverid = getDolGlobalString('CHARTOFACCOUNTS');
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
if (empty($pcgvercode)) {
$pcgvercode = $pcgverid;

View File

@ -36,6 +36,7 @@ $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
$search_subaccount = GETPOST('search_subaccount', 'alpha');
@ -367,6 +368,7 @@ if ($resql) {
print "</tr>\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
$i = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

View File

@ -512,10 +512,10 @@ if ($action == 'create') {
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Doc type
if (!empty($object->doc_type)) {
@ -591,7 +591,7 @@ if ($action == 'create') {
*/
print "</table>\n";
print '</div></div><!-ee-->';
print '</div>';
print dol_get_fiche_end();

View File

@ -63,7 +63,7 @@ if (empty($conf->accounting->enabled)) {
if ($user->socid > 0) {
accessforbidden();
}
if (!$user->rights->accounting->fiscalyear->write) {
if (empty($user->rights->accounting->fiscalyear->write)) {
accessforbidden();
}

View File

@ -613,7 +613,7 @@ if ($result) {
// Ref Invoice
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($facture_static->datef), 'day').'</td>';
print '<td class="center">'.dol_print_date($db->jdate($facture_static->date), 'day').'</td>';
// Ref Product
print '<td class="tdoverflowmax150">';

View File

@ -1783,10 +1783,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield tableforfield" width="100%">';
print '<table class="border tableforfield tableforfield centpercent">';
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
@ -1872,7 +1872,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</table>\n";
print "</div></div></div>\n";
print "</div></div>\n";
print '<div style="clear:both"></div>';
print dol_get_fiche_end();
@ -2045,7 +2045,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print showOnlinePaymentUrl('membersubscription', $object->ref);
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
$MAX = 10;
@ -2056,7 +2056,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, 'listactions', $MAX, '', $morehtmlcenter);
print '</div></div></div>';
print '</div></div>';
}
// Presend form

View File

@ -210,7 +210,7 @@ print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Show graphs
@ -225,7 +225,7 @@ if ($mesg) {
print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';

View File

@ -557,10 +557,10 @@ if ($rowid > 0) {
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Birthday
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
@ -652,7 +652,7 @@ if ($rowid > 0) {
print "</table>\n";
print "</div></div></div>\n";
print "</div></div>\n";
print '<div style="clear:both"></div>';
print dol_get_fiche_end();

View File

@ -388,7 +388,7 @@ if ($rowid && $action != 'edit') {
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
*/
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// List of actions on element
/*
@ -397,7 +397,7 @@ if ($rowid && $action != 'edit') {
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1);
*/
print '</div></div></div>';
print '</div></div>';
}
// End of page

View File

@ -76,11 +76,11 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
if ($forcelangprod == $current_lang) {
$object->label = GETPOST("libelle", 'alphanohtml');
$object->description = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
//$object->other = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
} else {
$object->multilangs[$forcelangprod]["label"] = GETPOST("libelle", 'alphanohtml');
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr(GETPOST("desc", 'restricthtml'));
$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
//$object->multilangs[$forcelangprod]["other"] = dol_htmlcleanlastbr(GETPOST("other", 'restricthtml'));
}
// backup into database

View File

@ -105,7 +105,7 @@ foreach ($list as $key) {
// Value
print '<td>';
if (!empty($conf->accounting->enabled)) {
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
} else {
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
}

View File

@ -163,7 +163,7 @@ print '<br>';
// XDebug
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled');
$test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
if ($test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
} else {

View File

@ -539,13 +539,11 @@ print "</div> <!-- end div fichehalfleft -->\n";
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
print '<div class="ficheaddleft">';
$filearray = dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>';
print '</div>';
print '</div>';
print '</form>';
print '</fieldset>';
@ -620,13 +618,11 @@ print '</div>';
print '</div>';
print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
print '<div class="ficheaddleft">';
$filearray = dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
$result = $formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousArchiveFiles"));
print '<br>';
print '</div>';
print '</div>';
print '</fieldset>';

View File

@ -325,7 +325,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
@ -336,7 +336,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlright);
print '</div></div></div>';
print '</div></div>';
}
}

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
accessforbidden();
}

View File

@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$id = GETPOST('id', 'int');
$block = new BlockedLog($db);
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
accessforbidden();
}

View File

@ -0,0 +1,28 @@
<?php
require '../../main.inc.php';
$action = GETPOST('action', 'alphanohtml');
$select_product_val = GETPOST('select_product_val', 'int');
$current_bom_id = GETPOST('current_bom_id', 'int');
global $db;
switch ($action) {
case 'select_BOM':
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
$sql.= ' WHERE fk_product='.(int) $select_product_val.' AND b.rowid<>'. (int) $current_bom_id;
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
$cpt=0;
while ($obj = $db->fetch_object($resql)) {
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
$cpt++;
}
print json_encode($options);
}
break;
}

View File

@ -149,6 +149,7 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$idprod = (int) GETPOST('idprod', 'int');
$bom_child = (int) GETPOST('bom_select', 'int');
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
@ -172,6 +173,7 @@ if (empty($reshook)) {
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->fk_bom_child = $bom_child;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
@ -571,9 +573,78 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '</table>';
}
?>
<script>
let select_product_val;
let current_bom_id = <?php echo $object->id?>;
//On change on the bom select
$('#idprod').on('change', function () {
select_product_val = $('#idprod').select2().val();
//Ajax to set all options without reloading the page
$.ajax({
url: 'script/interface.php'
, method: 'POST'
, dataType: 'text'
, data: {
action: 'select_BOM'
, select_product_val: select_product_val
, current_bom_id: current_bom_id
}
}).done(function (data) {
//To remove all options of the bom select on change
$('#bom_select').get(0).length = 0;
//To set options for the bom select on change
let options = JSON.parse(data)
for (let key in options) {
let opt = new Option(options[key], key);
$('#bom_select').append(opt)
}
})
})
</script>
<?php
print '</div>';
print "</form>\n";
?>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$(".collapse_bom").click(function() {
var id_bom_line = $(this).attr('id').replace('collapse-', '');
if($(this).text().indexOf('+') > 0) {
$('[parentid="'+ id_bom_line +'"]').show();
$(this).html('(-)&nbsp;');
}
else {
$('[parentid="'+ id_bom_line +'"]').hide();
$(this).html('(+)&nbsp;');
}
return false;
});
//To Show all the sub bom lines
$("#show_all").click(function() {
$("[class^=sub_bom_lines]").show();
$("[class^=collapse_bom]").html('(-)&nbsp;');
return false;
});
//To Hide all the sub bom lines
$("#hide_all").click(function() {
$("[class^=sub_bom_lines]").hide();
$("[class^=collapse_bom]").html('(+)&nbsp;');
return false;
});
});
</script>
<?php
}
@ -690,7 +761,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
@ -703,7 +774,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, $object->element, $socid, 1, '', $MAXEVENT, '', $morehtmlright);
print '</div></div></div>';
print '</div></div>';
}
//Select mail models is same action as presend

View File

@ -1139,6 +1139,7 @@ class BOMLine extends CommonObjectLine
'rowid' => array('type'=>'integer', 'label'=>'LineID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'fk_bom_child' => array('type'=>'integer:BOM:bom/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'notnull'=>-1,),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
@ -1163,6 +1164,11 @@ class BOMLine extends CommonObjectLine
*/
public $fk_product;
/**
* @var int Id of parent bom
*/
public $fk_bom_child;
/**
* @var string description
*/

View File

@ -61,6 +61,8 @@ if ($nolinesbefore) {
print '<td class="linecoldescription minwidth500imp">';
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
print '</td>';
// Linked BOM
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '<td class="linecoluseunit left">';
@ -107,6 +109,10 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
echo '</span>';
}
$coldisplay++;
print '<td class="bordertop nobottom linecolbom">';
print '<select id="bom_select" name="bom_select"><options value="-1"></options></select>';
print '</td>';
$coldisplay++;
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';

View File

@ -97,6 +97,8 @@ print '</td>';
*/
$coldisplay++;
// For BOM
print '<td></td>';
print '<td class="nobottom linecolqty right">';
if (($line->info_bits & 2) != 2) {

View File

@ -43,6 +43,8 @@ print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
print "<thead>\n";
print '<tr class="liste_titre nodrag nodrop">';
print '<a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
@ -52,6 +54,9 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
// Linked BOM
print '<td class="linecolBOM">'.$langs->trans('BOM').'</td>';
// Qty
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).'</td>';

View File

@ -80,9 +80,22 @@ print '<div id="line_'.$line->id.'"></div>';
$coldisplay++;
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
$res = $tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)) {
print '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . '&nbsp;</a>';
}
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
print '</td>';
// To show BOM links in the list
if ($res > 0) {
print '<td id="bom_id">'.$tmpbom->getNomUrl(1).'</td>';
} else {
print '<td id="bom_id">&nbsp;</td>';
}
print '<td class="linecolqty nowrap right">';
$coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
@ -111,7 +124,8 @@ $coldisplay++;
echo $line->efficiency;
print '</td>';
print '<td class="linecolcost nowrap right">';
$total_cost = 0;
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
$coldisplay++;
echo price($line->total_cost);
print '</td>';
@ -166,6 +180,93 @@ if ($action == 'selectlines') {
print '</tr>';
// Select of all the sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $object->db->query($sql);
if ($resql) {
// Loop on all the sub-BOM lines if they exist
while ($obj = $object->db->fetch_object($resql)) {
$sub_bom_product = new Product($object->db);
$sub_bom_product->fetch($obj->fk_product);
$sub_bom = new BOM($object->db);
$sub_bom->fetch($obj->fk_bom_child);
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
//If hidden conf is set, we show directly all the sub-BOM lines
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
print '<tr style="display:none" class="sub_bom_lines" parentid="'.$line->id.'">';
} else {
print '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
}
// Product
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">'.$sub_bom_product->getNomUrl(1).'</td>';
// Sub-BOM
if ($sub_bom_line->fk_bom_child > 0) {
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'">'.$sub_bom->getNomUrl(1).'</td>';
} else {
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'">&nbsp;</td>';
}
// Qty
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
if ($sub_bom_line->qty_frozen > 0) {
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$sub_bom_line->qty_frozen.'</td>';
} else {
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">&nbsp;</td>';
}
// Disable stock change
if ($sub_bom_line->disable_stock_change > 0) {
print '<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.'">'.$sub_bom_line->disable_stock_change.'</td>';
} else {
print '<td class="linecoldisablestockchange nowrap right" id="sub_bom_stock_change_'.$sub_bom_line->id.'">&nbsp;</td>';
}
// Efficiency
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
// Cost price if it's defined
if ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
$total_cost.= $sub_bom_product->pmp * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($obj->min_price * $line->qty).'</td>';
$total_cost+= $obj->min_price * $line->qty;
}
}
print '<td></td>';
print '<td></td>';
print '<td></td>';
}
}
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
if ($total_cost > 0) {
$line->total_cost = price($total_cost);
?>
<script>
$('#costline_<?php echo $line->id?>').html("<?php echo "".price($total_cost)?>");
</script>
<?php
}
//Line extrafield
if (!empty($extrafields)) {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
$langs->loadLangs(array('bookmarks', 'other'));
// Security check
if (!$user->rights->bookmark->lire) {
if (empty($user->rights->bookmark->lire)) {
restrictedArea($user, 'bookmarks');
}

View File

@ -35,7 +35,7 @@ $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bookmarklist'; // To manage different context of search
// Security check
if (!$user->rights->bookmark->lire) {
if (empty($user->rights->bookmark->lire)) {
restrictedArea($user, 'bookmarks');
}
$optioncss = GETPOST('optioncss', 'alpha');

View File

@ -759,8 +759,6 @@ class Categorie extends CommonObject
}
return -1;
}
return 0;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -816,8 +814,6 @@ class Categorie extends CommonObject
$this->error = $this->db->lasterror();
return -1;
}
return 0;
}
/**

View File

@ -173,7 +173,12 @@ if ($elemid && $action == 'addintocategory' &&
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write)
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
($type == Categorie::TYPE_MEMBER && $user->rights->projet->creer) ||
($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) ||
($type == Categorie::TYPE_USER && $user->rights->user->user->creer) ||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
)) {
if ($type == Categorie::TYPE_PRODUCT) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -191,6 +196,26 @@ if ($elemid && $action == 'addintocategory' &&
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
$newobject = new Ticket($db);
$elementtype = 'ticket';
} elseif ($type == Categorie::TYPE_PROJECT) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$newobject = new Project($db);
$elementtype = 'project';
} elseif ($type == Categorie::TYPE_MEMBER) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$newobject = new Adherent($db);
$elementtype = 'member';
} elseif ($type == Categorie::TYPE_CONTACT) {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$newobject = new Contact($db);
$elementtype = 'contact';
} elseif ($type == Categorie::TYPE_USER) {
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$newobject = new User($db);
$elementtype = 'user';
} elseif ($type == Categorie::TYPE_ACCOUNT) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$newobject = new User($db);
$elementtype = 'bank_account';
}
$result = $newobject->fetch($elemid);
@ -538,6 +563,7 @@ if ($type == Categorie::TYPE_PRODUCT) {
}
}
// List of customers
if ($type == Categorie::TYPE_CUSTOMER) {
$permission = $user->rights->societe->creer;
@ -611,7 +637,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
}
}
// List of suppliers
if ($type == Categorie::TYPE_SUPPLIER) {
$permission = $user->rights->societe->creer;
@ -696,6 +722,26 @@ if ($type == Categorie::TYPE_MEMBER) {
if ($prods < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddMemberIntoCategory").' &nbsp;';
print $form->selectMembers('', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -752,6 +798,25 @@ if ($type == Categorie::TYPE_CONTACT) {
if ($contacts < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddContactIntoCategory").' &nbsp;';
print $form->selectContacts('', '', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -817,6 +882,26 @@ if ($type == Categorie::TYPE_ACCOUNT) {
if ($accounts < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddAccountIntoCategory").' &nbsp;';
$form->select_comptes('', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -874,6 +959,26 @@ if ($type == Categorie::TYPE_PROJECT) {
if ($objects < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddProjectIntoCategory").' &nbsp;';
$form->selectProjects('', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
@ -930,6 +1035,25 @@ if ($type == Categorie::TYPE_USER) {
if ($users < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
$showclassifyform = 1;
if ($showclassifyform) {
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddProjectIntoCategory").' &nbsp;';
print $form->select_dolusers('', 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';

View File

@ -2214,10 +2214,10 @@ if ($id > 0) {
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
print '</div></div></div>';
print '</div></div>';
}
}
}

View File

@ -1330,7 +1330,7 @@ class ActionComm extends CommonObject
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".((int) $user->id);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
@ -1345,7 +1345,7 @@ class ActionComm extends CommonObject
if ($user->socid) {
$sql .= " AND a.fk_soc = ".((int) $user->socid);
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id);
$sql .= " OR ar.fk_element = ".((int) $user->id);
$sql .= ")";

View File

@ -86,13 +86,13 @@ if ($socid < 0) {
}
$canedit = 1;
if (!$user->rights->agenda->myactions->read) {
if (empty($user->rights->agenda->myactions->read)) {
accessforbidden();
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$canedit = 0;
}
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
$filtert = $user->id;
}

View File

@ -136,13 +136,13 @@ if ($socid < 0) {
}
$canedit = 1;
if (!$user->rights->agenda->myactions->read) {
if (empty($user->rights->agenda->myactions->read)) {
accessforbidden();
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$canedit = 0;
}
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
$filtert = $user->id;
}

View File

@ -80,13 +80,13 @@ if ($socid < 0) {
}
$canedit = 1;
if (!$user->rights->agenda->myactions->read) {
if (empty($user->rights->agenda->myactions->read)) {
accessforbidden();
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$canedit = 0;
}
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
$filtert = $user->id;
}

View File

@ -80,13 +80,13 @@ if ($socid < 0) {
}
$canedit = 1;
if (!$user->rights->agenda->myactions->read) {
if (empty($user->rights->agenda->myactions->read)) {
accessforbidden();
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$canedit = 0;
}
if (!$user->rights->agenda->allactions->read || $filter == 'mine') { // If no permission to see all, we show only affected to me
if (empty($user->rights->agenda->allactions->read) || $filter == 'mine') { // If no permission to see all, we show only affected to me
$filtert = $user->id;
}

View File

@ -682,7 +682,7 @@ if ($object->id > 0) {
print "</table>";
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
$boxstat = '';
@ -1341,7 +1341,7 @@ if ($object->id > 0) {
print $hookmanager->resPrint;
}
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';
print dol_get_fiche_end();

View File

@ -548,7 +548,6 @@ if (!empty($conf->ficheinter->enabled)) {
}
print '</div><div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
/*
* Last modified customers or prospects
@ -1057,7 +1056,6 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
}
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -141,8 +141,7 @@ if (is_resource($handle)) {
print "</table><br>";
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@ -193,7 +192,7 @@ if ($result) {
}
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);

View File

@ -1559,8 +1559,6 @@ if ($action == 'create') {
}
}
$object = new Propal($db);
print '<form name="addprop" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
@ -2398,7 +2396,6 @@ if ($action == 'create') {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
@ -2457,7 +2454,6 @@ if ($action == 'create') {
$formmargin->displayMarginInfos($object);
}
print '</div>';
print '</div>';
print '</div>';
@ -2690,14 +2686,14 @@ if ($action == 'create') {
print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'propal', $socid, 1);
print '</div></div></div>';
print '</div></div>';
}
// Presend form

View File

@ -146,7 +146,6 @@ if (!empty($conf->propal->enabled)) {
print '</div>';
print '<div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
/*
* Last modified proposals
@ -456,7 +455,6 @@ if (! empty($conf->propal->enabled))
}
*/
print '</div>';
print '</div>';
print '</div>';

View File

@ -347,7 +347,7 @@ foreach ($data as $val) {
print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Show graphs
@ -364,7 +364,7 @@ if ($mesg) {
print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';

View File

@ -163,8 +163,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
}
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@ -280,8 +279,7 @@ if ($resql) {
}
//print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
// End of page
llxFooter();

View File

@ -250,7 +250,6 @@ if ($socid > 0) {
if ($isCustomer) {
print '</div>'; // class="fichehalfleft"
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
}
@ -298,7 +297,6 @@ if ($socid > 0) {
}
if ($isCustomer) {
print '</div>'; // class="ficheaddleft"
print '</div>'; // class="fichehalfright"
print '</div>'; // class="fichecenter"
}

View File

@ -532,7 +532,6 @@ if ($socid > 0) {
if ($isCustomer) {
print '</div>'; // class="fichehalfleft"
print '<div class="fichehalfright fichehalfright-lg">';
print '<div class="ficheaddleft">';
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
}
@ -667,7 +666,6 @@ if ($socid > 0) {
}
if ($isCustomer) {
print '</div>'; // class="ficheaddleft"
print '</div>'; // class="fichehalfright"
print '</div>'; // class="fichecenter"
}
@ -843,7 +841,6 @@ if ($socid > 0) {
if ($isCustomer) {
print '</div>'; // class="fichehalfleft"
print '<div class="fichehalfright fichehalfright-lg">';
print '<div class="ficheaddleft">';
print load_fiche_titre($langs->trans("SupplierDiscounts"), '', '');
}
@ -1000,7 +997,6 @@ if ($socid > 0) {
}
if ($isCustomer) {
print '</div>'; // class="ficheaddleft"
print '</div>'; // class="fichehalfright"
print '</div>'; // class="fichecenter"
}

View File

@ -2367,7 +2367,6 @@ if ($action == 'create' && $usercancreate) {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
@ -2424,7 +2423,6 @@ if ($action == 'create' && $usercancreate) {
}
print '</div>';
print '</div>';
print '</div>'; // Close fichecenter
@ -2663,14 +2661,14 @@ if ($action == 'create' && $usercancreate) {
print showOnlinePaymentUrl('order', $object->ref).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
print '</div></div></div>';
print '</div></div>';
}
// Presend form

View File

@ -981,6 +981,7 @@ class Orders extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
}
$obj_ret = array();
$sql = "SELECT e.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet";
@ -1054,7 +1055,6 @@ class Orders extends DolibarrApi
if ($result <= 0) {
throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror());
}
$i++;
}
return $shipment->id;
}

View File

@ -146,7 +146,7 @@ if (!empty($conf->commande->enabled)) {
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
$max = 5;
@ -414,7 +414,7 @@ if (!empty($conf->commande->enabled)) {
}
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -42,7 +42,7 @@ $mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
if ($mode == 'customer' && !$user->rights->commande->lire) {
accessforbidden();
}
if ($mode == 'supplier' && !$user->rights->fournisseur->commande->lire) {
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
accessforbidden();
}
@ -401,7 +401,7 @@ print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Show graphs
@ -418,7 +418,7 @@ if ($mesg) {
print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';
print dol_get_fiche_end();

View File

@ -448,9 +448,9 @@ if ($result < 0) {
print '<div class="fichecenter"><div class="fichehalfleft"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show1;
print '</div></div><div class="fichehalfright"><div class="ficheaddleft"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
print '</div></div><div class="fichehalfright"><div align="center">'; // do not use class="center" here, it will have no effect for the js graph inside.
print $show2;
print '</div></div></div></div>';
print '</div></div></div>';
print '<div style="clear:both"></div>';
}

View File

@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories'));
if (!$user->rights->banque->lire) {
if (empty($user->rights->banque->lire)) {
accessforbidden();
}

View File

@ -698,7 +698,6 @@ if ($action == 'create') {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
@ -795,7 +794,6 @@ if ($action == 'create') {
print '</table>';
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -39,7 +39,7 @@ if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
accessforbidden();
}

View File

@ -67,7 +67,7 @@ if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
accessforbidden();
}

View File

@ -506,6 +506,8 @@ print "</tr>\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalarray['val'] = array('balance'=>0);
$total = array();
$found = 0;
$i = 0;
$lastcurrencycode = '';
@ -714,7 +716,11 @@ foreach ($accounts as $key => $type) {
print '</tr>';
$total[$objecttmp->currency_code] += $solde;
if (empty($total[$objecttmp->currency_code])) {
$total[$objecttmp->currency_code] = $solde;
} else {
$total[$objecttmp->currency_code] += $solde;
}
$i++;
}

View File

@ -647,9 +647,10 @@ if (empty($action) || $action == "view" || $action == "close") {
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="fichehalfright">>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield nowrap">';
print $langs->trans("DateCreationShort");
@ -667,7 +668,7 @@ if (empty($action) || $action == "view" || $action == "close") {
}
print "</table>\n";
print '</div>';
print '</div></div>';
print '<div style="clear:both"></div>';

View File

@ -22,27 +22,6 @@
* \brief List page for cashcontrol
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -81,7 +60,7 @@ $pagenext = $page + 1;
// Initialize technical objects
$object = new CashControl($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->monmodule->dir_output.'/temp/massgeneration/'.$user->id;
//$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('cashcontrol')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
@ -141,16 +120,16 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run);
$permissiontoread = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
$permissiontoadd = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
$permissiontodelete = (!empty($user->rights->cashdesk->run) || !empty($user->rights->takepos->run));
// Security check
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
accessforbidden();
}
@ -341,7 +320,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
$arrayofselected = is_array($toselect) ? $toselect : array();

View File

@ -141,7 +141,7 @@ print '</table>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
$max = 10;
@ -212,7 +212,7 @@ if ($result) {
}
print '</div></div></div>';
print '</div></div>';
// End of page
llxFooter();

View File

@ -302,7 +302,7 @@ foreach ($data as $val) {
print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Show graphs
@ -319,7 +319,7 @@ if ($mesg) {
print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';

View File

@ -1443,7 +1443,6 @@ if ($action == 'create') {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
@ -1591,7 +1590,6 @@ if ($action == 'create') {
print '<br>';
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -4634,7 +4634,6 @@ if ($action == 'create') {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<!-- amounts -->'."\n";
print '<table class="border bordertop tableforfield centpercent">';
@ -5196,7 +5195,6 @@ if ($action == 'create') {
$formmargin->displayMarginInfos($object);
}
print '</div>';
print '</div>';
print '</div>';
@ -5607,14 +5605,14 @@ if ($action == 'create') {
print showOnlinePaymentUrl('invoice', $object->ref).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
print '</div></div></div>';
print '</div></div>';
}

View File

@ -73,7 +73,6 @@ if ($tmp) {
print '</div>';
print '<div class="fichetwothirdright">';
print '<div class="ficheaddleft">';
$tmp = getCustomerInvoiceLatestEditTable($maxLatestEditCount, $socid);
if ($tmp) {
@ -87,7 +86,6 @@ if ($tmp) {
print '<br>';
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -116,7 +116,7 @@ $search_date_startyear = GETPOST('search_date_startyear', 'int');
$search_date_endday = GETPOST('search_date_endday', 'int');
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
$search_date_endyear = GETPOST('search_date_endyear', 'int');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int');
$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int');
@ -124,7 +124,7 @@ $search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int');
$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int');
$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int');
$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int');
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); // Use tzserver
$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear);
$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int');
$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int');
@ -242,10 +242,10 @@ $arrayfields = array(
'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292),
'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295),
'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'total_pa' => array('label' => ($conf->global->MARGIN_TYPE == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502),
'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))),
@ -380,11 +380,11 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$arrayofselected = is_array($toselect) ? $toselect : array();
if (!empty($arrayofselected)) {
$bankid=GETPOST('bankid', 'int');
$paiementid=GETPOST('paiementid', 'int');
$paiementdate=dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
$bankid = GETPOST('bankid', 'int');
$paiementid = GETPOST('paiementid', 'int');
$paiementdate = dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
foreach ($arrayofselected as $toselectid) {
$errorpayment=0;
$errorpayment = 0;
$facture = new Facture($db);
$result = $facture->fetch($toselectid);
if ($result < 0) {
@ -397,7 +397,7 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
$totaldeposits = $facture->getSumDepositsUsed();
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalpay);
if ($remaintopay!=0) {
if ($remaintopay != 0) {
$resultBank = $facture->setBankAccount($bankid);
if ($resultBank < 0) {
setEventMessage($facture->error, 'errors');
@ -410,12 +410,12 @@ if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
$paiement->paiementid = $paiementid;
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
if ($paiement_id < 0) {
setEventMessage($facture->ref . ' ' . $paiement->error, 'errors');
setEventMessage($facture->ref.' '.$paiement->error, 'errors');
$errorpayment++;
} else {
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
if ($result < 0) {
setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors');
setEventMessages($facture->ref.' '.$paiement->error, $paiement->errors, 'errors');
$errorpayment++;
}
}
@ -555,7 +555,7 @@ $sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as u
if (!$sall) {
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
}
if ($search_categ_cus && $search_categ_cus!=-1) {
if ($search_categ_cus && $search_categ_cus != -1) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
@ -801,7 +801,7 @@ if (!$sall) {
$sql .= ' country.code,';
$sql .= " p.rowid, p.ref, p.title,";
$sql .= " u.login, u.lastname, u.firstname, u.email, u.statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender";
if ($search_categ_cus && $search_categ_cus!=-1) {
if ($search_categ_cus && $search_categ_cus != -1) {
$sql .= ", cc.fk_categorie, cc.fk_soc";
}
// Add fields from extrafields
@ -821,7 +821,7 @@ if (!$sall) {
// Add HAVING from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrint) : "";
$sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 ".$hookmanager->resPrint) : "";
$sql .= ' ORDER BY ';
$listfield = explode(',', $sortfield);
@ -914,7 +914,7 @@ if ($resql) {
if ($search_date_valid_endyear) {
$param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear);
}
if ($search_datelimit_startday) {
if ($search_datelimit_startday) {
$param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday);
}
if ($search_datelimit_startmonth) {
@ -1059,7 +1059,7 @@ if ($resql) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
}
if (in_array($massaction, array('presend', 'predelete' ,'makepayment'))) {
if (in_array($massaction, array('presend', 'predelete', 'makepayment'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -1097,7 +1097,7 @@ if ($resql) {
$trackid = 'inv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction=='makepayment') {
if ($massaction == 'makepayment') {
$formconfirm = '';
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
@ -1719,7 +1719,13 @@ if ($resql) {
print '<tr class="oddeven"';
if ($contextpage == 'poslist') {
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();});"';
print ' onclick="parent.$(\'#poslines\').load(\'invoice.php?action=history&placeid='.$obj->id.'\', function() {parent.$.colorbox.close();';
if (strpos($obj->ref, 'PROV') !== false) {
//If is a draft invoice, load var to be able to add products
$place = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref));
print 'parent.place=\''.$place.'\'';
}
print '});"';
}
print '>';

View File

@ -71,7 +71,7 @@ $hookmanager->initHooks(array('directdebitcard', 'globalcard'));
if ($type == 'bank-transfer') {
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', $fieldid, $isdraft);
if (!$user->rights->fournisseur->facture->lire) {
if (empty($user->rights->fournisseur->facture->lire)) {
accessforbidden();
}
} else {
@ -607,7 +607,6 @@ if ($object->id > 0) {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
@ -672,7 +671,6 @@ if ($object->id > 0) {
print '</table>';
print '</div>';
print '</div>';
print '</div>';

View File

@ -46,7 +46,7 @@ $mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
if ($mode == 'customer' && !$user->rights->facture->lire) {
accessforbidden();
}
if ($mode == 'supplier' && !$user->rights->fournisseur->facture->lire) {
if ($mode == 'supplier' && empty($user->rights->fournisseur->facture->lire)) {
accessforbidden();
}
@ -392,7 +392,7 @@ foreach ($data as $val) {
print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Show graphs
@ -409,7 +409,7 @@ if ($mesg) {
print '</td></tr></table>';
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';

View File

@ -112,7 +112,7 @@ print getCustomerInvoiceDraftTable($max, $socid);
print '<br>';
print getDraftSupplierTable($max, $socid);
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Latest modified customer invoices
@ -749,7 +749,7 @@ if ($resql) {
}
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -568,8 +568,7 @@ print '</tr>';
print '</table>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*

View File

@ -131,7 +131,7 @@ if (empty($reshook)) {
} elseif (substr($key, 0, 21) == 'multicurrency_amount_') {
$cursorfacid = substr($key, 21);
$multicurrency_amounts[$cursorfacid] = price2num(GETPOST($key));
$multicurrency_totalpayment += $multicurrency_amounts[$cursorfacid];
$multicurrency_totalpayment += floatval($multicurrency_amounts[$cursorfacid]);
if (!empty($multicurrency_amounts[$cursorfacid])) {
$atleastonepaymentnotnull++;
}

View File

@ -83,7 +83,7 @@ if ($resql) {
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
$max = 10;
@ -145,7 +145,7 @@ if ($resql) {
}
print '</div></div></div>';
print '</div></div>';
// End of page
llxFooter();

View File

@ -174,7 +174,7 @@ if ($resql) {
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@ -233,7 +233,7 @@ if ($result) {
}
print '</div></div></div>';
print '</div></div>';
// End of page
llxFooter();

View File

@ -174,7 +174,7 @@ if ($resql) {
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@ -235,7 +235,7 @@ if ($result) {
}
print '</div></div></div>';
print '</div></div>';
// End of page
llxFooter();

View File

@ -9,6 +9,7 @@
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -33,6 +34,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -366,7 +368,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
} else {
/*
* Factures clients
* Customer invoices
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
@ -386,8 +388,8 @@ if ($modecompta == 'BOOKKEEPING') {
}
} elseif ($modecompta == 'RECETTES-DEPENSES') {
/*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
* List of payments (old payments are not seen by this query because, on older versions, they were not linked via payment_invoice.
* old versions, they were not linked via payment_invoice. They are added later)
*/
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -434,7 +436,7 @@ if ($modecompta == 'BOOKKEEPING') {
dol_print_error($db);
}
// On ajoute les paiements clients anciennes version, non lie par paiement_facture
// We add the old customer payments, not linked by payment_invoice
if ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -673,7 +675,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Charges sociales non deductibles
* Social / Fiscal contributions who are not deductible
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
@ -760,7 +762,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Charges sociales deductibles
* Social / Fiscal contributions who are deductible
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
@ -860,15 +862,27 @@ if ($modecompta == 'BOOKKEEPING') {
$column = 'p.datep';
}
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
// For backward compatibility with old module salary
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') {
$newsortfield = 'u.firstname, u.lastname';
@ -900,7 +914,10 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user);
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?search_user=".urlencode($userstatic->getFullName($langs))."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
@ -931,7 +948,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Expense
* Expense report
*/
if (!empty($conf->expensereport->enabled)) {
@ -1087,7 +1104,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
/*
* Payement Loan
* Payment Loan
*/
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
@ -1208,7 +1225,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
// VAT to retreive
// VAT to retrieve
$amount = 0;
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";

View File

@ -612,7 +612,6 @@ if ($id > 0) {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
$nbcols = 3;
if (!empty($conf->banque->enabled)) {
@ -722,7 +721,6 @@ if ($id > 0) {
dol_print_error($db);
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -614,7 +614,6 @@ if ($id) {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
$nbcols = 3;
if (!empty($conf->banque->enabled)) {
@ -717,7 +716,6 @@ if ($id) {
dol_print_error($db);
}
print '</div>';
print '</div>';
print '</div>';

View File

@ -514,7 +514,7 @@ if ($refresh === true) {
print '</table>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@ -544,7 +544,7 @@ if ($refresh === true) {
pt($db, $sql, $langs->trans("Month"));
print '</div></div>';
print '</div>';
}
llxFooter();

View File

@ -296,7 +296,7 @@ if (empty($reshook)) {
if (empty($error) && $id > 0) {
$db->commit();
if (!empty($backtopage)) {
$url = $backtopage;
$url = str_replace('__ID__', $id, $backtopage);
} else {
$url = 'card.php?id='.$id;
}
@ -545,8 +545,8 @@ $formcompany = new FormCompany($db);
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
$objsoc = new Societe($db);
if ($socid > 0) {
$objsoc = new Societe($db);
$objsoc->fetch($socid);
}
@ -1381,10 +1381,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
@ -1462,7 +1462,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</table>";
print '</div></div></div>';
print '</div></div>';
print '<div style="clear:both"></div>';
print dol_get_fiche_end();
@ -1518,7 +1518,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($action != 'presend') {
print '<div class="fichecenter"><div class="fichehalfleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
@ -1529,7 +1529,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'contact', $object->socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty
print '</div></div></div>';
print '</div></div>';
}
// Presend form

View File

@ -2137,7 +2137,7 @@ if ($action == 'create') {
$linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
$MAXEVENT = 10;
@ -2148,7 +2148,7 @@ if ($action == 'create') {
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'contract', $socid, 1, 'listactions', $MAXEVENT, '', $morehtmlcenter);
print '</div></div></div>';
print '</div></div>';
}
// Presend form

View File

@ -298,7 +298,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
}
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
// Last modified contracts
@ -622,7 +622,7 @@ if ($resql) {
}
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardContracts', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -73,7 +73,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'restricthtml');
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
} elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
} elseif ($object->fields[$key]['type'] == 'duration') {
@ -87,7 +87,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
} else {
if ($key == 'lang') {
$value = GETPOST($key, 'aZ09')?GETPOST($key, 'aZ09'):"";
$value = GETPOST($key, 'aZ09') ?GETPOST($key, 'aZ09') : "";
} else {
$value = GETPOST($key, 'alphanohtml');
}
@ -190,7 +190,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$value = GETPOST($key, 'restricthtml');
}
} elseif ($object->fields[$key]['type'] == 'date') {
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt
} elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel');
} elseif ($object->fields[$key]['type'] == 'duration') {

View File

@ -105,7 +105,7 @@ class box_actions extends ModeleBoxes
if ($user->socid) {
$sql .= " AND s.rowid = ".((int) $user->socid);
}
if (!$user->rights->agenda->allactions->read) {
if (empty($user->rights->agenda->allactions->read)) {
$sql .= " AND (a.fk_user_author = ".((int) $user->id)." OR a.fk_user_action = ".((int) $user->id)." OR a.fk_user_done = ".((int) $user->id).")";
}
$sql .= " ORDER BY a.datec DESC";

View File

@ -65,7 +65,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
public function loadBox($max = 5)
{
global $conf, $user, $langs;
$dataseries = "";
$dataseries = array();
$graphtoshow = "";
$badgeStatus0 = '#cbd3d3'; // draft
@ -118,7 +118,6 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
$dataseries = array();
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
while ($minimumdatecformated < $objp->datec) {

View File

@ -6080,7 +6080,6 @@ abstract class CommonObject
}
$sql .= ")";
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
@ -6334,6 +6333,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
}
break;
case 'boolean':
if (empty($this->array_options["options_".$key])) {
$this->array_options["options_".$key] = null;
}
break;
/*
case 'link':
$param_list = array_keys($attributeParam['options']);
@ -7693,7 +7697,7 @@ abstract class CommonObject
$langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]);
}
$colspan = '';
$colspan = 0;
if (is_array($params) && count($params) > 0 && $display_type=='card') {
if (array_key_exists('cols', $params)) {
$colspan = $params['cols'];
@ -7706,6 +7710,7 @@ abstract class CommonObject
}
}
}
$colspan = intval($colspan);
switch ($mode) {
case "view":
@ -7772,7 +7777,7 @@ abstract class CommonObject
$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
if ($display_type=='card') {
if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) {
$colspan = '0';
$colspan = 0;
}
if ($action == 'selectlines') {

View File

@ -1415,12 +1415,12 @@ class DolGraph
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
} else { // We do not use a 'group by'
if (is_array($this->datacolor[$i])) {
if (!empty($this->bordercolor[$i]) && is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)';
} else {
$color = $this->datacolor[$i];
}
if (is_array($this->bordercolor[$i])) {
if (!empty($this->bordercolor[$i]) && is_array($this->bordercolor[$i])) {
$color = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
} else {
if ($type != 'horizontalBar') {

View File

@ -291,7 +291,7 @@ class Fiscalyear extends CommonObject
$url = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$this->id;
if (!$user->rights->accounting->fiscalyear->write) {
if (empty($user->rights->accounting->fiscalyear->write)) {
$option = 'nolink';
}

View File

@ -1005,6 +1005,7 @@ class Form
$langs->load("dict");
$out = '';
$moreattrib = '';
$incotermArray = array();
$sql = "SELECT rowid, code";
@ -1444,7 +1445,7 @@ class Form
$label .= ' ('.$obj->name_alias.')';
}
if ($conf->global->SOCIETE_SHOW_VAT_IN_LIST && !empty($obj->tva_intra)) {
if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) {
$label .= ' - '.$obj->tva_intra.'';
}
@ -2602,7 +2603,7 @@ class Form
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
@ -6838,6 +6839,418 @@ class Form
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
}
/**
* Return list of projects in Ajax if Ajax activated or go to selectTicketsList
*
* @param int $selected Preselected tickets
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param string $filtertype To add a filter
* @param int $limit Limit on number of returned lines
* @param int $status Ticket status
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function selectProjects($selected = '', $htmlname = 'projectid', $filtertype = '', $limit = 0, $status = 1, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $selected_combinations = null, $nooutput = 0)
{
global $langs, $conf;
$out = '';
// check parameters
if (is_null($ajaxoptions)) $ajaxoptions = array();
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
$placeholder = '';
if ($selected && empty($selected_input_value)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$projecttmpselect = new Project($this->db);
$projecttmpselect->fetch($selected);
$selected_input_value = $projecttmpselect->ref;
unset($projecttmpselect);
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
elseif ($hidelabel > 1) {
$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
$out .= img_picto($langs->trans("Search"), 'search');
}
}
$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
$out .= img_picto($langs->trans("Search"), 'search');
}
} else {
$out .= $this->selectProjectsList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss);
}
if (empty($nooutput)) print $out;
else return $out;
}
/**
* Return list of projects.
* Called by selectProjects.
*
* @param int $selected Preselected project
* @param string $htmlname Name of select html
* @param string $filtertype Filter on project type
* @param int $limit Limit on number of returned lines
* @param string $filterkey Filter on project ref or subject
* @param int $status Ticket status
* @param int $outputmode 0=HTML select string, 1=Array
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @return array Array of keys for json
*/
public function selectProjectsList($selected = '', $htmlname = 'projectid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
{
global $langs, $conf, $user, $db;
$out = '';
$outarray = array();
$selectFields = " p.rowid, p.ref";
$sql = "SELECT ";
$sql .= $selectFields;
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';
$prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
// For natural search
$scrit = explode(' ', $filterkey);
$i = 0;
if (count($scrit) > 1) $sql .= "(";
foreach ($scrit as $crit) {
if ($i > 0) $sql .= " AND ";
$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
$sql .= "";
$i++;
}
if (count($scrit) > 1) $sql .= ")";
$sql .= ')';
}
$sql .= $this->db->plimit($limit, 0);
// Build output string
dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
$num = $this->db->num_rows($result);
$events = null;
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
}
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
$textifempty = '';
// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
else $textifempty .= $langs->trans("All");
} else {
if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
}
if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
$i = 0;
while ($num && $i < $num) {
$opt = '';
$optJson = array();
$objp = $this->db->fetch_object($result);
$this->constructProjectListOption($objp, $opt, $optJson, $selected, $filterkey);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push($outarray, $optJson);
$i++;
}
$out .= '</select>';
$this->db->free($result);
if (empty($outputmode)) return $out;
return $outarray;
} else {
dol_print_error($db);
}
}
/**
* constructProjectListOption.
* This define value for &$opt and &$optJson.
*
* @param resource $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
* @param string $filterkey Filter key to highlight
* @return void
*/
protected function constructProjectListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
{
global $langs, $conf, $user, $db;
$outkey = '';
$outval = '';
$outref = '';
$outlabel = '';
$outtype = '';
$label = $objp->label;
$outkey = $objp->rowid;
$outref = $objp->ref;
$outlabel = $objp->label;
$outtype = $objp->fk_product_type;
$opt = '<option value="'.$objp->rowid.'"';
$opt .= ($objp->rowid == $selected) ? ' selected' : '';
$opt .= '>';
$opt .= $objp->ref;
$objRef = $objp->ref;
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
$outval .= $objRef;
$opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
}
/**
* Return list of members in Ajax if Ajax activated or go to selectTicketsList
*
* @param int $selected Preselected tickets
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param string $filtertype To add a filter
* @param int $limit Limit on number of returned lines
* @param int $status Ticket status
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param string $nooutput No print, return the output into a string
* @return void|string
*/
public function selectMembers($selected = '', $htmlname = 'adherentid', $filtertype = '', $limit = 0, $status = 1, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $selected_combinations = null, $nooutput = 0)
{
global $langs, $conf;
$out = '';
// check parameters
if (is_null($ajaxoptions)) $ajaxoptions = array();
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
$placeholder = '';
if ($selected && empty($selected_input_value)) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$adherenttmpselect = new Member($this->db);
$adherenttmpselect->fetch($selected);
$selected_input_value = $adherenttmpselect->ref;
unset($adherenttmpselect);
}
$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : ';
elseif ($hidelabel > 1) {
$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
$out .= img_picto($langs->trans("Search"), 'search');
}
}
$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
$out .= img_picto($langs->trans("Search"), 'search');
}
} else {
$out .= $this->selectMembersList($selected, $htmlname, $filtertype, $limit, $status, 0, $socid, $showempty, $forcecombo, $morecss);
}
if (empty($nooutput)) print $out;
else return $out;
}
/**
* Return list of adherents.
* Called by selectMembers.
*
* @param int $selected Preselected adherent
* @param string $htmlname Name of select html
* @param string $filtertype Filter on adherent type
* @param int $limit Limit on number of returned lines
* @param string $filterkey Filter on adherent ref or subject
* @param int $status Ticket status
* @param int $outputmode 0=HTML select string, 1=Array
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @return array Array of keys for json
*/
public function selectMembersList($selected = '', $htmlname = 'adherentid', $filtertype = '', $limit = 20, $filterkey = '', $status = 1, $outputmode = 0, $showempty = '1', $forcecombo = 0, $morecss = '')
{
global $langs, $conf, $user, $db;
$out = '';
$outarray = array();
$selectFields = " p.rowid, p.ref";
$sql = "SELECT ";
$sql .= $selectFields;
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as p";
$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';
$prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
// For natural search
$scrit = explode(' ', $filterkey);
$i = 0;
if (count($scrit) > 1) $sql .= "(";
foreach ($scrit as $crit) {
if ($i > 0) $sql .= " AND ";
$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
$sql .= "";
$i++;
}
if (count($scrit) > 1) $sql .= ")";
$sql .= ')';
}
$sql .= $this->db->plimit($limit, 0);
// Build output string
dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
$num = $this->db->num_rows($result);
$events = null;
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);
}
$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
$textifempty = '';
// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
else $textifempty .= $langs->trans("All");
} else {
if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
}
if ($showempty) $out .= '<option value="0" selected>'.$textifempty.'</option>';
$i = 0;
while ($num && $i < $num) {
$opt = '';
$optJson = array();
$objp = $this->db->fetch_object($result);
$this->constructMemberListOption($objp, $opt, $optJson, $selected, $filterkey);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt;
array_push($outarray, $optJson);
$i++;
}
$out .= '</select>';
$this->db->free($result);
if (empty($outputmode)) return $out;
return $outarray;
} else {
dol_print_error($db);
}
}
/**
* constructMemberListOption.
* This define value for &$opt and &$optJson.
*
* @param resource $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
* @param string $filterkey Filter key to highlight
* @return void
*/
protected function constructMemberListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '')
{
global $langs, $conf, $user, $db;
$outkey = '';
$outval = '';
$outref = '';
$outlabel = '';
$outtype = '';
$label = $objp->label;
$outkey = $objp->rowid;
$outref = $objp->ref;
$outlabel = $objp->label;
$outtype = $objp->fk_product_type;
$opt = '<option value="'.$objp->rowid.'"';
$opt .= ($objp->rowid == $selected) ? ' selected' : '';
$opt .= '>';
$opt .= $objp->ref;
$objRef = $objp->ref;
if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
$outval .= $objRef;
$opt .= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem);
}
/**
* Generic method to select a component from a combo list.
@ -7676,7 +8089,7 @@ class Form
}
} else { // There is no list of fields already customized for user
foreach ($array as $key => $val) {
if ($array[$key]['checked'] < 0) {
if (!empty($array[$key]['checked']) && $array[$key]['checked'] < 0) {
$array[$key]['checked'] = 0;
}
}
@ -7704,7 +8117,7 @@ class Form
}
// Note: $val['checked'] <> 0 means we must show the field into the combo list
$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) && $val['checked'] != '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
}
}

View File

@ -207,7 +207,7 @@ class FormMargin
return;
}
if (!$user->rights->margins->liretous) {
if (empty($user->rights->margins->liretous)) {
return;
}

View File

@ -107,7 +107,7 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
if ($dir = opendir($newpath)) {
$filedate = '';
$filesize = '';
$fileperm = '';
while (false !== ($file = readdir($dir))) { // $file is always a basename (into directory $newpath)
if (!utf8_check($file)) {
$file = utf8_encode($file); // To be sure data is stored in utf8 in memory

View File

@ -44,25 +44,27 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
/**
* Return dolibarr global constant string value
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @return string
*/
function getDolGlobalString($key)
function getDolGlobalString($key, $default = '')
{
global $conf;
// return $conf->global->$key ?? '';
return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
// return $conf->global->$key ?? $default;
return (string) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
/**
* Return dolibarr global constant int value
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @return int
*/
function getDolGlobalInt($key)
function getDolGlobalInt($key, $default = 0)
{
global $conf;
// return $conf->global->$key ?? 0;
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
// return $conf->global->$key ?? $default;
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
}
/**

View File

@ -279,7 +279,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
}
if ($feature == 'societe') {
if (empty($user->rights->societe->lire) && !$user->rights->fournisseur->lire) {
if (empty($user->rights->societe->lire) && empty($user->rights->fournisseur->lire)) {
$readok = 0;
$nbko++;
}
@ -299,7 +299,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'cheque') {
if (!$user->rights->banque->cheque) {
if (empty($user->rights->banque->cheque)) {
$readok = 0;
$nbko++;
}
@ -314,7 +314,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'payment_supplier') {
if (!$user->rights->fournisseur->facture->lire) {
if (empty($user->rights->fournisseur->facture->lire)) {
$readok = 0;
$nbko++;
}
@ -385,22 +385,22 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$nbko++;
}
} elseif ($feature == 'commande_fournisseur') {
if (!$user->rights->fournisseur->commande->creer || !$user->rights->supplier_order->creer) {
if (empty($user->rights->fournisseur->commande->creer) || empty($user->rights->supplier_order->creer)) {
$createok = 0;
$nbko++;
}
} elseif ($feature == 'banque') {
if (!$user->rights->banque->modifier) {
if (empty($user->rights->banque->modifier)) {
$createok = 0;
$nbko++;
}
} elseif ($feature == 'cheque') {
if (!$user->rights->banque->cheque) {
if (empty($user->rights->banque->cheque)) {
$createok = 0;
$nbko++;
}
} elseif ($feature == 'import') {
if (!$user->rights->import->run) {
if (empty($user->rights->import->run)) {
$createok = 0;
$nbko++;
}
@ -497,11 +497,11 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$deleteok = 0;
}
} elseif ($feature == 'banque') {
if (!$user->rights->banque->modifier) {
if (empty($user->rights->banque->modifier)) {
$deleteok = 0;
}
} elseif ($feature == 'cheque') {
if (!$user->rights->banque->cheque) {
if (empty($user->rights->banque->cheque)) {
$deleteok = 0;
}
} elseif ($feature == 'ecm') {

View File

@ -302,7 +302,7 @@ class modMultiCurrency extends DolibarrModules
$multicurrency = new MultiCurrency($this->db);
if (! $multicurrency->checkCodeAlreadyExists($conf->currency)) {
if (!$multicurrency->checkCodeAlreadyExists($conf->currency)) {
$langs->loadCacheCurrencies('');
$multicurrency->code = $conf->currency;

View File

@ -86,7 +86,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv
$accessallowed = 1;
} elseif ($modulepart == 'bank') {
$result = restrictedArea($user, 'banque', $id, 'bank_account');
if (!$user->rights->banque->lire) {
if (empty($user->rights->banque->lire)) {
accessforbidden();
}
$accessallowed = 1;
@ -98,7 +98,7 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv
$accessallowed = 1;
} elseif ($modulepart == 'facture_fourn' || $modulepart == 'facture_fournisseur') {
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
if (!$user->rights->fournisseur->facture->lire) {
if (empty($user->rights->fournisseur->facture->lire)) {
accessforbidden();
}
$accessallowed = 1;

View File

@ -86,12 +86,12 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
global $conf, $langs;
global $dolibarr_mailing_limit_sendbyweb;
$info = $langs->trans('Method').': <strong>'.$conf->global->MAIN_MAIL_SENDMODE.'</strong><br>';
$info .= $langs->trans('Server').': <strong>'.$conf->global->MAIN_MAIL_SMTP_SERVER.'</strong><br>';
$info .= $langs->trans('Port').': <strong>'.$conf->global->MAIN_MAIL_SMTP_PORT.'</strong><br>';
$info .= $langs->trans('ID').': <strong>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</strong><br>';
$info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).'</strong><br>';
$info .= $langs->trans('TLS/STARTTLS').': <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_TLS).'</strong> / <strong>'.(empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_STARTTLS).'</strong><br>';
$info = $langs->trans('Method').': <strong>'.getDolGlobalString("MAIN_MAIL_SENDMODE").'</strong><br>';
$info .= $langs->trans('Server').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").'</strong><br>';
$info .= $langs->trans('Port').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTP_PORT").'</strong><br>';
$info .= $langs->trans('ID').': <strong>'.getDolGlobalString("MAIN_MAIL_SMTPS_IDT").'</strong><br>';
$info .= $langs->trans('Pwd').': <strong>'.preg_replace('/./', '*', getDolGlobalString("MAIN_MAIL_SMTPS_PW")).'</strong><br>';
$info .= $langs->trans('TLS/STARTTLS').': <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").'</strong> / <strong>'.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").'</strong><br>';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': <strong>'.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).'</strong><br>';
$info .= 'dolibarr_mailing_limit_sendbyweb = <strong>'.$dolibarr_mailing_limit_sendbyweb.'</strong><br>';

View File

@ -114,7 +114,7 @@ if ($action == 'add') {
$idl = "idl".$i;
$qtytouse = price2num(GETPOST($qty));
if ($qtytouse > 0) {
$object->addline(GETPOST($idl), price2num($qtytouse));
$object->addline(GETPOST($idl), price2num($qtytouse), $arrayoptions);
}
}
@ -603,23 +603,26 @@ if ($action == 'create') { // Create. Seems to no be used
print "</tr>";
// Display lines extrafields
if (!empty($extrafields)) {
//if (!empty($extrafields)) {
$colspan = 2;
$mode = ($object->statut == 0) ? 'edit' : 'view';
$object->lines[$i]->fetch_optionals();
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->id = $expedition->lines[$i]->id;
$srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
} else {
$srcLine = new DeliveryLine($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->id = $expedition->lines[$i]->id;
$srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
}
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), $i);
}
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), '');
//}
}
$i++;
@ -689,11 +692,11 @@ if ($action == 'create') { // Create. Seems to no be used
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
// Nothing on right
print '</div></div></div>';
print '</div></div>';
} else {
/* Expedition non trouvee */
print "Expedition inexistante ou acces refuse";

View File

@ -211,7 +211,7 @@ class Delivery extends CommonObject
$origin_id = $this->lines[$i]->commande_ligne_id; // For backward compatibility
}
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description)) {
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description, $this->lines[$i]->array_options)) {
$error++;
}
}
@ -264,7 +264,7 @@ class Delivery extends CommonObject
* @param string $description Description
* @return int <0 if KO, >0 if OK
*/
public function create_line($origin_id, $qty, $fk_product, $description)
public function create_line($origin_id, $qty, $fk_product, $description, $array_options = 0)
{
// phpcs:enable
$error = 0;
@ -283,6 +283,15 @@ class Delivery extends CommonObject
$error++;
}
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."deliverydet");
if (is_array($array_options) && count($array_options) > 0) {
$line = new DeliveryLine($this->db);
$line->id = $id;
$line->array_options = $array_options;
$result = $line->insertExtraFields();
}
if ($error == 0) {
return 1;
}
@ -531,7 +540,9 @@ class Delivery extends CommonObject
$line->description = $expedition->lines[$i]->description;
$line->qty = $expedition->lines[$i]->qty_shipped;
$line->fk_product = $expedition->lines[$i]->fk_product;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($expedition->lines[$i]->array_options) && count($expedition->lines[$i]->array_options) > 0) { // For avoid conflicts if trigger used
$line->array_options = $expedition->lines[$i]->array_options;
}
$this->lines[$i] = $line;
}
@ -593,14 +604,18 @@ class Delivery extends CommonObject
* @param int $qty Qty
* @return void
*/
public function addline($origin_id, $qty)
public function addline($origin_id, $qty, $array_options = 0)
{
$num = count($this->lines);
global $conf;
$num = count($this->lines);
$line = new DeliveryLine($this->db);
$line->origin_id = $origin_id;
$line->qty = $qty;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used
$line->array_options = $array_options;
}
$this->lines[$num] = $line;
}

View File

@ -778,7 +778,6 @@ if (!empty($id) && $action != 'edit') {
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
/*
* Payments
@ -836,7 +835,6 @@ if (!empty($id) && $action != 'edit') {
dol_print_error($db);
}
print '</div>';
print '</div>';
print '</div>';
@ -919,9 +917,9 @@ if (!empty($id) && $action != 'edit') {
print showOnlinePaymentUrl('donation', $object->ref).'<br>';
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright">';
print '</div></div></div>';
print '</div></div>';
}
llxFooter();

View File

@ -190,7 +190,7 @@ print '</tr>';
print "</table>";
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
$max = 10;
@ -252,7 +252,7 @@ if ($resql) {
}
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardDonation', $parameters, $object); // Note that $action and $object may have been modified by hook

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