Merge branch 'develop' into translateModLivraison2ModDelivery

This commit is contained in:
AurelienBinard 2020-10-06 16:20:25 +02:00 committed by GitHub
commit 39d538befc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
75 changed files with 1703 additions and 696 deletions

View File

@ -0,0 +1,417 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/admin/subaccount.php
* \ingroup Accountancy (Double entries)
* \brief List of accounting sub-account (auxiliary accounts)
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "hrm", "errors"));
$mesg = '';
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
$search_subaccount = GETPOST('search_subaccount', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_type = GETPOST('search_type', 'int');
// Security check
if ($user->socid > 0) accessforbidden();
if (!$user->rights->accounting->chartofaccount) accessforbidden();
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) $sortfield = "label";
if (!$sortorder) $sortorder = "ASC";
$arrayfields = array(
'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
);
if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['reconcilable']);
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
if (!GETPOST('confirmmassaction', 'alpha')) { $massaction = ''; }
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if (!empty($cancel)) $action = '';
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_subaccount = "";
$search_label = "";
$search_type = "";
$search_array_options = array();
}
}
/*
* View
*/
$form = new Form($db);
llxHeader('', $langs->trans("ReportThirdParty"));
// Customer
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta <> ''";
//print $sql;
if (strlen(trim($search_subaccount))) {
$lengthpaddingaccount = 0;
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
for ($i = 0; $i < $lengthpaddingaccount; $i++) {
if (preg_match('/0$/', $search_subaccount_tmp)) {
$weremovedsomezero++;
$search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
}
}
}
//var_dump($search_subaccount); exit;
if ($search_subaccount_tmp) {
if ($weremovedsomezero) {
$search_subaccount_tmp_clean = $search_subaccount_tmp;
$search_subaccount_clean = $search_subaccount;
$startchar = '%';
if (strpos($search_subaccount_tmp, '^') === 0)
{
$startchar = '';
$search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
$search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
}
$sql .= " AND (sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
$sql .= " OR sa.code_compta LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
} else $sql .= natural_search("sa.code_compta", $search_subaccount_tmp);
}
}
if (strlen(trim($search_label))) $sql .= natural_search("sa.nom", $search_label);
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
// Supplier
$sql .= " UNION ";
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.code_compta_fournisseur <> ''";
//print $sql;
if (strlen(trim($search_subaccount))) {
$lengthpaddingaccount = 0;
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
for ($i = 0; $i < $lengthpaddingaccount; $i++) {
if (preg_match('/0$/', $search_subaccount_tmp)) {
$weremovedsomezero++;
$search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
}
}
}
//var_dump($search_subaccount); exit;
if ($search_subaccount_tmp) {
if ($weremovedsomezero) {
$search_subaccount_tmp_clean = $search_subaccount_tmp;
$search_subaccount_clean = $search_subaccount;
$startchar = '%';
if (strpos($search_subaccount_tmp, '^') === 0)
{
$startchar = '';
$search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
$search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
}
$sql .= " AND (sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
$sql .= " OR sa.code_compta_fournisseur LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
} else $sql .= natural_search("sa.code_compta_fournisseur", $search_subaccount_tmp);
}
}
if (strlen(trim($search_label))) $sql .= natural_search("sa.nom", $search_label);
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
// User
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.accountancy_code <> ''";
//print $sql;
if (strlen(trim($search_subaccount))) {
$lengthpaddingaccount = 0;
if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) {
$lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT);
}
$search_subaccount_tmp = $search_subaccount;
$weremovedsomezero = 0;
if (strlen($search_subaccount_tmp) <= $lengthpaddingaccount) {
for ($i = 0; $i < $lengthpaddingaccount; $i++) {
if (preg_match('/0$/', $search_subaccount_tmp)) {
$weremovedsomezero++;
$search_subaccount_tmp = preg_replace('/0$/', '', $search_subaccount_tmp);
}
}
}
//var_dump($search_subaccount); exit;
if ($search_subaccount_tmp) {
if ($weremovedsomezero) {
$search_subaccount_tmp_clean = $search_subaccount_tmp;
$search_subaccount_clean = $search_subaccount;
$startchar = '%';
if (strpos($search_subaccount_tmp, '^') === 0)
{
$startchar = '';
$search_subaccount_tmp_clean = preg_replace('/^\^/', '', $search_subaccount_tmp);
$search_subaccount_clean = preg_replace('/^\^/', '', $search_subaccount);
}
$sql .= " AND (u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_tmp_clean)."'";
$sql .= " OR u.accountancy_code LIKE '".$db->escape($startchar.$search_subaccount_clean)."%')";
} else $sql .= natural_search("u.accountancy_code", $search_subaccount_tmp);
}
}
if (strlen(trim($search_label))) $sql .= natural_search("u.lastname", $search_label);
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/admin/subaccount.php:: $sql='.$sql);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_subaccount) $param .= '&search_subaccount='.urlencode($search_subaccount);
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans('ReportThirdParty'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
print '<div class="warning">'.$langs->trans("WarningCreateSubAccounts").'</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = '';
$massactionbutton = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Line for search fields
print '<tr class="liste_titre_filter">';
if (!empty($arrayfields['subaccount']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_subaccount" value="'.$search_subaccount.'"></td>';
if (!empty($arrayfields['label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
if (!empty($arrayfields['type']['checked'])) print '<td class="liste_titre center">'.$form->selectarray('search_type', array('0'=>$langs->trans('Customer'), '1'=>$langs->trans('Supplier'), '2'=>$langs->trans('Employee')), $search_type, 1).'</td>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; }
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (!empty($arrayfields['subaccount']['checked'])) print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['label']['checked'])) print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], "label", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'center ');
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) print_liste_field_titre($arrayfields['reconcilable']['label'], $_SERVER["PHP_SELF"], 'reconcilable', '', $param, '', $sortfield, $sortorder, 'center '); }
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
$totalarray = array();
$i = 0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Account number
if (!empty($arrayfields['subaccount']['checked']))
{
print "<td>";
print length_accounta($obj->subaccount);
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Subaccount label
if (!empty($arrayfields['label']['checked']))
{
print "<td>";
print $obj->label;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Type
if (!empty($arrayfields['type']['checked']))
{
print '<td class="center">';
$s = '';
// Customer
if ($obj->type == 0)
{
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
}
// Supplier
elseif ($obj->type == 1)
{
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
}
// User
elseif ($obj->type == 2)
{
$s .= '<a class="user-back" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
}
print $s;
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
// Activated or not reconciliation on accounting account
if (!empty($arrayfields['reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
// Action
print '<td class="center">';
$e = '';
// Customer
if ($obj->type == 0)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
// Supplier
elseif ($obj->type == 1)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/societe/card.php?action=edit&socid='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
// User
elseif ($obj->type == 2)
{
$e .= '<a class="editfielda" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?action=edit&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().'</a>';
}
print $e;
print '</td>'."\n";
if (!$i) $totalarray['nbfield']++;
print '</tr>'."\n";
$i++;
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print "</div>";
print '</form>';
} else {
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -328,7 +328,7 @@ llxHeader('', $langs->trans("CreateMvts"));
// Confirmation to delete the command
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1);
print $formconfirm;
}

View File

@ -108,7 +108,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !isset($_POST['begin']) && !isset($_GET['begin']) && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
{
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values'))
{
@ -529,7 +529,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
$formother = new FormOther($db);
$formfile = new FormFile($db);
$title_page = $langs->trans("Bookkeeping");
$title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
// Count total nb of records
$nbtotalofrecords = '';
@ -608,22 +608,22 @@ if ($action == 'delbookkeepingyear') {
'default' => $deljournal
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
//$param=''; param started before
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="sortfield" value="'.urlencode($sortfield).'">';
print '<input type="hidden" name="sortorder" value="'.urlencode($sortorder).'">';
print '<input type="hidden" name="page" value="'.urlencode($page).'">';
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
else $buttonLabel = $langs->trans("ExportList");
@ -638,7 +638,8 @@ $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("I
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss'=>'btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly'));
$url = './card.php?action=create';
if (!empty($socid)) $url .= '&socid='.$socid;
@ -670,12 +671,10 @@ if (!empty($arrayfields['t.doc_date']['checked']))
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From').' ';
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
@ -703,25 +702,25 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
{
print '<td class="liste_titre">';
print '<div class="nowrap">';
print $langs->trans('From').' ';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
print $langs->trans('From').' ';
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
} else {
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'" placeholder="'.$langs->trans("From").'">';
}
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
// use setup of keypress to select thirdparty and this hang browser on large database.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
print $langs->trans('to').' ';
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
} else {
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'" placeholder="'.$langs->trans("to").'">';
}
print '</div>';
print '</td>';
@ -771,12 +770,10 @@ if (!empty($arrayfields['t.date_creation']['checked']))
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From').' ';
print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1);
print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1);
print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
@ -785,12 +782,10 @@ if (!empty($arrayfields['t.tms']['checked']))
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From').' ';
print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1);
print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1);
print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '</td>';
}
@ -799,12 +794,10 @@ if (!empty($arrayfields['t.date_export']['checked']))
{
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From').' ';
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1);
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to').' ';
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1);
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}

View File

