Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-05-14 16:35:39 +02:00
commit adcc9e14f6
33 changed files with 508 additions and 220 deletions

View File

@ -680,7 +680,9 @@ if ($mode == 'common' || $mode == 'commonkanban')
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
$versiontrans .= $objMod->getVersion(1);
if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
$versiontrans .= $objMod->getVersion(1);
}
// Define imginfo
$imginfo = "info";

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -582,7 +582,7 @@ if ($object->id > 0)
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
$boxstat .= '<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
if (!empty($conf->propal->enabled))
if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
{
// Box proposals
$tmp = $object->getOutstandingProposals();
@ -600,7 +600,7 @@ if ($object->id > 0)
if ($link) $boxstat .= '</a>';
}
if (!empty($conf->commande->enabled))
if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
{
// Box commandes
$tmp = $object->getOutstandingOrders();
@ -618,7 +618,7 @@ if ($object->id > 0)
if ($link) $boxstat .= '</a>';
}
if (!empty($conf->facture->enabled))
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
{
// Box factures
$tmp = $object->getOutstandingBills();

View File

@ -157,6 +157,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$limit = 10;
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.entity = ".$conf->entity;
$sql .= " ORDER BY m.date_creat DESC";
$sql .= " LIMIT ".$limit;
$result = $db->query($sql);

View File

@ -499,7 +499,7 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'propal', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "SendPropalRef";
$modelmail = "proposal_send";
$modelmail = "propal_send";
$objecttmp = new Propal($db);
$trackid = 'pro'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Pierre-Henry Favre <support@atm-consulting.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.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
@ -37,8 +38,16 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips"));
// Constant to define payment sens
const PAY_DEBIT = 0;
const PAY_CREDIT = 1;
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips", "banks", "loan"));
$date_start = GETPOST('date_start', 'alpha');
$date_startDay = GETPOST('date_startday', 'int');
@ -140,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";
$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 .= " 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).')';
@ -149,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";
$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 .= " 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).')';
@ -158,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";
$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 .= " 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).')';
@ -167,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";
$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 .= " 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).')';
@ -176,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.ref 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";
$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 .= " 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).')';
@ -185,12 +194,28 @@ 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_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
$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 .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
$sql .= " WHERE date_creation between ".$wheretail;
$sql .= " WHERE t.date_ech between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
//$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT;
}
// 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 .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
$sql .= " WHERE datep between ".$wheretail;
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
}
// 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 .= " 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).')';
}
if ($sql) {
$sql .= $db->order($sortfield, $sortorder);
@ -221,6 +246,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->facture->dir_output.'/'.$subdir;
$link = "document.php?modulepart=facture&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "facture";
break;
case "SupplierInvoice":
$tmpinvoicesupplier->fetch($objd->id);
@ -228,18 +254,21 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
$link = "document.php?modulepart=facture_fournisseur&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "facture_fournisseur";
break;
case "ExpenseReport":
$subdir = '';
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->ref);
$upload_dir = $conf->expensereport->dir_output.'/'.$subdir;
$link = "document.php?modulepart=expensereport&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "expensereport";
break;
case "SalaryPayment":
$subdir = '';
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
$upload_dir = $conf->salaries->dir_output.'/'.$subdir;
$link = "document.php?modulepart=salaries&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "salaries";
break;
case "Donation":
$tmpdonation->fetch($objp->id);
@ -247,12 +276,28 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
$upload_dir = $conf->don->dir_output.'/'.$subdir;
$link = "document.php?modulepart=don&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "don";
break;
case "SocialContributions":
$subdir = '';
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
$upload_dir = $conf->tax->dir_output.'/'.$subdir;
$link = "document.php?modulepart=tax&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "tax";
break;
case "VariousPayment":
$subdir = '';
$subdir .= ($subdir ? '/' : '').dol_sanitizeFileName($objd->id);
$upload_dir = $conf->bank->dir_output.'/'.$subdir;
$link = "document.php?modulepart=banque&file=".str_replace('/', '%2F', $subdir).'%2F';
$modulepart = "banque";
break;
case "LoanPayment":
// Loan payment has no linked file
$subdir = '';
$upload_dir = $conf->loan->dir_output.'/'.$subdir;
$link = "";
$modulepart = "";
break;
default:
$subdir = '';
@ -286,6 +331,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$nofile['thirdparty_code'] = $objd->thirdparty_code;
$nofile['country_code'] = $objd->country_code;
$nofile['vatnum'] = $objd->vatnum;
$nofile['sens'] = $objd->sens;
$filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile;
}
@ -304,11 +350,11 @@ if (($action == 'searchfiles' || $action == 'dl')) {
$file['ref'] = ($objd->ref ? $objd->ref : $objd->id);
$file['fk'] = $objd->fk_soc;
$file['item'] = $objd->item;
$file['thirdparty_name'] = $objd->thirdparty_name;
$file['thirdparty_code'] = $objd->thirdparty_code;
$file['country_code'] = $objd->country_code;
$file['vatnum'] = $objd->vatnum;
$file['sens'] = $objd->sens;
// Save record into array (only the first time it is found)
if (empty($filesarray[$file['item'].'_'.$file['id']])) {
@ -319,7 +365,16 @@ if (($action == 'searchfiles' || $action == 'dl')) {
if (empty($filesarray[$file['item'].'_'.$file['id']]['files'])) {
$filesarray[$file['item'].'_'.$file['id']]['files'] = array();
}
$filesarray[$file['item'].'_'.$file['id']]['files'][] = array('link' => $link.$file['name'], 'name'=>$file['name'], 'ref'=>$file['ref'], 'fullname' => $file['fullname'], 'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name']);
$filesarray[$file['item'].'_'.$file['id']]['files'][] = array(
'link' => $link.urlencode($file['name']),
'name'=>$file['name'],
'ref'=>$file['ref'],
'fullname' => $file['fullname'],
'relpath' => '/'.$file['name'],
'relpathnamelang' => $langs->trans($file['item']).'/'.$file['name'],
'modulepart' => $modulepart,
'subdir' => $subdir,
);
//var_dump($file['item'].'_'.$file['id']);
//var_dump($filesarray[$file['item'].'_'.$file['id']]['files']);
}
@ -383,7 +438,8 @@ if ($result && $action == "dl" && !$error)
$log .= ','.$langs->transnoentitiesnoconv("ThirdParty");
$log .= ','.$langs->transnoentitiesnoconv("Code");
$log .= ','.$langs->transnoentitiesnoconv("Country");
$log .= ','.$langs->transnoentitiesnoconv("VATIntra")."\n";
$log .= ','.$langs->transnoentitiesnoconv("VATIntra");
$log .= ','.$langs->transnoentitiesnoconv("Sens")."\n";
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
dol_delete_file($zipname);
@ -394,11 +450,13 @@ if ($result && $action == "dl" && !$error)
{
foreach ($filesarray as $key => $file)
{
foreach ($file['files'] as $filecursor) {
if (file_exists($filecursor["fullname"])) {
$zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]);
}
}
if (!empty($file['files'])) {
foreach ($file['files'] as $filecursor) {
if (file_exists($filecursor["fullname"])) {
$zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]);
}
}
}
$log .= '"'.$langs->trans($file['item']).'"';
if (!empty($conf->multicompany->enabled) && is_object($mc))
@ -418,6 +476,7 @@ if ($result && $action == "dl" && !$error)
$log .= ',"'.$file['thirdparty_code'].'"';
$log .= ',"'.$file['country_code'].'"';
$log .= ',"'.$file['vatnum'].'"';
$log .= ',"'.$file['sens'].'"';
$log .= "\n";
}
$zip->addFromString('transactions.csv', $log);
@ -444,10 +503,17 @@ if ($result && $action == "dl" && !$error)
* View
*/
$form = new Form($db);
$form = new form($db);
$formfile = new FormFile($db);
$userstatic = new User($db);
$invoice = new Facture($db);
$supplier_invoice = new FactureFournisseur($db);
$expensereport = new ExpenseReport($db);
$don = new Don($db);
$salary_payment = new PaymentSalary($db);
$charge_sociales = new ChargeSociales($db);
$various_payment = new PaymentVarious($db);
$payment_loan = new PaymentLoan($db);
$title = $langs->trans("ComptaFiles").' - '.$langs->trans("List");
$help_url = '';
@ -492,7 +558,9 @@ $listofchoices = array(
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
'selectsocialcontributions'=>array('label'=>'SocialContributions')
'selectsocialcontributions'=>array('label'=>'SocialContributions'),
'selectvariouspayment'=>array('label'=>'VariousPayment'),
'selectloanspayment'=>array('label'=>'PaymentLoan'),
);
foreach ($listofchoices as $choice => $val) {
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
@ -562,11 +630,12 @@ if (!empty($date_start) && !empty($date_stop))
{
// Sort array by date ASC to calculate balance
$totalET = 0;
$totalIT = 0;
$totalVAT = 0;
$totalDebit = 0;
$totalCredit = 0;
$totalET_debit = 0;
$totalIT_debit = 0;
$totalVAT_debit = 0;
$totalET_credit = 0;
$totalIT_credit = 0;
$totalVAT_credit = 0;
// Display array
foreach ($TData as $data)
@ -592,25 +661,49 @@ if (!empty($date_start) && !empty($date_stop))
// Ref
print '<td class="nowraponall">';
if ($data['item'] == 'Invoice') {
$invoice->id = $data['id'];
if ($data['item'] == 'Invoice') {
$invoice->id = $data['id'];
$invoice->ref = $data['ref'];
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'SupplierInvoice') {
} elseif ($data['item'] == 'SupplierInvoice') {
$supplier_invoice->id = $data['id'];
$supplier_invoice->ref = $data['ref'];
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} else {
} elseif ($data['item'] == 'ExpenseReport') {
$expensereport->id = $data['id'];
$expensereport->ref = $data['ref'];
print $expensereport->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'SalaryPayment') {
$salary_payment->id = $data['id'];
$salary_payment->ref = $data['ref'];
print $salary_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'Donation') {
$don->id = $data['id'];
$don->ref = $data['ref'];
print $don->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'SocialContributions') {
$charge_sociales->id = $data['id'];
$charge_sociales->ref = $data['ref'];
print $charge_sociales->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'VariousPayment') {
$various_payment->id = $data['id'];
$various_payment->ref = $data['ref'];
print $various_payment->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} elseif ($data['item'] == 'LoanPayment') {
$payment_loan->id = $data['id'];
$payment_loan->ref = $data['ref'];
print $payment_loan->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
} else {
print $data['ref'];
}
}
print '</td>';
// File link
print '<td>';
if (!empty($data['files']))
{
foreach ($data['files'] as $filecursor) {
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a><br>';
foreach ($data['files'] as $id=>$filecursor) {
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a>&nbsp;'.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
}
}
print "</td>\n";
@ -619,11 +712,11 @@ if (!empty($date_start) && !empty($date_stop))
print '<td aling="left">'.$data['paid'].'</td>';
// Total ET
print '<td align="right">'.price($data['amount_ht'])."</td>\n";
print '<td align="right">'.price($data['sens']?$data['amount_ht']:-$data['amount_ht'])."</td>\n";
// Total IT
print '<td align="right">'.price($data['amount_ttc'])."</td>\n";
print '<td align="right">'.price($data['sens']?$data['amount_ttc']:-$data['amount_ttc'])."</td>\n";
// Total VAT
print '<td align="right">'.price($data['amount_vat'])."</td>\n";
print '<td align="right">'.price($data['sens']?$data['amount_vat']:-$data['amount_vat'])."</td>\n";
print '<td>'.$data['thirdparty_name']."</td>\n";
@ -633,42 +726,42 @@ if (!empty($date_start) && !empty($date_stop))
print '<td align="right">'.$data['vatnum']."</td>\n";
// Debit
//print '<td align="right">'.(($data['amount_ttc'] > 0) ? price(abs($data['amount_ttc'])) : '')."</td>\n";
// Credit
//print '<td align="right">'.(($data['amount_ttc'] > 0) ? '' : price(abs($data['amount_ttc'])))."</td>\n";
$totalET += $data['amount_ht'];
$totalIT += $data['amount_ttc'];
$totalVAT += $data['amount_vat'];
$totalDebit += ($data['amount_ttc'] > 0) ? abs($data['amount_ttc']) : 0;
$totalCredit += ($data['amount_ttc'] > 0) ? 0 : abs($data['amount_ttc']);
// Balance
//print '<td align="right">'.price($data['balance'])."</td>\n";
if ($data['sens']) {
$totalET_credit += $data['amount_ht'];
$totalIT_credit += $data['amount_ttc'];
$totalVAT_credit += $data['amount_vat'];
} else {
$totalET_debit -= $data['amount_ht'];
$totalIT_debit -= $data['amount_ttc'];
$totalVAT_debit -= $data['amount_vat'];
}
print "</tr>\n";
}
// Total credits
print '<tr class="liste_total">';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td align="right">'.price(price2num($totalET, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalIT, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT, 'MT')).'</td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
print '<td></td>';
/*print '<td align="right">'.price($totalDebit).'</td>';
print '<td align="right">'.price($totalCredit).'</td>';
print '<td align="right">'.price(price2num($totalDebit - $totalCredit, 'MT')).'</td>';
*/
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Income').'</td>';
print '<td align="right">'.price(price2num($totalET_credit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
print '<td colspan="4"></td>';
print "</tr>\n";
// Total debits
print '<tr class="liste_total">';
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Outcome').'</td>';
print '<td align="right">'.price(price2num($totalET_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
print '<td colspan="4"></td>';
print "</tr>\n";
// Balance
print '<tr class="liste_total">';
print '<td colspan="6" class="right">'.$langs->trans('Total').'</td>';
print '<td align="right">'.price(price2num($totalET_credit+$totalET_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalIT_credit+$totalIT_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_credit+$totalVAT_debit, 'MT')).'</td>';
print '<td colspan="4"></td>';
print "</tr>\n";
}
}

View File

@ -5282,7 +5282,7 @@ elseif ($id > 0 || !empty($ref))
{
if (!$objectidnext)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;fac_avoir='.$object->id.'&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').''.$object->id.'&amp;action=create&amp;type=2'.($object->entity > 0 ? '&amp;originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&amp;fac_avoir='.$object->id.'&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').''.($object->entity > 0 ? '&amp;originentity='.$object->entity : '').'">'.$langs->trans("CreateCreditNote").'</a>';
}
}

View File

@ -140,7 +140,10 @@ class box_accountancy_last_manual_entries extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedManualEntries"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedManualEntries")
);
$this->db->free($result);
} else {

View File

@ -153,7 +153,10 @@ class box_boms extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedOrders")
);
$this->db->free($result);
} else {

View File

@ -148,7 +148,10 @@ class box_clients extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedCustomers")
);
$this->db->free($result);
}