@ -33,7 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
@ -55,6 +54,7 @@ if ($search_accountancy_code_end == - 1) {
}
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_label_operation = GETPOST('search_label_operation', 'alpha');
$search_mvt_num = GETPOST('search_mvt_num', 'int');
$search_direction = GETPOST('search_direction', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha');
@ -86,7 +86,7 @@ $hookmanager->initHooks(array('bookkeepingbyaccountlist'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
@ -149,6 +149,7 @@ if (empty($reshook))
$search_label_account = '';
$search_doc_ref = '';
$search_label_operation = '';
$search_mvt_num = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
@ -193,6 +194,10 @@ if (empty($reshook))
$filter['t.label_compte'] = $search_label_account;
$param .= '&search_label_compte=' . urlencode($search_label_account);
}
if (!empty($search_mvt_num)) {
$filter['t.piece_num'] = $search_mvt_num;
$param .= '&search_mvt_num=' . urlencode($search_mvt_num);
}
if (!empty($search_doc_ref)) {
$filter['t.doc_ref'] = $search_doc_ref;
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
@ -294,7 +299,7 @@ $formfile = new FormFile($db);
$formother = new FormOther($db);
$form = new Form($db);
$title_page = $langs->trans("Bookkeeping").' '.strtolower($langs->trans("By")).' '.strtolower($langs->trans("AccountAccounting"));
$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' ('.$langs->trans("Bookkeeping").')';
llxHeader('', $title_page);
@ -358,7 +363,7 @@ if ($action == 'delbookkeepingyear') {
'default' => $deljournal
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
print $formconfirm;
}
@ -370,16 +375,19 @@ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$opt
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected'));
$newcardbutton .= ' &nbsp; ';
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -394,10 +402,10 @@ $moreforfilter = '';
// Accountancy account
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap">';
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $langs->trans('From').' ';
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
$moreforfilter .= $langs->trans('to').' ';
$moreforfilter .= ' '.$langs->trans('to').' ';
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
@ -425,12 +433,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) {
if (!empty($arrayfields['t.doc_date']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $langs->trans('From') . ': ';
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
print '</div>';
print '<div class="nowrap">';
print $langs->trans('to') . ': ';
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1);
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
print '</div>';
print '</td>';
}
@ -697,10 +703,10 @@ while ($i < min($num, $limit))
print '<td class="nowraponall center">';
if (empty($line->date_export)) {
if ($user->rights->accounting->mouvements->creer) {
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
}
if ($user->rights->accounting->mouvements->supprimer) {
print '&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
print ' &nbsp; <a class="paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
}
}
print '</td>';

View File

@ -448,7 +448,7 @@ class AccountingAccount extends CommonObject
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
* @param string $option 'bookkeeping', 'bookkeepinglistbyaccount', 'accountcard'
* @param string $option 'ledger', 'journals', 'accountcard'
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
@ -460,12 +460,12 @@ class AccountingAccount extends CommonObject
$result = '';
if (empty($option) || $option == 'bookkeeping') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$labelurl = $langs->trans("ShowAccountingAccountInBookKeeping");
} elseif ($option == 'bookkeepinglistbyaccount') {
if (empty($option) || $option == 'ledger') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$labelurl = $langs->trans("ShowAccountingAccountInBookKeepingByAccount");
$labelurl = $langs->trans("ShowAccountingAccountInLedger");
} elseif ($option == 'journals') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$labelurl = $langs->trans("ShowAccountingAccountInJournals");
} elseif ($option == 'accountcard') {
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
$labelurl = $langs->trans("ShowAccountingAccount");

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.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
@ -2006,8 +2006,22 @@ class BookKeepingLine
public $label_operation;
public $debit;
public $credit;
/**
* @var float Amount
* @deprecated see $amount
*/
public $montant;
public $sens;
/**
* @var float Amount
*/
public $amount;
/**
* @var string Sens
*/
public $sens;
public $lettering_code;
/**

View File

@ -436,7 +436,7 @@ if ($sall) {
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled)) {
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Categories').': ';

View File

@ -472,22 +472,22 @@ print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->
print '<div class="centpertent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
print '</div>';
if (!empty($mysoc->logo_mini)) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
if (!empty($mysoc->logo_small)) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
print '<div class="inline-block valignmiddle">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} elseif (!empty($mysoc->logo)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo).'">';
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}
@ -499,23 +499,23 @@ print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto
print '<div class="centpertent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</div>';
if (!empty($mysoc->logo_squarred_mini)) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
if (!empty($mysoc->logo_squarred_small)) {
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
print '<div class="inline-block valignmiddle marginrightonly">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">';
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} elseif (!empty($mysoc->logo_squarred)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 60px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
print '</div>';
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
}
else {
print '<div class="inline-block valignmiddle">';
print '<img height="60" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '</div>';
}
}

View File

@ -458,148 +458,149 @@ $sql .= $db->plimit($listlimit + 1, $offset);
$fieldlist = explode(',', $tabfield[$id]);
// Form to add a new line
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
if ($action == 'view') {
// Form to add a new line
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
// Line to enter new values (title)
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$align = "left";
if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = (empty($conf->global->MAIN_MULTILANGS) ? '&nbsp;' : $langs->trans("Language")); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field] == 'private') { $align = 'center'; }
if ($fieldlist[$field] == 'position') { $align = 'center'; }
if ($fieldlist[$field] == 'topic') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'joinfiles') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'content') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'content_lines') { $valuetoshow = ''; }
if ($valuetoshow != '')
// Line to enter new values (title)
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
print '<td align="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (!empty($tabhelp[$id][$value]))
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$align = "left";
if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = (empty($conf->global->MAIN_MULTILANGS) ? '&nbsp;' : $langs->trans("Language")); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field] == 'private') { $align = 'center'; }
if ($fieldlist[$field] == 'position') { $align = 'center'; }
if ($fieldlist[$field] == 'topic') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'joinfiles') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'content') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'content_lines') { $valuetoshow = ''; }
if ($valuetoshow != '')
{
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
} else print $valuetoshow;
print '</td>';
print '<td align="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (!empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
} else print $valuetoshow;
print '</td>';
}
}
}
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '</tr>';
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '</tr>';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '')
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key => $val) {
if (GETPOST($val) != '')
$obj->$val = GETPOST($val);
}
}
}
$tmpaction = 'create';
$parameters = array(
$tmpaction = 'create';
$parameters = array(
'fieldlist' => $fieldlist,
'tabname' => $tabname[$id]
);
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
);
$reshook = $hookmanager->executeHooks('createEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error;
$errors = $hookmanager->errors;
// Line to enter new values (input fields)
print '<tr class="oddeven">';
// Line to enter new values (input fields)
print '<tr class="oddeven">';
if (empty($reshook))
{
if ($action == 'edit') {
fieldList($fieldlist, $obj, $tabname[$id], 'hide');
} else {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
}
print '<td class="right">';
print '</td>';
print "</tr>";
// Show fields for topic, join files and body
$fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); }
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
// Label
if ($tmpfieldlist == 'topic')
if (empty($reshook))
{
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
if ($action == 'edit') {
fieldList($fieldlist, $obj, $tabname[$id], 'hide');
} else {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
}
if ($tmpfieldlist == 'joinfiles')
print '<td class="right">';
print '</td>';
print "</tr>";
// Show fields for topic, join files and body
$fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); }
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
}
if ($tmpfieldlist == 'content')
print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
// Label
if ($tmpfieldlist == 'topic')
{
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
}
if ($tmpfieldlist == 'joinfiles')
{
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
}
if ($tmpfieldlist == 'content')
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
if ($tmpfieldlist == 'content_lines')
if ($tmpfieldlist == 'content_lines')
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
// Input field
if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
} elseif ($tmpfieldlist == 'joinfiles') {
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">';
} else {
if ($context != 'hide') {
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
// Input field
if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
} elseif ($tmpfieldlist == 'joinfiles') {
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">';
} else {
if ($context != 'hide') {
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
} else print '&nbsp;';
}
print '</td>';
if ($tmpfieldlist == 'topic') {
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit') {
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
} else print '&nbsp;';
}
print '</td>';
if ($tmpfieldlist == 'topic') {
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit') {
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
}
// else print '<td></td>';
print '</tr>';
}
// else print '<td></td>';
print '</tr>';
}
$colspan = count($fieldlist) + 1;
//print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
print '</table>';
print '</div>';
print '</form>';
print '<br>';
$colspan = count($fieldlist) + 1;
//print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
print '</table>';
print '</div>';
print '</form>';
print '<br>';
} // END IF not edit
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -644,7 +645,7 @@ if ($resql)
foreach ($fieldlist as $field => $value)
{
if ($value == 'label') {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
@ -780,7 +781,7 @@ if ($resql)
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
}
print '</td>';
@ -1032,7 +1033,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
else {
$size = ''; $class = ''; $classtd = '';
if ($fieldlist[$field] == 'code') $class = 'maxwidth100';
if ($fieldlist[$field] == 'label') $class = 'maxwidth100';
if ($fieldlist[$field] == 'label') $class = 'maxwidth200';
if ($fieldlist[$field] == 'private') { $class = 'maxwidth50'; $classtd = 'center'; }
if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; $classtd = 'center'; }
if ($fieldlist[$field] == 'libelle') $class = 'quatrevingtpercent';

View File

@ -464,7 +464,7 @@ if ($resql)
print '<tr class="oddeven">';
print '<td class="tdoverflowmax300">'.$obj->name.'</td>'."\n";
print '<td class="tdoverflowmax300">';
if (preg_match('/(_pass|password|_pw|_key|securekey|serverkey|secret\d?|p12key|exportkey|_PW_[a-z]+|token)$/i', $obj->name)) {
if (isASecretKey($obj->name)) {
if (empty($dolibarr_main_prod)) {
print '<!-- '.$obj->value.' -->';
}

View File

@ -40,7 +40,7 @@ class Login
*
* Request the API token for a couple username / password.
* Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file).
* Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: The API key (DOLAPIKEY) can be found/set on the user page.
* Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: The API token (DOLAPIKEY) can be found/set on the user page.
*
* @param string $login User login
* @param string $password User password

View File

@ -66,6 +66,10 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid, code, libelle as label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
$sql .= " WHERE t.active = ".$active;
@ -127,6 +131,10 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->rights->propal->lire && !DolibarrApiAccess::$user->rights->commande->lire && !DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$sql = "SELECT id, code, type, libelle as label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_paiement as t";
$sql .= " WHERE t.entity IN (".getEntity('c_paiement').")";
@ -468,6 +476,10 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid, code, label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_availability as t";
$sql .= " WHERE t.active = ".$active;
@ -960,6 +972,10 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->admin) {
throw new RestException(401, 'Only an admin user can get list of extrafields');
}
if ($type == 'thirdparty') $type = 'societe';
if ($type == 'contact') $type = 'socpeople';
@ -1100,6 +1116,10 @@ class Setup extends DolibarrApi
{
$list = array();
if (!DolibarrApiAccess::$user->rights->propal->lire && !DolibarrApiAccess::$user->rights->commande->lire && !DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql .= " WHERE t.entity IN (".getEntity('c_payment_term').")";
@ -1545,15 +1565,15 @@ class Setup extends DolibarrApi
global $conf;
if (!DolibarrApiAccess::$user->admin
&& (empty($conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK)) {
throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK');
&& (empty($conf->global->API_LOGINS_ALLOWED_FOR_CONST_READ) || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_CONST_READ)) {
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_CONST_READ');
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
throw new RestException(404, 'Error Bad or unknown value for constantname');
}
if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $constantname)) {
throw new RestException(403, 'Forbidden');
if (isASecretKey($constantname)) {
throw new RestException(403, 'Forbidden. This parameter cant be read with APIs');
}
return $conf->global->$constantname;
@ -1578,7 +1598,7 @@ class Setup extends DolibarrApi
if (!DolibarrApiAccess::$user->admin
&& (empty($conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK))
{
throw new RestException(503, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK');
throw new RestException(503, 'Error API open to admin users only or to the users with logins defined into constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK');
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';

View File

@ -179,8 +179,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$companystatic->code_compta = $obj->code_compta;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="nowrap right">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>';
print '</tr>';
@ -243,8 +243,8 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$companystatic->email = $obj->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$supplierproposalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>';
@ -308,8 +308,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$companystatic->entity = $obj->entity;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$orderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$orderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>';
@ -373,8 +373,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic->email = $obj->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$supplierorderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>';
@ -441,7 +441,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="right" nowrap>'.$companystatic->getLibCustProspStatut().'</td>';
print '<td class="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
print '</tr>';
@ -493,7 +493,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
print '</tr>';

View File

@ -507,9 +507,10 @@ class Proposals extends DolibarrApi
* Delete a contact type of given commercial proposal
*
* @param int $id Id of commercial proposal to update
* @param int $rowid Row key of the contact in the array contact_ids.
* @param int $contactid Row key of the contact in the array contact_ids.
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
*
* @url DELETE {id}/contact/{rowid}
* @url DELETE {id}/contact/{contactid}/{type}
*
* @return int
*
@ -517,7 +518,7 @@ class Proposals extends DolibarrApi
* @throws RestException 404
* @throws RestException 500
*/
public function deleteContact($id, $rowid)
public function deleteContact($id, $contactid, $type)
{
if (!DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
@ -533,13 +534,19 @@ class Proposals extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->propal->delete_contact($rowid);
$contacts = $this->invoice->liste_contact();
if (!$result) {
throw new RestException(500, 'Error when deleted the contact');
}
foreach ($contacts as $contact) {
if ($contact['id'] == $contactid && $contact['code'] == $type) {
$result = $this->propal->delete_contact($contact['rowid']);
return $this->propal;
if (!$result) {
throw new RestException(500, 'Error when deleted the contact');
}
}
}
return $this->_cleanObjectDatas($this->propal);
}
/**

View File

@ -542,7 +542,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view products
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -551,7 +551,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -593,7 +593,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -602,7 +602,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -149,7 +149,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Customer invoices
if (GETPOST('selectinvoices')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens";
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -158,7 +158,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Vendor invoices
if (GETPOST('selectsupplierinvoices')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
$sql .= " WHERE datef between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -167,7 +167,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Expense reports
if (GETPOST('selectexpensereports')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE date_fin between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -176,7 +176,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Donations
if (GETPOST('selectdonations')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens";
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
$sql .= " WHERE datedon between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -185,7 +185,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Paiements of salaries
if (GETPOST('selectpaymentsofsalaries')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
$sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -194,7 +194,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Social contributions
if (GETPOST('selectsocialcontributions')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
$sql .= " WHERE t.date_ech between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -203,7 +203,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Various payments
if (GETPOST('selectvariouspayment')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
$sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -211,7 +211,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
// Loan payments
if (GETPOST('selectloanspayment')) {
if (!empty($sql)) $sql .= " UNION ALL";
$sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_loan as t LEFT JOIN ".MAIN_DB_PREFIX."loan as l ON l.rowid = t.fk_loan";
$sql .= " WHERE datep between ".$wheretail;
$sql .= " AND l.entity IN (".($entity == 1 ? '0,1' : $entity).')';
@ -525,6 +525,9 @@ dol_fiche_head($head, 'AccountancyFiles');
print '<form name="searchfiles" action="?action=searchfiles" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<span class="opacitymedium">'.$langs->trans("ExportAccountingSourceDocHelp", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals")).'</span><br>';
print '<br>';
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";

View File

@ -276,7 +276,7 @@ if ($sall)
$moreforfilter = '';
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
}

View File

@ -476,10 +476,10 @@ class Invoices extends DolibarrApi
* Delete a contact type of given invoice
*
* @param int $id Id of invoice to update
* @param int $rowid Row key of the contact in the array contact_ids.
* @param int $contactid Row key of the contact in the array contact_ids.
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
*
* @url DELETE {id}/contact/{rowid}/{type}
* @url DELETE {id}/contact/{contactid}/{type}
*
* @return array
*
@ -487,7 +487,7 @@ class Invoices extends DolibarrApi
* @throws RestException 404
* @throws RestException 500
*/
public function deleteContact($id, $rowid, $type)
public function deleteContact($id, $contactid, $type)
{
if (!DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
@ -506,7 +506,7 @@ class Invoices extends DolibarrApi
$contacts = $this->invoice->liste_contact();
foreach ($contacts as $contact) {
if ($contact['id'] == $rowid && $contact['code'] == $type) {
if ($contact['id'] == $contactid && $contact['code'] == $type) {
$result = $this->invoice->delete_contact($contact['rowid']);
if (!$result) {
@ -996,6 +996,8 @@ class Invoices extends DolibarrApi
*/
public function markAsCreditAvailable($id)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
if (!DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}

View File

@ -357,7 +357,7 @@ if ($resql)
if (!empty($arrayfields['f.titre']['checked']))
{
print '<td class="liste_titre left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
// Thirpdarty
@ -529,7 +529,7 @@ if ($resql)
if (!empty($arrayfields['f.titre']['checked']))
{
print '<td>';
print '<td class="nowrap tdoverflowmax200">';
print $invoicerectmp->getNomUrl(1);
print "</a>";
print "</td>\n";

View File

@ -729,7 +729,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -738,7 +738,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -213,11 +213,11 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td class="nowrap">';
print '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
print $facturestatic->getNomUrl(1, '');
print '</td>';
print '<td class="nowrap">';
print $companystatic->getNomUrl(1, 'customer', 16);
print '<td class="nowrap tdoverflowmax100">';
print $companystatic->getNomUrl(1, 'customer');
print '</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
print '</tr>';
@ -305,11 +305,11 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$companystatic->code_compta = $obj->code_compta;
$companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td class="nowrap">';
print $facturesupplierstatic->getNomUrl(1, '', 16);
print '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
print $facturesupplierstatic->getNomUrl(1, '');
print '</td>';
print '<td>';
print $companystatic->getNomUrl(1, 'supplier', 16);
print '<td class="nowrap tdoverflowmax100">';
print $companystatic->getNomUrl(1, 'supplier');
print '</td>';
print '<td class="right">'.price($obj->total_ttc).'</td>';
print '</tr>';
@ -550,11 +550,11 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$thirdpartystatic->code_compta = '';
$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven nowraponall"><td>';
print '<tr class="oddeven nowraponall tdoverflowmax100"><td>';
print $facstatic->getNomUrl(1, '');
print '</td>';
print '<td>';
print $thirdpartystatic->getNomUrl(1, 'supplier', 44);
print '<td class="nowrap tdoverflowmax100">';
print $thirdpartystatic->getNomUrl(1, 'supplier');
print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
@ -647,7 +647,7 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire)
$label = $donationstatic->getFullName($langs);
if ($objp->societe) $label .= ($label ? ' - ' : '').$objp->societe;
print '<tr class="oddeven">';
print '<tr class="oddeven tdoverflowmax100">';
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
print '<td>'.$label.'</td>';
print '<td class="nowrap right">'.price($objp->amount).'</td>';
@ -734,7 +734,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$chargestatic->paye = $obj->paye;
print '<tr class="oddeven">';
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
print '<td class="nowraponall">'.$chargestatic->getNomUrl(1).'</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
print '<td class="nowrap right">'.price($obj->amount).'</td>';
print '<td class="nowrap right">'.price($obj->sumpaid).'</td>';
@ -875,8 +875,8 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
print '</td>';
print '<td class="left">';
print $societestatic->getNomUrl(1, 'customer', 44);
print '<td class="nowrap tdoverflowmax100">';
print $societestatic->getNomUrl(1, 'customer');
print '</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
@ -1022,8 +1022,8 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</td></tr></table>';
print '</td>';
print '<td class="left">';
print $societestatic->getNomUrl(1, 'customer', 44);
print '<td class="nowrap tdoverflowmax100">';
print $societestatic->getNomUrl(1, 'customer');
print '</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
@ -1157,10 +1157,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$societestatic->code_compta = $obj->code_compta;
$societestatic->code_compta_fournisseur = $obj->code_compta_fournisseur;
print '<tr class="oddeven"><td>';
print '<tr class="oddeven"><td class="nowrap tdoverflowmax100">';
print $facstatic->getNomUrl(1, '');
print '</td>';
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$societestatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement), 'day').'</td>';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';

View File

@ -1,13 +1,14 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,6 +31,11 @@
*/
require '../../main.inc.php';
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $facid, '');
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -39,136 +45,159 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist';
$facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int');
$day = GETPOST('day', 'int');
$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
$facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int');
$userid = GETPOST('userid', 'int');
$day = GETPOST('day', 'int');
$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
// Security check
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'facture', $facid, '');
$search_ref = GETPOST("search_ref", "alpha");
$search_account = GETPOST("search_account", "int");
$search_paymenttype = GETPOST("search_paymenttype");
$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
$search_company = GETPOST("search_company", 'alpha');
$search_payment_num = GETPOST('search_payment_num', 'alpha');
$paymentstatic = new Paiement($db);
$accountstatic = new Account($db);
$companystatic = new Societe($db);
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$search_ref = GETPOST("search_ref", "alpha");
$search_account = GETPOST("search_account", "int");
$search_paymenttype = GETPOST("search_paymenttype");
$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
$search_company = GETPOST("search_company", 'alpha');
$search_payment_num = GETPOST('search_payment_num', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "p.rowid";
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Paiement($db);
$hookmanager->initHooks(array('paymentlist'));
$extrafields = new ExtraFields($db);
$arrayfields = array();
$arrayfields = array(
'p.rowid' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
'p.datep' => array('label'=>"Date", 'checked'=>1, 'position'=>20),
's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40),
'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))),
'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))),
'p.num_payment' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"),
'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80),
'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_ref = "";
$search_account = "";
$search_amount = "";
$search_paymenttype = "";
$search_payment_num = "";
$search_company = "";
$day = '';
$year = '';
$month = '';
$search_array_options = array();
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// All tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
$search_ref = '';
$search_account = '';
$search_amount = '';
$search_paymenttype = '';
$search_payment_num = '';
$search_company = '';
$day = '';
$year = '';
$month = '';
$option = '';
$toselect = '';
$search_array_options = array();
}
}
/*
* View
* View
*/
$form = new Form($db);
$formother = new FormOther($db);
$accountstatic = new Account($db);
$companystatic = new Societe($db);
$bankline = new AccountLine($db);
llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha"))
{
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
$sql .= " p.statut, p.num_paiement as num_payment,";
$sql .= " c.code as paiement_code";
if (GETPOST("orphelins", "alpha")) {
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement as num_payment";
$sql .= ", c.code as paiement_code";
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
$sql .= " AND pf.fk_facture IS NULL";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
$sql .= " AND pf.fk_facture IS NULL";
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
} else {
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql .= " p.statut, p.num_paiement as num_payment,";
$sql .= " c.code as paiement_code,";
$sql .= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
$sql .= " s.rowid as socid, s.nom as name, s.email";
// DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement as num_payment";
$sql .= ", c.code as paiement_code";
$sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid)
{
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
}
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$socid)
{
$sql .= " AND sc.fk_user = ".$user->id;
}
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
if ($userid)
{
if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
else $sql .= " AND f.fk_user_author = ".$userid;
}
// Search criteria
$sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
$sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
}
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND sc.fk_user = ".$user->id;
}
if ($socid > 0) {
$sql .= " AND f.fk_soc = ".$socid;
}
if ($userid) {
if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
else $sql .= " AND f.fk_user_author = ".$userid;
}
// Search criteria
$sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
if ($search_paymenttype != '') $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
@ -177,209 +206,278 @@ if (GETPOST("orphelins", "alpha"))
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
// if total resultset is smaller then paging size (filtering), goto and load page 0
if (($page * $limit) > $nbtotalofrecords) {
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
//print "$sql";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
$param .= (GETPOST("orphelins") ? "&orphelins=1" : "");
$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : "");
$param .= ($search_company ? "&search_company=".urlencode($search_company) : "");
$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : "");
$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : "");
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Lines for filters fields
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
print '<td class="liste_titre">';
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
print '</td>';
if (!empty($conf->banque->enabled))
{
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
print '</td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
print '<td class="liste_titre right">';
print '</td>';
}
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "dp", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder);
if (!empty($conf->banque->enabled))
{
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
}
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", $param, 'class="right"', $sortfield, $sortorder);
//print_liste_field_titre("Invoices"),"","","",$param,'class="left"',$sortfield,$sortorder);
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.statut", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
$i = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($resql);
$paymentstatic->id = $objp->rowid;
$paymentstatic->ref = $objp->ref;
$companystatic->id = $objp->socid;
$companystatic->name = $objp->name;
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
print '<td>';
print $paymentstatic->getNomUrl(1);
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Date
$dateformatforpayment = 'day';
if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour';
print '<td class="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>';
if (!$i) $totalarray['nbfield']++;
// Thirdparty
print '<td>';
if ($objp->socid > 0)
{
print $companystatic->getNomUrl(1, '', 24);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
if (!$i) $totalarray['nbfield']++;
// Payment number
print '<td>'.$objp->num_payment.'</td>';
if (!$i) $totalarray['nbfield']++;
// Account
if (!empty($conf->banque->enabled))
{
print '<td>';
if ($objp->bid > 0)
{
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->blabel;
$accountstatic->number = $objp->number;
$accountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
print $accountstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
print '<td class="right">'.price($objp->amount).'</td>';
if (!$i) $totalarray['nbfield']++;
$totalarray['pos'][7] = 'amount';
$totalarray['val']['amount'] += $objp->amount;
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
print '<td class="right">';
if ($objp->statut == 0) print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">';
print $paymentstatic->LibStatut($objp->statut, 5);
if ($objp->statut == 0) print '</a>';
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
print '<td></td>';
if (!$i) $totalarray['nbfield']++;
print '</tr>';
$i++;
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>\n";
print "</div>";
print "</form>\n";
} else {
dol_print_error($db);
if (!$resql) {
dol_print_error($db);
llxFooter();
$db->close();
exit;
}
$num = $db->num_rows($resql);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
$param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1);
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
print '<tr class="liste_titre_filter">';
// Filters: Lines (placeholder)
print '<tr class="liste_titre_filter">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td class="liste_titre">';
print '</td>';
}
// Filter: Ref
if (!empty($arrayfields['p.rowid']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
print '</td>';
}
// Filter: Date
if (!empty($arrayfields['p.datep']['checked'])) {
print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
print '</td>';
}
// Filter: Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
}
// Filter: Payment type
if (!empty($arrayfields['c.libelle']['checked'])) {
print '<td class="liste_titre">';
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
print '</td>';
}
// Filter: Bank transaction number
if (!empty($arrayfields['transaction']['checked'])) {
print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
print '</td>';
}
// Filter: Cheque number (fund transfer)
if (!empty($arrayfields['p.num_payment']['checked'])) {
print '<td class="liste_titre">';
print '</td>';
}
// Filter: Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td class="liste_titre">';
$form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>';
}
// Filter: Amount
if (!empty($arrayfields['p.amount']['checked'])) {
print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
print '</td>';
}
// Filter: Status (only placeholder)
if (!empty($arrayfields['p.statut']['checked'])) {
print '<td class="liste_titre right">';
print '</td>';
}
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre maxwidthsearch">';
print $form->showFilterAndCheckAddButtons(0);
print '</td>';
print "</tr>";
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.num_payment']['checked'])) print_liste_field_titre($arrayfields['p.num_payment']['label'], $_SERVER["PHP_SELF"], "p.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_payment']['tooltip']);
if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder);
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>";
$i = 0;
$totalarray = array();
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$object->id = $objp->rowid;
$object->ref = $objp->ref;
$companystatic->id = $objp->socid;
$companystatic->name = $objp->name;
$companystatic->email = $objp->email;
print '<tr class="oddeven">';
// No
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
print '<td>'.(($offset * $limit) + $i).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Ref
if (!empty($arrayfields['p.rowid']['checked'])) {
print '<td>'.$object->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Date
if (!empty($arrayfields['p.datep']['checked'])) {
$dateformatforpayment = 'day';
if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour';
print '<td class="center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td>';
if ($objp->socid > 0) {
print $companystatic->getNomUrl(1, '', 24);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Payment type
if (!empty($arrayfields['c.libelle']['checked'])) {
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Filter: Cheque number (fund transfer)
if (!empty($arrayfields['p.num_payment']['checked'])) {
print '<td>'.$objp->num_payment.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Bank transaction
if (!empty($arrayfields['transaction']['checked'])) {
$bankline->fetch($objp->fk_bank);
print '<td>'.$bankline->getNomUrl(1, 0).'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Bank account
if (!empty($arrayfields['ba.label']['checked'])) {
print '<td>';
if ($objp->bid > 0) {
$accountstatic->id = $objp->bid;
$accountstatic->ref = $objp->bref;
$accountstatic->label = $objp->blabel;
$accountstatic->number = $objp->number;
$accountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($objp->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
print $accountstatic->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount
if (!empty($arrayfields['p.amount']['checked'])) {
print '<td class="right">'.price($objp->amount).'</td>';
if (!$i) $totalarray['nbfield']++;
$totalarray['pos'][8] = 'amount';
$totalarray['val']['amount'] += $objp->amount;
}
// Status
if (!empty($arrayfields['p.statut']['checked'])) {
print '<td class="right">';
if ($objp->statut == 0) print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">';
print $object->LibStatut($objp->statut, 5);
if ($objp->statut == 0) print '</a>';
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Buttons
print '<td></td>';
if (!$i) $totalarray['nbfield']++;
print '</tr>';
$i++;
}
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
print "</table>";
print "</div>";
print "</form>";
// End of page
llxFooter();
$db->close();

View File

@ -571,7 +571,7 @@ if ($search_firstlast_only)
}
$moreforfilter = '';
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -594,21 +594,20 @@ if (!empty($conf->categorie->enabled))
$moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1);
$moreforfilter .= '</div>';
}
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Roles').': ';
$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
$moreforfilter .= '</div>';
}
if ($moreforfilter)
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array('type'=>$type);
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Roles').': ';
$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
$moreforfilter .= '</div>';
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array('type'=>$type);
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);

View File

@ -9,7 +9,7 @@
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.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
@ -1192,7 +1192,7 @@ if ($action == 'create')
// Other attributes
if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters);
print $object->showOptionals($extrafields, 'create', $parameters);
}
print "</table>\n";

View File

@ -416,7 +416,7 @@ if ($user->rights->user->user->lire)
$moreforfilter .= '</div>';
}
// If the user can view categories of products
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -202,7 +202,7 @@ class box_activity extends ModeleBoxes
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ")";
$sql .= " WHERE c.entity = ".$conf->entity;
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;

View File

@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND c.entity IN (".getEntity('commande').")";
if (!empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql .= " AND c.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;

View File

@ -91,7 +91,7 @@ class box_propales extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE p.fk_soc = s.rowid";
$sql .= " AND p.entity = ".$conf->entity;
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC ";

View File

@ -104,7 +104,7 @@ class box_shipments extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity = ".$conf->entity;
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";

View File

@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";

View File

@ -95,8 +95,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;

View File

@ -325,7 +325,7 @@ abstract class CommonDocGenerator
foreach ($conf->global as $key => $val)
{
if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $key)) $newval = '*****forbidden*****';
if (isASecretKey($key)) $newval = '*****forbidden*****';
else $newval = $val;
$array_other['__['.$key.']__'] = $newval;
}

View File

@ -816,6 +816,7 @@ class dolReceiptPrinter extends Printer
if ($this->printer->connector instanceof DummyPrintConnector)
{
$data = $this->printer->connector->getData();
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") echo base64_encode($data);
dol_syslog($data);
}
// Close and print

View File

@ -106,12 +106,17 @@ abstract class DoliDB implements Database
/**
* Sanitize a string for SQL forging
*
* @param string $stringtosanitize String to escape
* @param string $stringtosanitize String to escape
* @param int $allowsimplequote Allow simple quote
* @return string String escaped
*/
public function sanitize($stringtosanitize)
public function sanitize($stringtosanitize, $allowsimplequote = 0)
{
return preg_replace('/[^a-z0-9_\-\.,]/i', '', $stringtosanitize);
if ($allowsimplequote) {
return preg_replace('/[^a-z0-9_\-\.,\']/i', '', $stringtosanitize);
} else {
return preg_replace('/[^a-z0-9_\-\.,]/i', '', $stringtosanitize);
}
}
/**

View File

@ -157,7 +157,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
*/
function show_array_actions_to_do($max = 5)
{
global $langs, $conf, $user, $db, $bc, $socid;
global $langs, $conf, $user, $db, $socid;
$now = dol_now();
@ -171,7 +171,7 @@ function show_array_actions_to_do($max = 5)
$sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE a.entity = ".$conf->entity;
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND s.rowid = ".$socid;
@ -256,7 +256,7 @@ function show_array_actions_to_do($max = 5)
*/
function show_array_last_actions_done($max = 5)
{
global $langs, $conf, $user, $db, $bc, $socid;
global $langs, $conf, $user, $db, $socid;
$now = dol_now();
@ -267,7 +267,7 @@ function show_array_last_actions_done($max = 5)
$sql .= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE a.entity = ".$conf->entity;
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
$sql .= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($socid) $sql .= " AND s.rowid = ".$socid;

View File

@ -118,6 +118,17 @@ function setEntity($currentobject)
}
}
/**
* Return if string has a name dedicated to store a secret
*
* @param string $keyname Name of key to test
* @return boolean True if key is used to store a secret
*/
function isASecretKey($keyname)
{
return preg_match('/(_pass|password|_pw|_key|securekey|serverkey|secret\d?|p12key|exportkey|_PW_[a-z]+|token)$/i', $keyname);
}
/**
* Return information about user browser
*
@ -6452,7 +6463,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null)
if (dol_textishtml($text, 1)) $msgishtml = 1;
$keyfound = $reg[1];
if (preg_match('/(_pass|_pw|password|secret|_key|key$)/i', $keyfound)) $newval = '*****forbidden*****';
if (isASecretKey($keyfound)) $newval = '*****forbidden*****';
else $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound;
$text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ?dol_htmlentitiesbr($newval) : $newval, $text);
}
@ -7817,7 +7828,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$listofcodes .= "'".$db->escape($val)."'";
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes).")";
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
$i2++; // a criteria was added to string
}
if ($mode == -3) $newres .= ' OR '.$field.' IS NULL';

View File

@ -122,7 +122,11 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P')
define('K_SMALL_RATIO', 2 / 3);
define('K_THAI_TOPCHARS', true);
define('K_TCPDF_CALLS_IN_HTML', true);
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
if (! empty($conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE)) {
define('K_TCPDF_THROW_EXCEPTION_ERROR', true);
} else {
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
}
}
// Load TCPDF

View File

@ -170,7 +170,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 0"; // Limit to products
$sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
@ -208,7 +208,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 0"; // Limit to products
$sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -312,7 +312,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 1"; // Limit to services
$sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
@ -350,7 +350,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 1"; // Limit to services
$sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -451,7 +451,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
if ($date_start && $date_end) $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = -1";
$sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql .= " ORDER BY e.rowid";
if (!$sql)
@ -622,7 +622,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 0"; // Limit to products
$sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
@ -660,7 +660,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 0"; // Limit to products
$sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -764,7 +764,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 1"; // Limit to services
$sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
@ -802,7 +802,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = 1"; // Limit to services
$sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)";
$sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
}
@ -903,7 +903,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql .= " AND (d.product_type = -1";
$sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)";
$sql .= " ORDER BY e.rowid";
if (!$sql)

View File

@ -258,7 +258,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartsubledger',2451__+MAX_llx_menu__, '/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ChartOfSubaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 45, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
@ -288,10 +289,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __ENTITY__);
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __ENTITY__);
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__);
-- General Ledger
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
-- Balance
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 10, __ENTITY__);
-- General Ledger
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__);
-- Journals
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
-- Export accounting documents
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__);
-- Reports

View File

@ -551,7 +551,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
{
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu">';
else print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
print $menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';
else print '</span>';

View File

@ -1200,6 +1200,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
$newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40);
$newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
$newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41);
$newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50);
$newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60);
if (!empty($conf->banque->enabled)) {
@ -1314,13 +1315,21 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Accounting
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1);
// General Ledger
$newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);
// Balance
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
// General Ledger
$newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);
// Journals
$newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire);
// Files
if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU))
{
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
}
// Closure
if (!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
$newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&amp;leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
@ -1330,12 +1339,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
}
// Files
if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU))
{
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&amp;leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
}
// Reports
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca');
@ -1429,11 +1432,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report", $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire);
$newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire);
$newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire);
// Journaux
// Journals
$newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50);
$newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51);
}
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
}
// Assets
@ -2062,7 +2065,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
{
print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
if ($shorturlwithoutparam) print '<a class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu">';
else print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
print $menu_array[$i]['titre'];
if ($shorturlwithoutparam) print '</a>';
else print '</span>';

View File

@ -402,8 +402,8 @@ class MenuManager
if ($this->menu->liste[$i]['enabled'])
{
print $tabstring;
if ($this->menu->liste[$i]['url']) print '<a class="vsmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu">';
if ($this->menu->liste[$i]['url']) print '<a class="vsmenu" itle="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>';
else print '<span class="vsmenu" title="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'">';
if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].'</a>';
else print '</span>';
} else {

View File

@ -266,7 +266,7 @@ class mailing_fraise extends MailingTargets
if ($dateendsubscriptionbefore > 0) $sql .= " AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
$sql .= " AND a.fk_adherent_type = ta.rowid";
// Filter on type
if (GETPOSTISET('filter_type')) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'";
if (GETPOSTISSET('filter_type')) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'";
// Filter on category
if (GETPOSTISSET('filter_category')) $sql .= " AND c.rowid='".$this->db->escape(GETPOST('filter_category'))."'";
$sql .= " ORDER BY a.email";
@ -302,7 +302,7 @@ class mailing_fraise extends MailingTargets
'source_url' => $this->url($obj->id),
'source_id' => $obj->id,
'source_type' => 'member'
);
);
$old = $obj->email;
$j++;
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Ahmad Jamaly Rabub <rabib@metroworks.co.jp>
*
* 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
@ -262,6 +263,161 @@ class modCommande extends DolibarrModules
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('commande').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
// Imports
//--------
$r=0;
//Import Order Header
$r++;
$this->import_code[$r] = 'commande_' . $r;
$this->import_label[$r] = 'Sales Orders';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'commande', 'extra' => MAIN_DB_PREFIX . 'commande_extrafields'];
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
'c.ref' => 'Document Ref*',
'c.ref_client' => 'RefCustomer',
'c.fk_soc' => 'ThirdPartyName*',
'c.fk_projet' => 'ProjectId',
'c.date_creation' => 'DateCreation',
'c.date_valid' => 'DateValid',
'c.date_commande' => 'DateOrder',
'c.fk_user_modif' => 'ModifiedById',
'c.fk_user_valid' => 'ValidatedById',
'c.fk_statut' => 'Status*',
'c.remise_percent' => 'GlobalDiscount',
'c.tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC',
'c.note_private' => 'NotePrivate',
'c.note_public' => 'Note',
'c.facture' => 'Invoice(1/0)',
'c.date_livraison' => 'DeliveryDate',
'c.fk_cond_reglement' => 'Payment Condition',
'c.fk_mode_reglement' => 'Payment Mode',
'c.model_pdf' => 'Model'
];
if (! empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
$this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
$this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande' AND entity IN (0, " . $conf->entity . ")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
$import_extrafield_sample[$fieldname] = $fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande'];
$this->import_regex_array[$r] = [
'c.ref' => '(CPV\d{4}-\d{4}|CO\d{4}-\d{4}|PROV.{1,32}$)',
'c.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
];
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
$this->import_convertvalue_array[$r] = [
'c.fk_soc' => [
'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php',
'class' => 'Societe',
'method' => 'fetch',
'element' => 'ThirdParty'
],
'c.fk_user_valid' => [
'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php',
'class' => 'User',
'method' => 'fetch',
'element' => 'user'
],
'c.fk_mode_reglement' => [
'rule' => 'fetchidfromcodeorlabel',
'file' => '/compta/paiement/class/cpaiement.class.php',
'class' => 'Cpaiement',
'method' => 'fetch',
'element' => 'cpayment'
],
];
//Import CPV Lines
$r++;
$this->import_code[$r] = 'commande_lines_'.$r;
$this->import_label[$r] = 'Order Details';
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = [];
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX . 'commandedet', 'extra' => MAIN_DB_PREFIX . 'commandedet_extrafields'];
$this->import_fields_array[$r] = [
'cd.fk_commande' => 'Document Ref*',
'cd.fk_parent_line' => 'PrParentLine',
'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
'cd.description' => 'LineDescription',
'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent',
'cd.remise' => 'Reduc.',
'cd.price' => 'Price',
'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT',
'cd.total_tva' => 'LineTotalVAT',
'cd.total_ttc' => 'LineTotalTTC',
'cd.product_type' => 'TypeOfLineServiceOrProduct',
'cd.date_start' => 'Start Date',
'cd.date_end' => 'End Date',
'cd.buy_price_ht' => 'LineBuyPriceHT',
'cd.rang' => 'LinePosition'
];
if (! empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
$this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
$this->import_fields_array[$r]['cd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commandedet' AND entity IN (0, " . $conf->entity . ")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commandedet'];
$this->import_regex_array[$r] = [
'cd.product_type' => '[0|1]$',
'cd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product',
'cd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
];
$this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Sales Order Id', 'cd.fk_product' => 'Product Id'];
$this->import_convertvalue_array[$r] = [
'cd.fk_commande' => [
'rule' => 'fetchidfromref',
'file' => '/commande/class/commande.class.php',
'class' => 'Commande',
'method' => 'fetch',
'element' => 'commande'
],
];
}

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2020 Ahmad Jamaly Rabib <rabib@metroworks.co.jp>
*
* 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
@ -120,13 +121,13 @@ class modFournisseur extends DolibarrModules
// Boxes
$this->boxes = array(
0=>array('file'=>'box_graph_invoices_supplier_permonth.php', 'enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_graph_orders_supplier_permonth.php', 'enabledbydefaulton'=>'Home'),
2=>array('file'=>'box_fournisseurs.php', 'enabledbydefaulton'=>'Home'),
3=>array('file'=>'box_factures_fourn_imp.php', 'enabledbydefaulton'=>'Home'),
4=>array('file'=>'box_factures_fourn.php', 'enabledbydefaulton'=>'Home'),
5=>array('file'=>'box_supplier_orders.php', 'enabledbydefaulton'=>'Home'),
6=>array('file'=>'box_supplier_orders_awaiting_reception.php', 'enabledbydefaulton'=>'Home'),
0=>array('file'=>'box_graph_invoices_supplier_permonth.php', 'enabledbydefaulton'=>'Home'),
1=>array('file'=>'box_graph_orders_supplier_permonth.php', 'enabledbydefaulton'=>'Home'),
2=>array('file'=>'box_fournisseurs.php', 'enabledbydefaulton'=>'Home'),
3=>array('file'=>'box_factures_fourn_imp.php', 'enabledbydefaulton'=>'Home'),
4=>array('file'=>'box_factures_fourn.php', 'enabledbydefaulton'=>'Home'),
5=>array('file'=>'box_supplier_orders.php', 'enabledbydefaulton'=>'Home'),
6=>array('file'=>'box_supplier_orders_awaiting_reception.php', 'enabledbydefaulton'=>'Home'),
);
// Permissions
@ -190,12 +191,12 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][5] = 'receptionner';
$r++;
$this->rights[$r][0] = 1189;
$this->rights[$r][1] = 'Check/Uncheck a supplier order reception';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'commande_advance';
$this->rights[$r][5] = 'check';
$this->rights[$r][0] = 1189;
$this->rights[$r][1] = 'Check/Uncheck a supplier order reception';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'commande_advance';
$this->rights[$r][5] = 'check';
$r++;
$this->rights[$r][0] = 1188;
@ -273,9 +274,9 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
@ -459,7 +460,7 @@ class modFournisseur extends DolibarrModules
's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company',
'f.rowid'=>"invoice", 'f.ref'=>"invoice", 'f.ref_supplier'=>"invoice", 'f.datec'=>"invoice", 'f.datef'=>"invoice", 'f.total_ht'=>"invoice",
'f.total_ttc'=>"invoice", 'f.total_tva'=>"invoice", 'f.paye'=>"invoice", 'f.fk_statut'=>'invoice', 'f.note_public'=>"invoice", 'p.rowid'=>'payment', 'pf.amount'=>'payment',
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project');
$this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Add extra fields object
$sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
@ -508,7 +509,7 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('supplier_invoice').')';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('supplier_invoice').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
// Order
@ -650,6 +651,182 @@ class modFournisseur extends DolibarrModules
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('supplier_order').')';
if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
//Import Supplier Invoice
//--------
$r=0;
$r++;
$this->import_code[$r] = $this->rights_class . '_' . $r;
$this->import_label[$r] = "Supplier Invoice"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['f' => MAIN_DB_PREFIX . 'facture_fourn', 'extra' => MAIN_DB_PREFIX . 'facture_fourn_extrafields'];
$this->import_tables_creator_array[$r] = ['f' => 'fk_user_author']; // Fields to store import user id
$this->import_fields_array[$r] = [
'f.ref' => 'InvoiceRef*',
'f.ref_supplier' => 'RefSupplier',
'f.type' => 'Type*',
'f.fk_soc' => 'Supplier/Vendor*',
'f.datec' => 'InvoiceDateCreation',
'f.datef' => 'DateInvoice',
'f.date_lim_reglement' => 'DateMaxPayment',
'f.total_ht' => 'TotalHT',
'f.total_ttc' => 'TotalTTC',
'f.total_tva' => 'TotalVAT',
'f.paye' => 'InvoicePaid',
'f.fk_statut' => 'InvoiceStatus',
'f.fk_user_modif' => 'Modifier Id',
'f.fk_user_valid' => 'Validator Id',
'f.fk_facture_source' => 'Invoice Source Id',
'f.fk_projet' => 'Project Id',
'f.fk_account' => 'Bank Account*',
'f.note_public' => 'InvoiceNote',
'f.note_private' => 'NotePrivate',
'f.fk_cond_reglement' => 'Payment Condition',
'f.fk_mode_reglement' => 'Payment Mode',
'f.model_pdf' => 'Model',
'f.date_valid' => 'Validation Date'
];
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
$this->import_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
$this->import_fields_array[$r]['f.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, " . $conf->entity . ")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
$import_extrafield_sample[$fieldname] = $fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'facture_fourn'];
$this->import_regex_array[$r] = ['f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'];
$import_sample = [
'f.ref' => '(PROV001)',
'f.ref_supplier' => 'Supplier1',
'f.type' => '0',
'f.fk_soc' => 'Vendor1',
'f.datec' => '2021-01-01',
'f.datef' => '',
'f.date_lim_reglement' => '2021-01-30',
'f.total_ht' => '1000',
'f.total_ttc' => '1000',
'f.total_tva' => '0',
'f.paye' => '0',
'f.fk_statut' => '0',
'f.fk_user_modif' => '',
'f.fk_user_valid' => '',
'f.fk_facture_source' => '',
'f.fk_projet' => '',
'f.fk_account' => 'BANK1',
'f.note_public' => 'Note: ',
'f.note_private' => '',
'f.fk_cond_reglement' => '1',
'f.fk_mode_reglement' => '2',
'f.model_pdf' => 'crab',
'f.date_valid' => '',
'f.multicurrency_code' => 'USD',
'f.multicurrency_tx' => '1',
'f.multicurrency_total_ht' => '1000',
'f.multicurrency_total_tva' => '0',
'f.multicurrency_total_ttc' => '1000'
];
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['f.ref' => 'Ref'];
$this->import_convertvalue_array[$r] = [
//'c.ref'=>array('rule'=>'getrefifauto'),
'f.fk_soc' => ['rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'],
'f.fk_account' => ['rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'],
];
//Import Supplier Invoice Lines
$r++;
$this->import_code[$r] = $this->rights_class.'_'.$r;
$this->import_label[$r] = "Supplier Invoice Lines"; // Translation key
$this->import_icon[$r] = $this->picto;
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r] = ['fd' => MAIN_DB_PREFIX . 'facture_fourn_det', 'extra' => MAIN_DB_PREFIX . 'facture_fourn_det_extrafields'];
$this->import_fields_array[$r] = [
'fd.fk_facture_fourn' => 'InvoiceRef*',
'fd.fk_parent_line' => 'FacParentLine',
'fd.fk_product' => 'IdProduct',
'fd.label' => 'Label',
'fd.description' => 'LineDescription',
'fd.pu_ht' => 'PriceUHT',
'fd.pu_ttc' => 'PriceUTTC',
'fd.qty' => 'LineQty',
'fd.remise_percent' => 'Reduc.',
'fd.vat_src_code' => 'Vat Source Code',
'fd.product_type' => 'TypeOfLineServiceOrProduct',
'fd.tva_tx' => 'LineVATRate',
'fd.total_ht' => 'LineTotalHT',
'fd.tva' => 'LineTotalVAT',
'fd.total_ttc' => 'LineTotalTTC',
'fd.date_start' => 'Start Date',
'fd.date_end' => 'End Date',
'fd.fk_unit' => 'Unit'
];
if (!empty($conf->multicurrency->enabled)) {
$this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency';
$this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate';
$this->import_fields_array[$r]['fd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
$this->import_fields_array[$r]['fd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['fd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
}
// Add extra fields
$import_extrafield_sample = [];
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, " . $conf->entity . ")";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = 'extra.' . $obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
$import_extrafield_sample[$fieldname] = $fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'facture_fourn_det'];
$this->import_regex_array[$r] = ['fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product', 'fd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'];
$import_sample = [
'fd.fk_facture_fourn' => '(PROV001)',
'fd.fk_parent_line' => '',
'fd.fk_product' => '',
'fd.label' => '',
'fd.description' => 'Test Product',
'fd.pu_ht' => '50000',
'fd.pu_ttc' => '50000',
'fd.qty' => '1',
'fd.remise_percent' => '0',
'fd.vat_src_code' => '',
'fd.product_type' => '0',
'fd.tva_tx' => '0',
'fd.total_ht' => '50000',
'fd.tva' => '0',
'fd.total_ttc' => '50000',
'fd.date_start' => '',
'fd.date_end' => '',
'fd.fk_unit' => '',
'fd.multicurrency_code' => 'USD',
'fd.multicurrency_tx' => '0',
'fd.multicurrency_total_ht' => '50000',
'fd.multicurrency_total_tva' => '0',
'fd.multicurrency_total_ttc' => '50000'
];
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['fd.rowid' => 'Row Id', 'fd.fk_facture_fourn' => 'Invoice Id', 'fd.fk_product' => 'Product Id'];
$this->import_convertvalue_array[$r] = [
'fd.fk_facture_fourn' => ['rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'],
];
}

View File

@ -312,20 +312,22 @@ if (! empty($usemargins) && $user->rights->margins->creer)
?>
/* Some js test when we click on button "Add" */
jQuery(document).ready(function() {
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { ?>
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
?>
$("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, "np_marginRate");
});
<?php
}
if (! empty($conf->global->DISPLAY_MARK_RATES)) { ?>
<?php
}
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
?>
$("input[name='np_markRate']:first").blur(function(e) {
return checkFreeLine(e, "np_markRate");
});
<?php
}
?>
<?php
}
?>
});
/* TODO This does not work for number with thousand separator that is , */