View File

@ -174,7 +174,10 @@ class box_commandes extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedOrders")
);
$this->db->free($result);
} else {

View File

@ -180,7 +180,10 @@ class box_factures_imp extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoUnpaidCustomerBills"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoUnpaidCustomerBills")
);
$this->db->free($result);
}

View File

@ -145,13 +145,16 @@ class box_ficheinter extends ModeleBoxes
$i++;
}
if ($num == 0) $this->info_box_contents[$i][] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedInterventions"));
if ($num == 0) $this->info_box_contents[$i][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedInterventions")
);
$this->db->free($resql);
}
else
{
$this->info_box_contents[0][] = array(
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500,
'text' => ($this->db->error().' sql='.$sql),
@ -160,7 +163,7 @@ class box_ficheinter extends ModeleBoxes
}
else
{
$this->info_box_contents[0][] = array(
$this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"',
'text' => $langs->trans("ReadPermissionNotAllowed")
);

View File

@ -136,7 +136,7 @@ class box_fournisseurs extends ModeleBoxes
}
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);

View File

@ -142,7 +142,10 @@ class box_goodcustomers extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedCustomers")
);
$this->db->free($result);
}

View File

@ -149,7 +149,10 @@ class box_mos extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedOrders"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedOrders")
);
$this->db->free($result);
} else {

View File

@ -149,8 +149,8 @@ class box_prospect extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedProspects"),
'td' => 'class="center opacitymedium"',
'text'=> $langs->trans("NoRecordedProspects"),
);
}

View File

@ -223,7 +223,10 @@ class box_services_contracts extends ModeleBoxes
$i++;
}
if ($num == 0) $this->info_box_contents[$i][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoContractedProducts"));
if ($num == 0) $this->info_box_contents[$i][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoContractedProducts")
);
$this->db->free($result);
}

View File

@ -158,7 +158,10 @@ class box_shipments extends ModeleBoxes
$line++;
}
if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedShipments"));
if ($num == 0) $this->info_box_contents[$line][0] = array(
'td' => 'class="center opacitymedium"',
'text'=>$langs->trans("NoRecordedShipments")
);
$this->db->free($result);
} else {

View File

@ -2842,7 +2842,7 @@ class Form
}
if (!empty($conf->barcode->enabled)) $sql .= ", pfp.barcode";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
if ($socid) $sql .= " AND pfp.fk_soc = ".$socid;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
// Units

View File

@ -328,48 +328,59 @@ class Interfaces
continue;
}
$objMod = new $modName($db);
try {
$objMod = new $modName($db);
// Define disabledbyname and disabledbymodule
$disabledbyname = 0;
$disabledbymodule = 1;
$module = '';
if (is_subclass_of($objMod, 'DolibarrTriggers'))
{
// Define disabledbyname and disabledbymodule
$disabledbyname = 0;
$disabledbymodule = 1;
$module = '';
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1;
// Check if trigger file is for a particular module
if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg))
{
$module = preg_replace('/^mod/i', '', $reg[2]);
$constparam = 'MAIN_MODULE_'.strtoupper($module);
if (strtolower($module) == 'all') $disabledbymodule = 0;
elseif (empty($conf->global->$constparam)) $disabledbymodule = 2;
$triggers[$j]['module'] = strtolower($module);
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i', $files[$key])) $disabledbyname = 1;
// Check if trigger file is for a particular module
if (preg_match('/^interface_([0-9]+)_([^_]+)_(.+)\.class\.php/i', $files[$key], $reg))
{
$module = preg_replace('/^mod/i', '', $reg[2]);
$constparam = 'MAIN_MODULE_'.strtoupper($module);
if (strtolower($module) == 'all') $disabledbymodule = 0;
elseif (empty($conf->global->$constparam)) $disabledbymodule = 2;
$triggers[$j]['module'] = strtolower($module);
}
// We set info of modules
$triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "');
$triggers[$j]['file'] = $files[$key];
$triggers[$j]['fullpath'] = $fullpath[$key];
$triggers[$j]['relpath'] = $relpath[$key];
$triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key];
$triggers[$j]['version'] = $objMod->getVersion();
$triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick');
if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = '';
$text = '<b>'.$langs->trans("Description").':</b><br>';
$text .= $objMod->getDesc().'<br>';
$text .= '<br><b>'.$langs->trans("Status").':</b><br>';
if ($disabledbyname == 1)
{
$text .= $langs->trans("TriggerDisabledByName").'<br>';
if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>';
}
else
{
if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'<br>';
if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'<br>';
if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>';
}
}
else {
print 'Error: Trigger '.$modName.' does not extends DolibarrTriggers<br>';
}
}
// We set info of modules
$triggers[$j]['picto'] = $objMod->picto ?img_object('', $objMod->picto, 'class="valignmiddle pictomodule "') : img_object('', 'generic', 'class="valignmiddle pictomodule "');
$triggers[$j]['file'] = $files[$key];
$triggers[$j]['fullpath'] = $fullpath[$key];
$triggers[$j]['relpath'] = $relpath[$key];
$triggers[$j]['iscoreorexternal'] = $iscoreorexternal[$key];
$triggers[$j]['version'] = $objMod->getVersion();
$triggers[$j]['status'] = img_picto($langs->trans("Active"), 'tick');
if ($disabledbyname > 0 || $disabledbymodule > 1) $triggers[$j]['status'] = '';
$text = '<b>'.$langs->trans("Description").':</b><br>';
$text .= $objMod->getDesc().'<br>';
$text .= '<br><b>'.$langs->trans("Status").':</b><br>';
if ($disabledbyname == 1)
{
$text .= $langs->trans("TriggerDisabledByName").'<br>';
if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>';
}
else
{
if ($disabledbymodule == 0) $text .= $langs->trans("TriggerAlwaysActive").'<br>';
if ($disabledbymodule == 1) $text .= $langs->trans("TriggerActiveAsModuleActive", $module).'<br>';
if ($disabledbymodule == 2) $text .= $langs->trans("TriggerDisabledAsModuleDisabled", $module).'<br>';
catch(Exception $e) {
print $e->getMessage();
}
$triggers[$j]['info'] = $text;

View File

@ -912,7 +912,7 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0,
$nbOpenDay=$lastday;
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
if ($inhour == 1) $nbOpenDay = ($nbOpenDay * 24);
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
}
else