View File

@ -11,7 +11,7 @@
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
*
* This program is free software; you can redistribute it and/or modify
@ -82,6 +82,13 @@ class Expedition extends CommonObject
public $socid;
/**
* @var string Customer ref
* @deprecated
* @see $ref_customer
*/
public $ref_client;
/**
* @var string Customer ref
*/

View File

@ -408,7 +408,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -417,7 +417,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '</div>';
}
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -1625,7 +1625,7 @@ if ($action == 'create')
}
// Reopen
if ($object->statut > Fichinter::STATUS_CLOSED)
if ($object->statut >= Fichinter::STATUS_CLOSED)
{
if ($user->rights->ficheinter->creer)
{
@ -1645,7 +1645,7 @@ if ($action == 'create')
}
// create intervention model
if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
print '<div class="inline-block divButAction">';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableIntervention").'</a>';
print '</div>';

View File

@ -782,7 +782,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -215,15 +215,15 @@ if ($object->id > 0)
// Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj == "1") //Localtax1
if ($mysoc->localtax1_assuj == "1") //Localtax1
{
print '<tr><td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>';
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '</tr>';
}
if ($societe->localtax2_assuj == "1") //Localtax2
if ($mysoc->localtax2_assuj == "1") //Localtax2
{
print '<tr><td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>';
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
print '<td>'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
print '</tr>';
}
@ -252,7 +252,24 @@ if ($object->id > 0)
$permission = $user->rights->fournisseur->facture->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$param = '&facid='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
$defaulttpldir = '/core/tpl';
$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach ($dirtpls as $module => $reldir)
{
if (!empty($module)) {
$tpl = dol_buildpath($reldir.'/document_actions_post_headers.tpl.php');
} else {
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/document_actions_post_headers.tpl.php';
}
if (empty($conf->file->strict_mode)) {
$res = @include $tpl;
} else {
$res = include $tpl; // for debug
}
if ($res) break;
}
} else {
print $langs->trans('ErrorUnknown');
}