View File

@ -2295,9 +2295,17 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
{
print img_object($alttext, 'generic', 'class="inline-block valignmiddle"');
}
print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>';
$version = $this->getVersion(0);
$versiontrans = '';
if (preg_match('/development/i', $version)) $versiontrans .= 'warning';
if (preg_match('/experimental/i', $version)) $versiontrans .= 'warning';
if (preg_match('/deprecated/i', $version)) $versiontrans .= 'warning';
if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
print '<span class="info-box-icon-version'.($versiontrans? ' '.$versiontrans : '').'" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';
print $this->getVersion(1);
print '</span>';
}
/*print '<span class="info-box-icon-action">';
print '<div class="valignmiddle inline-block">';
@ -2313,7 +2321,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
print '</div>
<div class="info-box-content info-box-text-module">
<span class="info-box-title">'.$this->getName().'</span>
<span class="info-box-title marginbottomonly">'.$this->getName().'</span>
<span class="info-box-desc twolinesmax opacitymedium" title="'.dol_escape_htmltag($this->getDesc()).'">'.nl2br($this->getDesc()).'</span>';
/*print '<span class="info-box-icon-version" title="'.$langs->trans("Version").' '.$this->getVersion(1).'">';

View File

@ -46,7 +46,7 @@ $text = $langs->trans("Tools");
print load_fiche_titre($text, '', 'wrench');
// Show description of content
print '<div class="justify">'.$langs->trans("ToolsDesc").'</div><br><br>';
print '<div class="justify opacitymedium">'.$langs->trans("ToolsDesc").'</div><br><br>';
// Show logo

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
/**
* Class of triggers for stripe module
*/
class InterfaceStripe
class InterfaceStripe extends DolibarrTriggers
{
/**
* @var DoliDB Database handler.

View File

@ -53,7 +53,7 @@ div.titre {
}
span.titre {
font-weight: bold;
/* font-weight: bold; */
background: #FFFFFF;
color: rgb(0,113,121);
border: 1px solid #bbb;

View File

@ -384,10 +384,10 @@ if ($action == "set" && $success)
print "<br>";
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
print $langs->trans("GoToSetupArea");
print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
print '</a></div>';
}
else
@ -399,7 +399,7 @@ if ($action == "set" && $success)
print "<br>";
print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
print $langs->trans("GoToUpgradePage");
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
print '</a></div>';
}
}
@ -435,7 +435,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action))
print "<br><br>";
print '<div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">';
print $langs->trans("GoToDolibarr").'...';
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToDolibarr").'...';
print '</a></div><br>';
}
else
@ -447,7 +447,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action))
print "<br>";
print '<div class="center"><a href="../install/index.php">';
print $langs->trans("GoToUpgradePage");
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
print '</a></div>';
}
}

View File

@ -2026,7 +2026,7 @@ function top_menu_search()
$defaultAction = '';
$buttonList = '<div class="dropdown-global-search-button-list" >';
// Menu with all bookmarks
// Menu with all searchable items
foreach ($arrayresult as $keyItem => $item)
{
if (empty($defaultAction)) {
@ -2041,9 +2041,7 @@ function top_menu_search()
$searchInput = '<input name="sall" id="top-global-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Search').'" autocomplete="off" >';
$dropDownHtml = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
$dropDownHtml .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="'.$defaultAction.'" >';
$dropDownHtml = '<form id="top-menu-action-search" name="actionsearch" method="GET" action="'.$defaultAction.'" >';
$dropDownHtml .= '
<!-- search input -->
@ -2092,8 +2090,8 @@ function top_menu_search()
// submit form action
$(".dropdown-global-search-button-list .global-search-item").on("click", function(event) {
$("#top-menu-action-bookmark").attr("action", $(this).data("target"));
$("#top-menu-action-bookmark").submit();
$("#top-menu-action-search").attr("action", $(this).data("target"));
$("#top-menu-action-search").submit();
});
// close drop down

View File

@ -79,3 +79,31 @@ button.phonebutton {
height:90%;
font-weight: bold;
}
button.publicphonebutton {
display: inline-block;
position: relative;
padding: 0;
line-height: normal;
cursor: pointer;
vertical-align: middle;
text-align: center;
overflow: visible; /* removes extra width in IE */
width:33%;
height:90%;
font-weight: bold;
}
button.publicphonebutton2 {
display: inline-block;
position: relative;
padding: 0;
line-height: normal;
cursor: pointer;
vertical-align: middle;
text-align: center;
overflow: visible; /* removes extra width in IE */
width:33%;
font-weight: bold;
padding: 8px 16px;
}

View File

@ -29,5 +29,8 @@ require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php';
$key = GETPOST('key');
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$module = new modTcpdfbarcode();
$result = $module->buildBarCode("http://www.takepos.com", 'QRCODE', 'Y');
$result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".dol_encode($key), 'QRCODE', 'Y');

View File

@ -32,7 +32,7 @@ if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); }
if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); }
if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); }
require '../main.inc.php';
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@ -47,16 +47,11 @@ $idproduct = GETPOST('idproduct', 'int');
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant
$placeid = 0; // $placeid is ID of invoice
if ($_SESSION["publicterminal"]) {
$_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers
}
elseif (empty($user->rights->takepos->run)) {
if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
accessforbidden();
}
if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || $_SESSION["publicterminal"])
if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))
{
// DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED
if ($_SESSION["takeposterminal"] == "")
@ -629,6 +624,12 @@ $(document).ready(function() {
if (selectedline==this.id) return; // If is already selected
else selectedline=this.id;
selectedtext=$('#'+selectedline).find("td:first").html();
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
print '$("#phonediv1").load("auto_order.php?action=editline&placeid="+placeid+"&selectedline="+selectedline, function() {
});';
}
?>
});
/* Autoselect the line */
@ -913,7 +914,7 @@ if ($_SESSION["basiclayout"] == 1)
$htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">';
$htmlforlines .= '<td class="left">';
$htmlforlines .= $row->label;
$htmlforlines .= '</td>';
$htmlforlines .= '<div class="right">'.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'</div>';
$htmlforlines .= '</tr>'."\n";
}
$htmlforlines .= '</table>';
@ -990,6 +991,7 @@ if ($placeid > 0)
}
$htmlforlines .= '" id="'.$line->id.'">';
$htmlforlines .= '<td class="left">';
if ($_SESSION["basiclayout"] == 1) $htmlforlines .= $line->qty." x ";
//if ($line->product_label) $htmlforlines.= '<b>'.$line->product_label.'</b>';
if (isset($line->product_type))
{

View File

@ -45,6 +45,7 @@ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant
$action = GETPOST('action', 'alpha');
$setterminal = GETPOST('setterminal', 'int');
$idproduct = GETPOST('idproduct', 'int');
if ($setterminal > 0)
{
@ -53,14 +54,10 @@ if ($setterminal > 0)
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
$_SESSION["takeposterminal"] = 1; // Use Terminal 1 for public customers
}
elseif (empty($user->rights->takepos->run)) {
if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
accessforbidden();
}
/*
* View
*/
@ -74,48 +71,82 @@ $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>';
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
?>
<link rel="stylesheet" href="css/phone.css">
<script language="javascript">
<?php
$categorie = new Categorie($db);
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/takepos/css/phone.css">';
// Search root category to know its level
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
$levelofrootcategory = 0;
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
{
foreach ($categories as $key => $categorycursor)
if ($action=="productinfo"){
$prod = new Product($db);
$prod->fetch($idproduct);
print "<b>".$prod->label."</b><br>";
print '<img class="imgwrapper" width="60%" src="'.DOL_URL_ROOT.'/takepos/genimg/index.php?query=pro&id='.$idproduct.'">';
print "<br>".$prod->description;
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
print '<br>';
print '<button type="button" class="publicphonebutton2" onclick="AddProductConfirm(place, '.$idproduct.');">'.$langs->trans('Add').'</button>';
}
elseif ($action=="editline"){
$placeid = GETPOST('placeid', 'int');
$selectedline = GETPOST('selectedline', 'int');
$invoice = new Facture($db);
$invoice->fetch($placeid);
foreach ($invoice->lines as $line)
{
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
{
$levelofrootcategory = $categorycursor['level'];
break;
if ($line->id == $selectedline)
{
$prod = new Product($db);
$prod->fetch($line->fk_product);
print "<b>".$prod->label."</b><br>";
print '<img class="imgwrapper" width="60%" src="genimg/index.php?query=pro&id='.$line->fk_product.'">';
print "<br>".$prod->description;
print "<br><b>".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency)."</b>";
print '<br>';
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty-1).');">-</button>';
print '<button type="button" class="publicphonebutton2" onclick="SetQty(place, '.$selectedline.', '.($line->qty+1).');">+</button>';
print '<button type="button" class="publicphonebutton2" onclick="SetNote(place, '.$selectedline.');">'.$langs->trans('Note').'</button>';
}
}
}
$levelofmaincategories = $levelofrootcategory + 1;
else {
?>
<script language="javascript">
<?php
$categorie = new Categorie($db);
$categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
$maincategories = array();
$subcategories = array();
foreach ($categories as $key => $categorycursor)
{
if ($categorycursor['level'] == $levelofmaincategories)
{
$maincategories[$key] = $categorycursor;
}
else
{
$subcategories[$key] = $categorycursor;
}
}
// Search root category to know its level
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
$levelofrootcategory = 0;
if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
{
foreach ($categories as $key => $categorycursor)
{
if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID)
{
$levelofrootcategory = $categorycursor['level'];
break;
}
}
}
$levelofmaincategories = $levelofrootcategory + 1;
sort($maincategories);
sort($subcategories);
$maincategories = array();
$subcategories = array();
foreach ($categories as $key => $categorycursor)
{
if ($categorycursor['level'] == $levelofmaincategories)
{
$maincategories[$key] = $categorycursor;
}
else
{
$subcategories[$key] = $categorycursor;
}
}
sort($maincategories);
sort($subcategories);
?>
?>
var categories = <?php echo json_encode($maincategories); ?>;
var subcategories = <?php echo json_encode($subcategories); ?>;
@ -131,33 +162,96 @@ var editnumber="";
$( document ).ready(function() {
console.log("Refresh");
$("#phonediv1").load("invoice.php?mobilepage=places", function() {
});
$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
});
LoadPlace(place);
});
function LoadPlace(placeid){
place=placeid;
$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
});
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&place="+place, function() {
});';
}
else{
echo '$("#phonediv2").load("invoice.php?mobilepage=invoice&place="+place, function() {
});';
}
?>
LoadCats();
}
function AddProduct(placeid, productid){
place=placeid;
$("#phonediv2").load("invoice.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
<?php
// If is a public terminal first show product information
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
print 'place=placeid;
$("#phonediv1").load("auto_order.php?action=productinfo&place="+place+"&idproduct="+productid, function() {
});';
}
else{
print 'AddProductConfirm(placeid, productid);';
}
?>
}
function AddProductConfirm(placeid, productid){
place=placeid;
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
echo '$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
});';
}
else{
echo '$("#phonediv2").load("invoice.php?mobilepage=invoice&action=addline&place="+place+"&idproduct="+productid, function() {
});';
}
?>
}
function SetQty(place, selectedline, qty){
if (qty==0){
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() {
});
}
else{
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
});
}
LoadCats();
}
function SetNote(place, selectedline){
var note = prompt("<?php $langs->trans('Note'); ?>", "Harry Potter");
$("#phonediv2").load("auto_order.php?mobilepage=invoice&action=updateqty&place="+place+"&idline="+selectedline+"&number="+qty, function() {
});
LoadCats();
}
function LoadCats(){
$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
});
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
echo '$("#phonediv1").load("auto_order.php?mobilepage=cats&place="+place, function() {
});';
}
else{
echo '$("#phonediv1").load("invoice.php?mobilepage=cats&place="+place, function() {
});';
}
?>
}
function LoadProducts(idcat){
$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
});
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
echo '$("#phonediv1").load("auto_order.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
});';
}
else{
echo '$("#phonediv1").load("invoice.php?mobilepage=products&catid="+idcat+"&place="+place, function() {
});';
}
?>
}
function LoadPlacesList(){
@ -167,8 +261,16 @@ function LoadPlacesList(){
function TakeposPrintingOrder(){
console.log("TakeposPrintingOrder");
$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
});
<?php
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
echo '$("#phonediv2").load("auto_order.php?action=order&place="+place, function() {
});';
}
else{
echo '$("#phonediv2").load("invoice.php?action=order&place="+place, function() {
});';
}
?>
}
function Exit(){
@ -186,17 +288,23 @@ function CheckPlease(){
</script>
<body style="overflow: hidden; background-color:#D1D1D1;">
<?php
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
?>
<?php
if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"] == "") print '<div class="dialog-info-takepos-terminal" id="dialog-info" title="TakePOS">'.$langs->trans('TerminalSelect').'</div>';
?>
<div class="container">
<div class="phonebuttonsrow">
<?php
if (!$_SESSION["publicterminal"]) print '<button type="button" class="phonebutton" onclick="LoadPlacesList();">'.strtoupper(substr($langs->trans('Floors'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
if ($_SESSION["publicterminal"]) print '<button type="button" class="phonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 3)).'</button>';
if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')){
print '<button type="button" class="phonebutton" onclick="LoadPlacesList();">'.strtoupper(substr($langs->trans('Floors'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 3)).'</button>';
print '<button type="button" class="phonebutton" onclick="Exit();">'.strtoupper(substr($langs->trans('Logout'), 0, 3)).'</button>';
}
else{
print '<button type="button" class="publicphonebutton" onclick="LoadCats();">'.strtoupper(substr($langs->trans('Categories'), 0, 5)).'</button>';
print '<button type="button" class="publicphonebutton" onclick="TakeposPrintingOrder();">'.strtoupper(substr($langs->trans('Order'), 0, 5)).'</button>';
print '<button type="button" class="publicphonebutton" onclick="CheckPlease();">'.strtoupper(substr($langs->trans('Payment'), 0, 5)).'</button>';
}
?>
</div>
<div class="row1">
@ -207,7 +315,8 @@ if ($conf->global->TAKEPOS_NUM_TERMINALS != "1" && $_SESSION["takeposterminal"]
</div>
</div>
</body>
<?php
<?php
}
llxFooter();

View File

@ -26,8 +26,11 @@ if (!defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defin
require '../../main.inc.php';
if (!$conf->global->TAKEPOS_AUTO_ORDER) accessforbidden(); // If Auto Order is disabled never allow NO LOGIN access
$_SESSION["basiclayout"] = 1;
$_SESSION["publicterminal"] = true; // Is a public customer
$_SESSION["takeposterminal"] = 1;
define('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE', 1);
include '../phone.php';
if (GETPOSTISSET("mobilepage")) require '../invoice.php';
else require '../phone.php';

View File

@ -8,7 +8,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
*/
.info-box-module-external span.info-box-icon-version {
background: #999;
background: #bbb;
}
.info-box {
@ -74,7 +74,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
height: 80px;
width: 80px;
font-size: 25px;
line-height: 80px;
line-height: 100px;
}
.info-box-module .info-box-icon {
height: 106px;