View File

@ -595,7 +595,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -356,6 +356,8 @@ ALTER TABLE llx_ecm_directories_extrafields ADD INDEX idx_ecm_directories_extraf
ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255);
ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255);
DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS');
-- rename Table
ALTER TABLE llx_livraison RENAME TO llx_delivery;
ALTER TABLE llx_livraison_extrafields RENAME TO llx_delivery_extrafields;
@ -377,4 +379,3 @@ ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_valid;
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid);

View File

@ -20,10 +20,11 @@ CantSuggest=Can't suggest
AccountancySetupDoneFromAccountancyMenu=Most setup of the accountancy is done from the menu %s
ConfigAccountingExpert=Configuration of the module accounting (double entry)
Journalization=Journalization
Journaux=Journals
Journals=Journals
JournalFinancial=Financial journals
BackToChartofaccounts=Return chart of accounts
Chartofaccounts=Chart of accounts
ChartOfSubaccounts=Chart of subaccounts
CurrentDedicatedAccountingAccount=Current dedicated account
AssignDedicatedAccountingAccount=New account to assign
InvoiceLabel=Invoice label
@ -33,8 +34,8 @@ OtherInfo=Other information
DeleteCptCategory=Remove accounting account from group
ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group?
JournalizationInLedgerStatus=Status of journalization
AlreadyInGeneralLedger=Already journalized in ledgers
NotYetInGeneralLedger=Not yet journalized in ledgers
AlreadyInGeneralLedger=Already transferred in accounting journals and ledger
NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
DetailByAccount=Show detail by account
AccountWithNonZeroValues=Accounts with non-zero values
@ -43,7 +44,9 @@ CountriesInEEC=Countries in EEC
CountriesNotInEEC=Countries not in EEC
CountriesInEECExceptMe=Countries in EEC except %s
CountriesExceptMe=All countries except %s
AccountantFiles=Export accounting documents
AccountantFiles=Export source documents
ExportAccountingSourceDocHelp=With this tool, you can export the source events (list and PDFs) that were used to generate your accountancy. To export your journals, use the menu entry %s - %s.
VueByAccountAccounting=View by accounting account
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
MainAccountForSuppliersNotDefined=Main accounting account for vendors not defined in setup
@ -89,8 +92,8 @@ SubledgerAccount=Subledger account
SubledgerAccountLabel=Subledger account label
ShowAccountingAccount=Show accounting account
ShowAccountingJournal=Show accounting journal
ShowAccountingAccountInBookKeeping=Show accounting account in ledger
ShowAccountingAccountInBookKeepingByAccount=Show accounting account in ledger by account
ShowAccountingAccountInLedger=Show accounting account in ledger
ShowAccountingAccountInJournals=Show accounting account in journals
AccountAccountingSuggest=Accounting account suggested
MenuDefaultAccounts=Default accounts
MenuBankAccounts=Bank accounts
@ -208,16 +211,16 @@ ByPredefinedAccountGroups=By predefined groups
ByPersonalizedAccountGroups=By personalized groups
ByYear=By year
NotMatch=Not Set
DeleteMvt=Delete Ledger lines
DeleteMvt=Delete some operation lines from accounting
DelMonth=Month to delete
DelYear=Year to delete
DelJournal=Journal to delete
ConfirmDeleteMvt=This will delete all lines of the Ledger for the year/month and/or from a specific journal (At least one criterion is required). You will have to reuse the feature 'Registration in accounting' to have the deleted record back in the ledger.
ConfirmDeleteMvtPartial=This will delete the transaction from the Ledger (all lines related to same transaction will be deleted)
ConfirmDeleteMvt=This will delete all operation lines of the accounting for the year/month and/or for a specific journal (At least one criterion is required). You will have to reuse the feature '%s' to have the deleted record back in the ledger.
ConfirmDeleteMvtPartial=This will delete the transaction from the accounting (all operation lines related to the same transaction will be deleted)
FinanceJournal=Finance journal
ExpenseReportsJournal=Expense reports journal
DescFinanceJournal=Finance journal including all the types of payments by bank account
DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Ledger.
DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Journals and Ledger.
VATAccountNotDefined=Account for VAT not defined
ThirdpartyAccountNotDefined=Account for third party not defined
ProductAccountNotDefined=Account for product not defined

View File

@ -575,3 +575,4 @@ BILL_SUPPLIER_DELETEInDolibarr=Supplier invoice deleted
UnitPriceXQtyLessDiscount=Unit price x Qty - Discount
CustomersInvoicesArea=Customer billing area
SupplierInvoicesArea=Supplier billing area
FacParentLine=Invoice Line Parent

View File

@ -354,6 +354,7 @@ VATIntraManualCheck=You can also check manually on the European Commission websi
ErrorVATCheckMS_UNAVAILABLE=Check not possible. Check service is not provided by the member state (%s).
NorProspectNorCustomer=Not prospect, nor customer
JuridicalStatus=Legal Entity Type
Workforce=Workforce
Staff=Employees
ProspectLevelShort=Potential
ProspectLevel=Prospect potential

View File

@ -273,3 +273,4 @@ WarningProjectClosed=Project is closed. You must re-open it first.
WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list.
WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into ECM database index table
WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on.
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list

View File

@ -102,6 +102,19 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// You can isolate code for each action in a separate method: this method should be named like the trigger in camelCase.
// For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf)
$methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
$callback = array($this, $methodName);
if (is_callable($callback)){
dol_syslog(
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
);
return call_user_func($callback, $action, $object, $user, $langs, $conf);
};
// Or you can execute some code here
switch ($action) {
// Users
//case 'USER_CREATE':

View File

@ -593,7 +593,7 @@ if ($resql)
// Filter on categories
$moreforfilter = '';
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Categories').': ';

View File

@ -375,7 +375,7 @@ if ($search_all)
$moreforfilter = '';
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);

View File

@ -496,7 +496,7 @@ if ($search_all)
$moreforfilter = '';
// Filter on categories
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);

View File

@ -458,7 +458,7 @@ if ($search_all)
$morehtmlfilter = '';
// Filter on categories
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -1431,14 +1431,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td></tr>';
}
// Type - Size
// Type - Workforce/Staff
print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>'."\n";
$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>';
print '<td>'.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'</td><td class="maxwidthonsmartphone"'.($conf->browser->layout == 'phone' ? ' colspan="3"': '').'>';
print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id);
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -2054,13 +2054,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td>';
print '</tr>';
// Type - Size
// Type - Workforce/Staff
print '<tr><td>'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td>';
if ($conf->browser->layout == 'phone') print '</tr><tr>';
print '<td>'.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print '<td>'.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>';
@ -2450,11 +2450,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '</td>';
print '</tr>';
// Type + Staff
// Type + Workforce/Staff
$arr = $formcompany->typent_array(1);
$object->typent = $arr[$object->typent_code];
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>'.$object->typent.'</td>';
print '<tr><td>'.$langs->trans("Staff").'</td><td>'.$object->effectif.'</td></tr>';
print '<tr><td>'.$langs->trans("Workforce").'</td><td>'.$object->effectif.'</td></tr>';
print '</table>';

View File

@ -161,8 +161,8 @@ class Societe extends CommonObject
'instagram' =>array('type'=>'varchar(255)', 'label'=>'Instagram', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'facebook' =>array('type'=>'varchar(255)', 'label'=>'Facebook', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'twitter' =>array('type'=>'varchar(255)', 'label'=>'Twitter', 'enabled'=>1, 'visible'=>-1, 'position'=>165),*/
'fk_effectif' =>array('type'=>'integer', 'label'=>'Fk effectif', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_typent' =>array('type'=>'integer', 'label'=>'Fk typent', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_effectif' =>array('type'=>'integer', 'label'=>'Workforce', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
'fk_typent' =>array('type'=>'integer', 'label'=>'TypeOfCompany', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_forme_juridique' =>array('type'=>'integer', 'label'=>'JuridicalStatus', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'siren' =>array('type'=>'varchar(128)', 'label'=>'Idprof1', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
@ -173,7 +173,7 @@ class Societe extends CommonObject
'idprof6' =>array('type'=>'varchar(128)', 'label'=>'Idprof6', 'enabled'=>1, 'visible'=>-1, 'position'=>207),
'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcomm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225),
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230),
'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235),

View File

@ -663,7 +663,7 @@ if ($search_all)
$moreforfilter = '';
if (empty($type) || $type == 'c' || $type == 'p')
{
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
@ -674,7 +674,7 @@ if (empty($type) || $type == 'c' || $type == 'p')
}
if (empty($type) || $type == 'f')
{
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -463,7 +463,7 @@ if ($resql)
$moreforfilter .= '</div>';
}
// If the user can view products
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';

View File

@ -865,27 +865,28 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
</div>
<!-- Modal multicurrency box -->
<?php if (!empty($conf->multicurrency->enabled)) { ?>
<div id="ModalCurrency" class="modal">
<div class="modal-content">
<div class="modal-header">
<span class="close" href="#" onclick="document.getElementById('ModalCurrency').style.display = 'none';">&times;</span>
<h3><?php print $langs->trans("SetMultiCurrencyCode");?></h3>
<h3><?php print $langs->trans("SetMultiCurrencyCode"); ?></h3>
</div>
<div class="modal-body">
<?php
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
$sql .= " WHERE entity IN ('".getEntity('multicurrency')."')";
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
print '<button type="button" class="block" onclick="location.href=\'index.php?setcurrency='.$obj->code.'\'">'.$obj->code.'</button>';
}
?>
</div>
</div>
</div>
<?php } ?>
<div class="row1<?php if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) print 'withhead'; ?>">

View File

@ -278,6 +278,10 @@ if ($action == 'history')
$invoice->fetch($placeid);
}
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"]!="") {
$invoice->setMulticurrencyCode($_SESSION["takeposcustomercurrency"]);
}
if (($action == "addline" || $action == "freezone") && $placeid == 0)
{
$invoice->socid = $conf->global->$constforcompanyid;
@ -402,7 +406,11 @@ if ($action == "deleteline") {
$invoice->deleteline($deletelineid);
$invoice->fetch($placeid);
}
if (count($invoice->lines) == 0) $invoice->delete($user);
if (count($invoice->lines) == 0) {
$invoice->delete($user);
header("Location: ".DOL_URL_ROOT."/takepos/invoice.php");
exit;
}
}
if ($action == "delete") {
@ -595,7 +603,7 @@ if ($action == "valid" || $action == "history")
if ($invoice->paye) $sectionwithinvoicelink .= '<span class="amountpaymentcomplete" style="font-size: unset">'.$langs->trans("Paid").'</span>';
else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated');
}
$sectionwithinvoicelink .= '</span>';
$sectionwithinvoicelink .= '</span><br>';
if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) $sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
else $sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
@ -604,7 +612,7 @@ if ($action == "valid" || $action == "history")
} else {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
if ($conf->global->TAKEPOS_GIFT_RECEIPT) {
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.', 1);">'.$langs->trans('GiftReceipt').'</button><br>';
$sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="Print('.$placeid.', 1);">'.$langs->trans('GiftReceipt').'</button>';
}
}
if ($conf->global->TAKEPOS_EMAIL_TEMPLATE_INVOICE > 0)
@ -716,6 +724,7 @@ function Print(id, gift){
function TakeposPrinting(id){
var receipt;
console.log("TakeposPrinting" + id);
$.get("receipt.php?facid="+id, function(data, status){
receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '');
$.ajax({
@ -728,15 +737,12 @@ function TakeposPrinting(id){
function TakeposConnector(id){
console.log("TakeposConnector" + id);
var invoice='<?php
$data = json_encode($invoice);
$data = base64_encode($data);
echo $data;
?>';
$.ajax({
type: "POST",
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print.php',
data: 'invoice='+invoice
$.get("ajax/ajax.php?action=printinvoiceticket&term=<?php echo $_SESSION["takeposterminal"];?>&id="+id, function(data, status){
$.ajax({
type: "POST",
url: '<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php',
data: 'invoice='+data
});
});
}
@ -856,11 +862,14 @@ if (!empty($conf->use_javascript_ajax))
print '<!-- invoice.php place='.(int) $place.' invoice='.$invoice->ref.' mobilepage='.$mobilepage.' $_SESSION["basiclayout"]='.$_SESSION["basiclayout"].' conf->global->TAKEPOS_BAR_RESTAURANT='.$conf->global->TAKEPOS_BAR_RESTAURANT.' -->'."\n";
print '<div class="div-table-responsive-no-min invoice">';
print '<table id="tablelines" class="noborder noshadow postablelines" width="100%">';
if ($mobilepage == "invoice" || $mobilepage == "") {
print '<tr><td colspan="4">'.$sectionwithinvoicelink.'</td></tr>';
}
print '<tr class="liste_titre nodrag nodrop">';
print '<td class="linecoldescription">';
// In phone version only show when it is invoice page
if ($mobilepage == "invoice" || $mobilepage == "") {
print '<input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">'.$sectionwithinvoicelink;
print '<input type="hidden" name="invoiceid" id="invoiceid" value="'.$invoice->id.'">';
}
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
{
@ -893,6 +902,13 @@ if ($_SESSION["basiclayout"] != 1)
// In phone version only show when it is invoice page
if ($mobilepage == "invoice" || $mobilepage == "") {
print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</span>';
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"]!="" && $conf->currency!=$_SESSION["takeposcustomercurrency"]) {
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
$multicurrency = new MultiCurrency($db);
$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ttc*$multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>';
}
print '</td>';
}
print '</td>';
@ -1067,7 +1083,7 @@ if ($placeid > 0)
$htmlforlines .= '</td>';
$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
$htmlforlines .= '<td class="right">';
if (!empty($conf->stock->enabled))
if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire))
{
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
@ -1091,13 +1107,13 @@ if ($placeid > 0)
else $htmlforlines .= $line->qty;
$htmlforlines .= '</td>';
$htmlforlines .= '<td class="right classfortooltip" title="'.$moreinfo.'">';
$htmlforlines .= price($line->total_ttc);
$htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency);
if (!empty($conf->multicurrency->enabled) && $_SESSION["takeposcustomercurrency"]!="" && $conf->currency!=$_SESSION["takeposcustomercurrency"]) {
//Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
$multicurrency = new MultiCurrency($db);
$multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]);
$htmlforlines .= ' ('.price($line->total_ttc*$multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')';
$htmlforlines .= '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($line->total_ttc*$multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>';
}
$htmlforlines .= '</td>';
}

View File

@ -231,18 +231,18 @@ else print "var received=0;";
<div style="position:relative; padding-top: 20px; left:5%; height:150px; width:90%;">
<div class="paymentbordline paymentbordlinetotal">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('TotalTTC'); ?>: </font><span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1) ?></span></span></center>
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('TotalTTC'); ?>: </font><span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code);?></span></span></center>
</div>
<?php if ($remaintopay != $invoice->total_ttc) { ?>
<div class="paymentbordline paymentbordlineremain">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('RemainToPay'); ?>: </font><span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1) ?></span></span></center>
<center><span class="takepospay"><font color="white"><?php echo $langs->trans('RemainToPay'); ?>: </font><span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span></center>
</div>
<?php } ?>
<div class="paymentbordline paymentbordlinereceived">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Received"); ?>: </font><span class="change1 colorred"><?php echo price(0) ?></span><input type="hidden" id="change1" class="change1" value="0"></span></center>
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Received"); ?>: </font><span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change1" class="change1" value="0"></span></center>
</div>
<div class="paymentbordline paymentbordlinechange">
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Change"); ?>: </font><span class="change2 colorwhite"><?php echo price(0) ?></span><input type="hidden" id="change2" class="change2" value="0"></span></center>
<center><span class="takepospay"><font color="white"><?php echo $langs->trans("Change"); ?>: </font><span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change2" class="change2" value="0"></span></center>
</div>
<?php
if (! empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {

View File

@ -1811,8 +1811,8 @@ td.nobordernopadding.widthpictotitle.col-picto {
color: #999;
}
/*
span.widthpictotitle.pictotitle {
/* background: rgba(70, 3, 62, 0.5); */
background: var(--colortexttitlenotab);
opacity: 0.8;
color: #fff !important;
@ -1821,10 +1821,12 @@ span.widthpictotitle.pictotitle {
min-width: 30px;
text-align: center;
}
*/
.pictotitle {
margin-<?php echo $right; ?>: 8px;
/* margin-bottom: 4px; */
}
.pictoobjectwidth {
width: 14px;
}

View File

@ -268,6 +268,13 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
margin: 2px;
border-radius: 3px;
}
.user-back {
background-color: #79633f !important;
color: #FFF !important;
padding: 2px;
margin: 2px;
border-radius: 3px;
}
@ -308,14 +315,14 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
.infobox-action{
color: #b06080 !important;
}
.infobox-propal,
.infobox-facture,
.infobox-commande{
.infobox-propal:not(.pictotitle),
.infobox-facture:not(.pictotitle),
.infobox-commande:not(.pictotitle) {
color: #65955d !important;
}
.infobox-supplier_proposal,
.infobox-invoice_supplier,
.infobox-order_supplier{
.infobox-supplier_proposal:not(.pictotitle),
.infobox-invoice_supplier:not(.pictotitle),
.infobox-order_supplier:not(.pictotitle){
color: #599caf !important;
}
.infobox-contrat, .infobox-ticket{

View File

@ -33,6 +33,13 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO =
margin: 2px;
border-radius: 3px;
}
.user-back {
background-color: #79633f !important;
color: #FFF !important;
padding: 2px;
margin: 2px;
border-radius: 3px;
}
.bg-infobox-project{

View File

@ -701,6 +701,15 @@ class User extends CommonObject
$sql .= " AND ".$wherefordel;
}
// avoid admin can remove his own important rights
if ($this->admin == 1)
{
$sql .= " AND id NOT IN (251, 252, 253, 254, 255, 256)"; // other users rights
$sql .= " AND id NOT IN (341, 342, 343, 344)"; // own rights
$sql .= " AND id NOT IN (351, 352, 353, 354)"; // groups rights
$sql .= " AND id NOT IN (358)"; // user export
}
$result = $this->db->query($sql);
if ($result)
{

View File

@ -482,7 +482,7 @@ $moreforfilter = '';
$moreforfilter.= '</div>';*/
// Filter on categories
if (!empty($conf->categorie->enabled))
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Categories').': ';