Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
develop_dict
This commit is contained in:
commit
fa247ffd98
12
ChangeLog
12
ChangeLog
@ -31,10 +31,17 @@ Following changes may create regression for some external modules, but were nece
|
||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||
hook specifications so you must return output into "resprint".
|
||||
|
||||
|
||||
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
|
||||
FIX: #6880
|
||||
FIX: #6925
|
||||
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
|
||||
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
|
||||
FIX: #6880 #6925
|
||||
FIX: #6885
|
||||
FIX: #6926
|
||||
FIX: #7003
|
||||
FIX: #7012
|
||||
FIX: #7040
|
||||
FIX: #7048 #6075
|
||||
FIX: Can set supplier invoice to billed.
|
||||
FIX: Can't create invoice if PO disapproved
|
||||
FIX: contratligne update
|
||||
@ -46,6 +53,7 @@ FIX: Redirect to payment page from member subscription page failed if a unique s
|
||||
FIX: REST api to get project when user has permission to read all.
|
||||
FIX: situation_progress param default value must be 100 and not 0
|
||||
FIX: SQL injection on user/index.php parameter search_statut.
|
||||
FIX: vat code not saved during product creation.
|
||||
FIX: Warnings
|
||||
|
||||
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
// during install process to be used.
|
||||
//
|
||||
//
|
||||
$force_install_noedit=2;
|
||||
$force_install_noedit=2; // 1=To block vars specific to distrib, 2 to block all technical parameters
|
||||
$force_install_message='KeepDefaultValuesWamp';
|
||||
$force_install_main_data_root='WAMPROOT/dolibarr_documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmfedora';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmgeneric';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmmandriva';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$force_install_packager='rpmopensuse';
|
||||
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
|
||||
$force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/var/lib/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
|
||||
@ -68,7 +68,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -1148,7 +1148,6 @@ else
|
||||
* Show list of dictionary to show
|
||||
*/
|
||||
|
||||
$var=true;
|
||||
$lastlineisempty=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -74,7 +74,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \file htdocs/accountancy/admin/defaultaccounts.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
@ -53,10 +53,10 @@ $action = GETPOST('action', 'alpha');
|
||||
$list_account_main = array (
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array (
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
||||
|
||||
@ -51,8 +51,8 @@ $action = GETPOST('action', 'alpha');
|
||||
$list = array (
|
||||
'ACCOUNTING_LENGTH_GACCOUNT',
|
||||
'ACCOUNTING_LENGTH_AACCOUNT' ,
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
||||
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
||||
);
|
||||
|
||||
|
||||
@ -65,28 +65,28 @@ $accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPE
|
||||
|
||||
if ($action == 'update') {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$accounting_modes = array (
|
||||
'RECETTES-DEPENSES',
|
||||
'CREANCES-DETTES'
|
||||
'CREANCES-DETTES'
|
||||
);
|
||||
|
||||
|
||||
$accounting_mode = GETPOST('accounting_mode', 'alpha');
|
||||
|
||||
|
||||
if (in_array($accounting_mode, $accounting_modes)) {
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
|
||||
|
||||
if ($error) {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
|
||||
foreach ($list as $constname)
|
||||
foreach ($list as $constname)
|
||||
{
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
@ -267,10 +267,10 @@ if (! empty($user->admin))
|
||||
|
||||
|
||||
// Param a user $user->rights->accountancy->chartofaccount can access
|
||||
foreach ($list as $key)
|
||||
foreach ($list as $key)
|
||||
{
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue;
|
||||
|
||||
// Param
|
||||
@ -280,7 +280,7 @@ foreach ($list as $key)
|
||||
print '<td align="right">';
|
||||
print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -111,16 +111,16 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$accounting_product_modes = array (
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_BUY'
|
||||
'ACCOUNTANCY_BUY'
|
||||
);
|
||||
|
||||
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
@ -128,26 +128,26 @@ if ($action == 'update') {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! empty($btn_changeaccount)) {
|
||||
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (! empty($chk_prod)) {
|
||||
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
|
||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||
|
||||
|
||||
$cpt = 0; $ok = 0; $ko = 0;
|
||||
foreach ( $chk_prod as $productid ) {
|
||||
|
||||
|
||||
$accounting_account_id = GETPOST('codeventil_' . $productid);
|
||||
|
||||
|
||||
$result = $accounting->fetch($accounting_account_id, null, 1);
|
||||
if ($result < 0) {
|
||||
// setEventMessages(null, $accounting->errors, 'errors');
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
} else {
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = " . $accounting->account_number;
|
||||
@ -156,7 +156,7 @@ if ($action == 'update') {
|
||||
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $productid;
|
||||
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$ok++;
|
||||
@ -166,7 +166,7 @@ if ($action == 'update') {
|
||||
//$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
@ -258,11 +258,11 @@ $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@ -271,7 +271,7 @@ if ($result)
|
||||
if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc);
|
||||
if ($search_current_account > 0) $param.="&search_current_account=".urlencode($search_current_account);
|
||||
if ($search_current_account_valid && $search_current_account_valid != '-1') $param.="&search_current_account_valid=".urlencode($search_current_account_valid);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -280,14 +280,14 @@ if ($result)
|
||||
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 load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
print '<br>';
|
||||
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Select mode
|
||||
|
||||
// Select mode
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
@ -298,20 +298,20 @@ if ($result)
|
||||
print '<tr ' . $bc[true] . '><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@ -334,7 +334,7 @@ if ($result)
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
@ -350,9 +350,9 @@ if ($result)
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"');
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
while ($i < min($num,$limit))
|
||||
@ -367,7 +367,7 @@ if ($result)
|
||||
$product_static->description = $obj->description;
|
||||
$product_static->status = $obj->tosell;
|
||||
$product_static->status_buy = $obj->tobuy;
|
||||
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
@ -375,7 +375,7 @@ if ($result)
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
@ -383,41 +383,41 @@ if ($result)
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
print '<td>';
|
||||
print $product_static->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="left">'.$obj->label.'</td>';
|
||||
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC))
|
||||
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC))
|
||||
{
|
||||
// TODO ADJUST DESCRIPTION SIZE
|
||||
// print '<td align="left">' . $obj->description . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64;
|
||||
$trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td align="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
||||
|
||||
|
||||
print '<td align="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
||||
|
||||
|
||||
// Current accounting account
|
||||
print '<td align="left">';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print length_accountg($obj->accountancy_code_buy);
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Dedicated account
|
||||
$defaultvalue='';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
@ -440,7 +440,7 @@ if ($result)
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
// Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
@ -448,7 +448,7 @@ if ($result)
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Example : Adding jquery code
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@ -461,7 +461,7 @@ if ($result)
|
||||
/* console.log( index + ": " + $( this ).text() ); */
|
||||
if ($(this).is(\':checked\')) atleastoneselected++;
|
||||
});
|
||||
|
||||
|
||||
if (atleastoneselected) jQuery("#changeaccount").removeAttr(\'disabled\');
|
||||
else jQuery("#changeaccount").attr(\'disabled\',\'disabled\');
|
||||
if (atleastoneselected) jQuery("#changeaccount").attr(\'class\',\'butAction\');
|
||||
@ -474,12 +474,12 @@ if ($result)
|
||||
init_savebutton();
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br><div align="center"><input type="submit" class="butAction" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
@ -37,7 +37,7 @@ $id = GETPOST('id', 'int');
|
||||
if ($user->societe_id > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
$action = GETPOST('action');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$mode = GETPOST('mode');
|
||||
$piece_num = GETPOST("piece_num");
|
||||
|
||||
@ -500,8 +500,7 @@ if ($action == 'create') {
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ( $book->linesmvt as $line ) {
|
||||
$var = ! $var;
|
||||
print '<tr' . $bc[$var] . '>';
|
||||
print '<tr class="oddeven">';
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
|
||||
@ -438,7 +438,6 @@ $total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
foreach ($object->lines as $line ) {
|
||||
$var = ! $var;
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
@ -429,4 +429,158 @@ class AccountancyCategory
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function getCats() {
|
||||
global $db, $langs, $user, $mysoc;
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id)) {
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
|
||||
$sql .= " WHERE c.active = 1 ";
|
||||
$sql .= " AND c.fk_country = " . $mysoc->country_id;
|
||||
$sql .= " ORDER BY c.position ASC";
|
||||
} else {
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
|
||||
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
|
||||
$sql .= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array ();
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$data[] = array (
|
||||
'rowid' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'position' => $obj->position,
|
||||
'label' => $obj->label,
|
||||
'formula' => $obj->formula,
|
||||
'category_type' => $obj->category_type
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
$this->errors[] = $this->error;
|
||||
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// calcule
|
||||
|
||||
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
|
||||
|
||||
const PARENTHESIS_DEPTH = 10;
|
||||
|
||||
public function calculate($input){
|
||||
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
|
||||
// Remove white spaces and invalid math chars
|
||||
$input = str_replace(',', '.', $input);
|
||||
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
|
||||
|
||||
// Calculate each of the parenthesis from the top
|
||||
$i = 0;
|
||||
while(strpos($input, '(') || strpos($input, ')')){
|
||||
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
|
||||
|
||||
$i++;
|
||||
if($i > self::PARENTHESIS_DEPTH){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the result
|
||||
if(preg_match(self::PATTERN, $input, $match)){
|
||||
return $this->compute($match[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
private function compute($input){
|
||||
$compute = create_function('', 'return '.$input.';');
|
||||
|
||||
return 0 + $compute();
|
||||
}
|
||||
|
||||
private function callback($input){
|
||||
if(is_numeric($input[1])){
|
||||
return $input[1];
|
||||
}
|
||||
elseif(preg_match(self::PATTERN, $input[1], $match)){
|
||||
return $this->compute($match[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get cpts of category
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCptsCat($cat_id) {
|
||||
global $mysoc;
|
||||
$sql = "";
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
|
||||
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit();
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
|
||||
$sql .= " ORDER BY t.account_number ";
|
||||
|
||||
//echo $sql;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array ();
|
||||
if ($num) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
$name_cat = $obj->name_cat;
|
||||
$data[] = array (
|
||||
'id' => $obj->rowid,
|
||||
'account_number' => $obj->account_number,
|
||||
'name_cpt' => $obj->name_cpt,
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ", montant";
|
||||
$sql .= ", sens";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", import_key";
|
||||
$sql .= ", date_creation";
|
||||
$sql .= ", code_journal";
|
||||
$sql .= ", journal_label";
|
||||
$sql .= ", piece_num";
|
||||
@ -430,6 +430,11 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->debit)) $this->debit = 0;
|
||||
if (empty($this->credit)) $this->credit = 0;
|
||||
|
||||
$now = dol_now();
|
||||
if (empty($this->date_create)) {
|
||||
$this->date_create = $now;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
@ -451,7 +456,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= 'montant,';
|
||||
$sql .= 'sens,';
|
||||
$sql .= 'fk_user_author,';
|
||||
$sql .= 'import_key,';
|
||||
$sql .= 'date_creation,';
|
||||
$sql .= 'code_journal,';
|
||||
$sql .= 'journal_label,';
|
||||
$sql .= 'piece_num,';
|
||||
@ -473,7 +478,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||
$sql .= ' ' . $user->id . ',';
|
||||
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
|
||||
$sql .= ' ' . "'" . $this->db->idate($this->date_create) . "',";
|
||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@ -40,7 +40,7 @@ $langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
@ -187,7 +187,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -203,10 +203,6 @@ $buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' .
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
|
||||
$var = true;
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -269,14 +265,14 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
@ -296,22 +292,22 @@ $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
@ -319,101 +315,101 @@ print "</table>\n";
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ if ($result) {
|
||||
if ($search_tvaintra)
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -249,7 +249,7 @@ if ($result) {
|
||||
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_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print $langs->trans("DescVentilDoneCustomer") . '<br>';
|
||||
|
||||
@ -317,7 +317,7 @@ if ($result) {
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
@ -327,7 +327,7 @@ if ($result) {
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
@ -355,7 +355,7 @@ if ($result) {
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->lasterror();
|
||||
|
||||
@ -144,10 +144,10 @@ if ($massaction == 'ventil') {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
$accountventilated = new AccountingAccount($db);
|
||||
$accountventilated->fetch($monCompte, '');
|
||||
|
||||
|
||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
@ -157,7 +157,7 @@ if ($massaction == 'ventil') {
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
@ -375,10 +375,10 @@ if ($result) {
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->total_ht);
|
||||
print '</td>';
|
||||
@ -404,7 +404,7 @@ if ($result) {
|
||||
print '<td align="center">';
|
||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
|
||||
@ -178,9 +178,6 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -94,13 +94,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent');
|
||||
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
|
||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -193,7 +193,7 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@ -210,8 +210,8 @@ if ($result) {
|
||||
if ($search_country)
|
||||
$param .= "&search_country=" . $search_country;
|
||||
if ($search_tvaintra)
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -220,7 +220,7 @@ if ($result) {
|
||||
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_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
print $langs->trans("DescVentilDoneExpenseReport") . '<br>';
|
||||
@ -273,7 +273,7 @@ if ($result) {
|
||||
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
@ -282,12 +282,12 @@ if ($result) {
|
||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||
|
||||
|
||||
print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
@ -300,20 +300,20 @@ if ($result) {
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -139,10 +139,10 @@ if ($massaction == 'ventil') {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
$accountventilated = new AccountingAccount($db);
|
||||
$accountventilated->fetch($monCompte, '');
|
||||
|
||||
|
||||
dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg.= '<div><font color="green">' . $langs->trans("LineOfExpenseReport") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
@ -152,7 +152,7 @@ if ($massaction == 'ventil') {
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
@ -224,7 +224,7 @@ if ($result) {
|
||||
$i = 0;
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@ -237,8 +237,8 @@ if ($result) {
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -247,7 +247,7 @@ if ($result) {
|
||||
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_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||
@ -290,8 +290,8 @@ if ($result) {
|
||||
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$form = new Form($db);
|
||||
|
||||
@ -323,7 +323,7 @@ if ($result) {
|
||||
// Fees description -- Can be null
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
@ -356,7 +356,7 @@ if ($result) {
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -72,10 +72,10 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
|
||||
$now = dol_now();
|
||||
$action = GETPOST('action','aZ09');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0 && empty($id_journal))
|
||||
@ -121,6 +121,8 @@ $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
||||
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||
$sql .= " ORDER BY b.datev";
|
||||
|
||||
$object = new Account($db);
|
||||
@ -366,6 +368,7 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_operation = $val["label"];
|
||||
$bookkeeping->label_compte = $langs->trans("Bank");
|
||||
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
|
||||
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
|
||||
@ -473,6 +476,18 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->date_create = $now;
|
||||
|
||||
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$sqlmid = 'SELECT ch.libelle, t.libelle as labelc';
|
||||
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "chargesociales ch ";
|
||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paych ON paych.fk_charge=ch.rowid";
|
||||
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "c_chargesociales as t ON ch.fk_type=t.id";
|
||||
$sqlmid .= " WHERE paych.fk_bank=" . $key;
|
||||
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
$objmid = $db->fetch_object($resultmid);
|
||||
$bookkeeping->label_compte = $objmid->labelc;
|
||||
$bookkeeping->doc_ref = $objmid->libelle ;
|
||||
}
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
|
||||
@ -597,7 +612,6 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Export
|
||||
/*
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
|
||||
@ -606,165 +620,101 @@ if ($action == 'export_csv') {
|
||||
$companystatic = new Client($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
|
||||
{
|
||||
$sep = ";";
|
||||
// Bank
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
}
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('Subscription');
|
||||
}
|
||||
if ($reflabel == '(ExpenseReportPayment)') {
|
||||
$reflabel = $langs->trans('Employee');
|
||||
}
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
$userstatic->id = $tabuser[$key]['id'];
|
||||
$userstatic->lastname = $tabuser[$key]['lastname'];
|
||||
$userstatic->firstname = $tabuser[$key]['firstname'];
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else {
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
}
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
}
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('Subscription');
|
||||
}
|
||||
if ($reflabel == '(ExpenseReportPayment)') {
|
||||
$reflabel = $langs->trans('Employee');
|
||||
}
|
||||
} else {
|
||||
// Model Classic Export
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
} else if($tabtype[$key] == 'payment') {
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@ -788,7 +738,7 @@ if (empty($action) || $action == 'view') {
|
||||
$builddate = time();
|
||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -802,6 +752,7 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
@ -863,6 +814,9 @@ if (empty($action) || $action == 'view') {
|
||||
if ($reflabel == '(ExpenseReportPayment)') {
|
||||
$reflabel = $langs->trans('Employee');
|
||||
}
|
||||
if ($reflabel == '(payment_salary)') {
|
||||
$reflabel = $langs->trans('Employee');
|
||||
}
|
||||
|
||||
$ref=$reflabel;
|
||||
if ($tabtype[$key] == 'payment')
|
||||
|
||||
@ -43,7 +43,7 @@ $langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$date_startmonth = GETPOST('date_startmonth');
|
||||
$date_startday = GETPOST('date_startday');
|
||||
@ -51,6 +51,7 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -108,6 +109,8 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
}
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
|
||||
@ -385,69 +388,15 @@ if ($action == 'writebookkeeping') {
|
||||
$form = new Form($db);
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($val["description"], 32) . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $langs->trans("VAT") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $purchase_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $companystatic->name . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
// Model Classic Export
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
@ -468,44 +417,60 @@ $companystatic = new Fournisseur($db);
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
// print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Third party
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . $val["refsuppliersologest"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
|
||||
print '"' . $journal_label . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
@ -524,7 +489,7 @@ if (empty($action) || $action == 'view') {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -548,6 +513,7 @@ if (empty($action) || $action == 'view') {
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
print '
|
||||
|
||||
@ -46,7 +46,7 @@ $langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$id_journal = GETPOST('id_journal', 'int');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$date_startmonth = GETPOST('date_startmonth');
|
||||
$date_startday = GETPOST('date_startday');
|
||||
@ -54,6 +54,7 @@ $date_startyear = GETPOST('date_startyear');
|
||||
$date_endmonth = GETPOST('date_endmonth');
|
||||
$date_endday = GETPOST('date_endday');
|
||||
$date_endyear = GETPOST('date_endyear');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping');
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -113,6 +114,8 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
if ($in_bookkeeping == 'yes')
|
||||
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
@ -401,76 +404,18 @@ if ($action == 'writebookkeeping') {
|
||||
$form = new Form($db);
|
||||
|
||||
// Export
|
||||
/*if ($action == 'export_csv') {
|
||||
if ($action == 'export_csv') {
|
||||
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
$companystatic = new Client($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
// Model Cegid Expert Export
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
|
||||
$sep = ";";
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
|
||||
$date = dol_print_date($val["date"], '%d%m%Y');
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount_static = new AccountingAccount($db);
|
||||
if ($accountingaccount_static->fetch(null, $k, true)) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// TVA
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $sell_journal . $sep;
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
|
||||
// print $langs->trans("VAT") . $sep;
|
||||
print $val["ref"];
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
|
||||
// Model Classic Export
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
@ -481,13 +426,19 @@ $form = new Form($db);
|
||||
$date = dol_print_date($val["date"], 'day');
|
||||
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
@ -495,33 +446,48 @@ $form = new Form($db);
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
|
||||
print '"' . utf8_decode (dol_trunc($companystatic->name, 16) ) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
|
||||
print "\n";
|
||||
print '"' . $key . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
print " " . $sep;
|
||||
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key]. '"' . $sep;
|
||||
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . $sell_journal . '"' ;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
@ -539,18 +505,12 @@ if (empty($action) || $action == 'view') {
|
||||
$description .= $langs->trans("DepositsAreNotIncluded");
|
||||
else
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
|
||||
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
}*/
|
||||
|
||||
// Button to write into Ledger
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
|
||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
@ -563,6 +523,7 @@ if (empty($action) || $action == 'view') {
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
print '
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.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
|
||||
@ -25,6 +25,7 @@ require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
@ -41,6 +42,8 @@ $selectcpt = GETPOST('cpt_bk');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
$simple_report = GETPOST('simple_report');
|
||||
|
||||
|
||||
// Filter
|
||||
$year = GETPOST('year','int');
|
||||
@ -77,7 +80,16 @@ $form = new Form($db);
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans('ReportInOut'), $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, 'title_accountancy');
|
||||
$nom = $langs->trans("ReportInOut");
|
||||
$nomlink = '';
|
||||
$periodlink = '';
|
||||
$exportlink = '';
|
||||
$builddate = time();
|
||||
$description = '';
|
||||
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
|
||||
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
|
||||
'action' => ''
|
||||
));
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
@ -108,37 +120,97 @@ foreach($months as $k => $v){
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$cats = $AccCat->getCatsCpts();
|
||||
if ($cats < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||
|
||||
$catsCalcule = $AccCat->getCatsCal();
|
||||
|
||||
//All categories
|
||||
$cats = $AccCat->getCats();
|
||||
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
|
||||
|
||||
$j=1;
|
||||
$sommes = array();
|
||||
|
||||
if (!empty($cats))
|
||||
{
|
||||
foreach ($cats as $name_cat => $cpts)
|
||||
{
|
||||
foreach($cats as $cat ){
|
||||
if(!empty($cat['category_type'])){ // category calculed
|
||||
|
||||
$formula = $cat['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="17">' . $name_cat . '</td>';
|
||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
|
||||
|
||||
$result = strtr($formula, $vars);
|
||||
|
||||
|
||||
$r = $AccCat->calculate($result);
|
||||
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||
$code = $cat['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $r;
|
||||
|
||||
// Current fiscal year (N)
|
||||
if (is_array($sommes) && ! empty($sommes)){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = strtr($formula, $vars);
|
||||
|
||||
$r = $AccCat->calculate($result);
|
||||
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||
$sommes[$code]['N'] += $r;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
$r = $AccCat->calculate($result);
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
}
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$position = -1;
|
||||
$code = -1;
|
||||
|
||||
|
||||
}else{ // normal category
|
||||
|
||||
$totCat = array();
|
||||
$totCat['M'] = array();
|
||||
|
||||
// get cpts of category
|
||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $cat['label'] . '</td>';
|
||||
|
||||
foreach($cpts as $i => $cpt){
|
||||
$var = ! $var;
|
||||
|
||||
$position = $cpt['position'];
|
||||
$code = $cpt['code'];
|
||||
|
||||
$code = $cat['code'];
|
||||
|
||||
// N-1
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultNP=0;
|
||||
} else {
|
||||
$resultNP=$AccCat->sdc;
|
||||
}
|
||||
|
||||
|
||||
//N
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
@ -146,13 +218,64 @@ if (!empty($cats))
|
||||
} else {
|
||||
$resultN=$AccCat->sdc;
|
||||
}
|
||||
|
||||
$totCat['NP'] += $resultNP;
|
||||
$totCat['N'] += $resultN;
|
||||
|
||||
foreach($months as $k => $v){
|
||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultM=0;
|
||||
} else {
|
||||
$resultM=$AccCat->sdc;
|
||||
}
|
||||
$totCat['M'][$k] += $resultM;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="right">' . price($totCat['NP']) . '</td>';
|
||||
print '<td align="right">' . price($totCat['N']) . '</td>';
|
||||
|
||||
foreach($totCat['M'] as $k => $v){
|
||||
print '<td align="right">' . price($v) . '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
foreach($cpts as $i => $cpt){
|
||||
$var = ! $var;
|
||||
|
||||
$code = $cat['code'];
|
||||
|
||||
// N-1
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultNP=0;
|
||||
} else {
|
||||
$resultNP=$AccCat->sdc;
|
||||
}
|
||||
|
||||
//N
|
||||
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||
if ($return < 0) {
|
||||
setEventMessages(null, $AccCat->errors, 'errors');
|
||||
$resultN=0;
|
||||
} else {
|
||||
$resultN=$AccCat->sdc;
|
||||
}
|
||||
|
||||
$sommes[$code]['NP'] += $resultNP;
|
||||
$sommes[$code]['N'] += $resultN;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $cpt['account_number'] . '</td>';
|
||||
print '<tr'. $bc[$var].'>';
|
||||
if ($simple_report == 'yes') {
|
||||
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
|
||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||
print '<td>' . price($resultNP) . '</td>';
|
||||
print '<td>' . price($resultN) . '</td>';
|
||||
print '<td align="right">' . price($resultNP) . '</td>';
|
||||
print '<td align="right">' . price($resultN) . '</td>';
|
||||
}
|
||||
|
||||
foreach($months as $k => $v){
|
||||
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||
@ -163,102 +286,15 @@ if (!empty($cats))
|
||||
$resultM=$AccCat->sdc;
|
||||
}
|
||||
$sommes[$code]['M'][$k] += $resultM;
|
||||
if ($simple_report == 'yes') {
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// If it's a calculated catgory
|
||||
$p = $position + 1;
|
||||
if(array_key_exists($p, $catsCalcule)){
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Others calculed category
|
||||
foreach($catsCalcule as $p => $catc)
|
||||
{
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -52,6 +52,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
@ -94,17 +96,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -149,13 +153,15 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql.= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if ($search_lineid) {
|
||||
@ -182,6 +188,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= " AND (co.label like'" . $search_country . "%')";
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -202,7 +214,7 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
@ -221,8 +233,8 @@ if ($result) {
|
||||
if ($search_country)
|
||||
$param .= "&search_country=" . $search_country;
|
||||
if ($search_tvaintra)
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
$param .= "&search_tvaintra=" . $search_tvaintra;
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -231,20 +243,20 @@ if ($result) {
|
||||
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_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
|
||||
print $langs->trans("DescVentilDoneSupplier") . '<br>';
|
||||
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1);
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>';
|
||||
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
@ -256,12 +268,14 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -273,71 +287,74 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
$checkpicto=$form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$facturefournisseur_static = new FactureFournisseur($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
|
||||
|
||||
$facturefournisseur_static->ref = $objp->facnumber;
|
||||
$facturefournisseur_static->id = $objp->facid;
|
||||
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
|
||||
|
||||
|
||||
print '<td>';
|
||||
print $objp->invoice_label;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="left">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print '<td align="right">' . $objp->country .'</td>';
|
||||
print '<td align="center">' . $objp->tva_intra . '</td>';
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -104,7 +104,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
{
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_invoice = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -146,10 +146,10 @@ if ($massaction == 'ventil') {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
$accountventilated = new AccountingAccount($db);
|
||||
$accountventilated->fetch($monCompte, '');
|
||||
|
||||
|
||||
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
@ -159,7 +159,7 @@ if ($massaction == 'ventil') {
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
@ -332,7 +332,7 @@ if ($result) {
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
|
||||
@ -356,7 +356,7 @@ if ($result) {
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Line id
|
||||
@ -381,7 +381,7 @@ if ($result) {
|
||||
// Description
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
@ -422,7 +422,7 @@ if ($result) {
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -52,7 +52,7 @@ $result=restrictedArea($user,'adherent',$id);
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -46,7 +46,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -165,7 +165,7 @@ if ($action == 'edit')
|
||||
$var=true;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($modules as $module => $delays)
|
||||
{
|
||||
@ -173,12 +173,12 @@ if ($action == 'edit')
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
|
||||
print '<input size="5" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
|
||||
print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,11 +189,11 @@ if ($action == 'edit')
|
||||
|
||||
// Show if meteo is enabled
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
$var=false;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -211,7 +211,7 @@ else
|
||||
*/
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
$var=true;
|
||||
|
||||
foreach($modules as $module => $delays)
|
||||
@ -220,12 +220,12 @@ else
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('',$delay['img']).'</td>';
|
||||
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
|
||||
print '<td>'.$value.' '.$langs->trans("days").'</td></tr>';
|
||||
print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,11 +236,11 @@ else
|
||||
|
||||
// Show if meteo is enabled
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
$var=false;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
|
||||
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -559,6 +559,7 @@ print '/>';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
// Use services duration
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
|
||||
@ -67,7 +67,7 @@ $active = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -225,20 +225,6 @@ asort($orders);
|
||||
//var_dump($modules);
|
||||
|
||||
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
|
||||
$head[$h][1] = $langs->trans("Description");
|
||||
$head[$h][2] = 'desc';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
|
||||
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
|
||||
$head[$h][2] = 'feature';
|
||||
$h++;
|
||||
|
||||
|
||||
$i=0;
|
||||
foreach($orders as $tmpkey => $tmpvalue)
|
||||
{
|
||||
@ -257,6 +243,28 @@ $special = $objMod->special;
|
||||
$tab=explode('_',$value);
|
||||
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
|
||||
|
||||
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
|
||||
$head[$h][1] = $langs->trans("Description");
|
||||
$head[$h][2] = 'desc';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
|
||||
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
|
||||
$head[$h][2] = 'feature';
|
||||
$h++;
|
||||
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=changelog';
|
||||
$head[$h][1] = $langs->trans("ChangeLog");
|
||||
$head[$h][2] = 'changelog';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Check filters
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
@ -536,6 +544,13 @@ if ($mode == 'feature')
|
||||
}
|
||||
|
||||
|
||||
if ($mode == 'changelog')
|
||||
{
|
||||
$changelog=$objMod->getChangeLog();
|
||||
if ($changelog) $text.='<div class="moduledesclong">'.$changelog.'<div>';
|
||||
else $text.='<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
|
||||
}
|
||||
|
||||
print $text;
|
||||
|
||||
|
||||
|
||||
@ -207,8 +207,19 @@ if ($action == 'set' && $user->admin)
|
||||
//var_dump($resarray);exit;
|
||||
if ($resarray['nbperms'] > 0)
|
||||
{
|
||||
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
||||
setEventMessages($msg, null, 'warnings');
|
||||
$tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
|
||||
$resqltmp=$db->query($tmpsql);
|
||||
if ($resqltmp)
|
||||
{
|
||||
$obj=$db->fetch_object($resqltmp);
|
||||
//var_dump($obj->nb);exit;
|
||||
if ($obj && $obj->nb > 1)
|
||||
{
|
||||
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
||||
setEventMessages($msg, null, 'warnings');
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
}
|
||||
}
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
||||
|
||||
@ -88,6 +88,7 @@ if (!empty($ExecTimeLimit))
|
||||
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
||||
error_reporting($err);
|
||||
}
|
||||
$MemoryLimit=0;
|
||||
if (!empty($MemoryLimit))
|
||||
{
|
||||
@ini_set('memory_limit', $MemoryLimit);
|
||||
@ -120,10 +121,10 @@ $utils = new Utils($db);
|
||||
// MYSQL
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
@ -142,13 +143,13 @@ if ($what == 'mysql')
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if (! $errormsg)
|
||||
if (! $errormsg)
|
||||
{
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
$errormsg=$utils->error;
|
||||
@ -172,13 +173,13 @@ if ($what == 'postgresql')
|
||||
{
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if (! $errormsg)
|
||||
if (! $errormsg)
|
||||
{
|
||||
$utils->dumpDatabase(GETPOST('compression','alpha'), $what, 0, $file);
|
||||
$errormsg=$utils->error;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
*
|
||||
@ -45,15 +45,17 @@ $langs->load("companies");
|
||||
$langs->load("users");
|
||||
$langs->load("other");
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = 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 (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="dateevent";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
$search_code = GETPOST("search_code");
|
||||
$search_ip = GETPOST("search_ip");
|
||||
@ -61,9 +63,9 @@ $search_user = GETPOST("search_user");
|
||||
$search_desc = GETPOST("search_desc");
|
||||
$search_ua = GETPOST("search_ua");
|
||||
|
||||
if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
|
||||
else $date_start=-1;
|
||||
if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
|
||||
else $date_end=-1;
|
||||
|
||||
// checks:if date_start>date_end then date_end=date_start + 24 hours
|
||||
@ -72,14 +74,6 @@ if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date
|
||||
$now = dol_now();
|
||||
$nowarray = dol_getdate($now);
|
||||
|
||||
$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua";
|
||||
$params.= "&date_startmonth=".$_REQUEST["date_startmonth"];
|
||||
$params.= "&date_startday=".$_REQUEST["date_startday"];
|
||||
$params.= "&date_startyear=".$_REQUEST["date_startyear"];
|
||||
$params.= "&date_endmonth=".$_REQUEST["date_endmonth"];
|
||||
$params.= "&date_endday=".$_REQUEST["date_endday"];
|
||||
$params.= "&date_endyear=".$_REQUEST["date_endyear"];
|
||||
|
||||
if (empty($date_start)) // We define date_start and date_end
|
||||
{
|
||||
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
|
||||
@ -88,6 +82,15 @@ if (empty($date_end))
|
||||
{
|
||||
$date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
|
||||
}
|
||||
// Set $date_startmonth...
|
||||
$tmp = dol_getdate($date_start);
|
||||
$date_startday = $tmp['mday'];
|
||||
$date_startmonth = $tmp['mon'];
|
||||
$date_startyear = $tmp['year'];
|
||||
$tmp = dol_getdate($date_end);
|
||||
$date_endday = $tmp['mday'];
|
||||
$date_endmonth = $tmp['mon'];
|
||||
$date_endyear = $tmp['year'];
|
||||
|
||||
|
||||
/*
|
||||
@ -97,7 +100,7 @@ if (empty($date_end))
|
||||
$now=dol_now();
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$date_start=-1;
|
||||
$date_end=-1;
|
||||
@ -192,39 +195,39 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if ($search_code) $param.='&search_code='.$search_code;
|
||||
if ($search_ip) $param.='&search_ip='.$search_ip;
|
||||
if ($search_user) $param.='&search_user='.$search_user;
|
||||
if ($search_desc) $param.='&search_desc='.$search_desc;
|
||||
if ($search_ua) $param.='&search_ua='.$search_ua;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_code) $param.='&search_code='.urlencode($search_code);
|
||||
if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
|
||||
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_ua) $param.='&search_ua='.urlencode($search_ua);
|
||||
if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth);
|
||||
if ($date_startday) $param.= "&date_startday=".urlencode($date_startday);
|
||||
if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear);
|
||||
if ($date_endmonth) $param.= "&date_endmonth=".urlencode($date_endmonth);
|
||||
if ($date_endday) $param.= "&date_endday=".urlencode($date_endday);
|
||||
if ($date_endyear) $param.= "&date_endyear=".urlencode($date_endyear);
|
||||
|
||||
$langs->load('withdrawals');
|
||||
if ($num)
|
||||
{
|
||||
$center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit);
|
||||
|
||||
if ($action == 'purge')
|
||||
{
|
||||
$formquestion=array();
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
|
||||
}
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","","",'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Lignes des champs de filtres
|
||||
print '<tr class="liste_titre">';
|
||||
@ -255,14 +258,20 @@ if ($result)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num, $conf->liste_limit))
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date
|
||||
@ -316,7 +325,7 @@ if ($result)
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
|
||||
print "</form>";
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ $langs->load("other");
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -54,7 +54,7 @@ $status = 1;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -1,41 +1,54 @@
|
||||
API REST howto
|
||||
==============
|
||||
API REST
|
||||
========
|
||||
|
||||
This directory contains files to make Dolibarr a server of REST Web Services.
|
||||
It depends on external library Restler.
|
||||
## Integrate your ERP with any other applications using Dolibarr APIs
|
||||
|
||||
This module provides the service to make Dolibarr a server of REST Web Services. It depends on external library Restler.
|
||||
|
||||
Extract any data or push insert, update or delete record using our new REST APIs. Using standard HTTP and Json format, it is compatible with any language (PHP, Java, Ruby, Python, C#, C++, JavaScript, JQuery, Basic, ...). Use the embedded APIs explorer tool to test APIs or get generated URLs to use in your own code.
|
||||
|
||||
|
||||
Explore the api
|
||||
---------------
|
||||
<div align="center">
|
||||
<img class="imgdoc" src="https://www.dolibarr.org//images/doc_apirest.png" alt="Dolibarr API explorer"/>
|
||||
</div>
|
||||
|
||||
You can explore API method by using web interface : https://**yourdolibarr.tld**/mydolibarr/api/admin/explorer.php (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
|
||||
|
||||
Access to the API
|
||||
|
||||
Explore the APIs
|
||||
----------------
|
||||
|
||||
You can explore all available APIs by using the API explorer : [**yourdolibarr.tld**/api/index.php/explorer](../api/index.php/explorer) (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
|
||||
|
||||
|
||||
Access to an API
|
||||
-----------------
|
||||
|
||||
> **Warning : access to the API should (or better : must!) be secured with SSL connection**
|
||||
> **Warning : access to any API should (or better : must!) be secured with SSL connection**
|
||||
|
||||
To access to the API you need a token to identify. When you access the API for the first time, you need to log in with user name and password to get a token. **Only** this token will allow to access API with.
|
||||
To access to the API you need a token to identify. **Only** this token will allow to access API with.
|
||||
The token is dedicated to a user and it **must** be put into requests as **DOLAPIKEY** parameter in HTTP header (or among URL parameters, but this is less secured).
|
||||
|
||||
To log in with the API, use this uri : https://**yourdolibarr.tld**/mydolibarr/api/index.php/login?login=**username**&password=**password** (replace bold strings with real values)
|
||||
To get a token you can:
|
||||
|
||||
The token will be saved by Dolibarr for next user accesses to the API and it **must** be put into request uri as **api_key** parameter.
|
||||
* Edit the user card to set the value of token. Each user can have a different token.
|
||||
* or Call the *login* API with login and password. This will return the value of token for the user used to login.
|
||||
|
||||
Then call other services with
|
||||
|
||||
https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?api_key=**api_key**
|
||||
https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**api_key**
|
||||
|
||||
|
||||
Develop the API
|
||||
---------------
|
||||
Develop an API
|
||||
--------------
|
||||
|
||||
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
|
||||
|
||||
Github contains also usefull informations : https://github.com/Luracast/Restler
|
||||
|
||||
To implement it into Dolibarr, we need to create a specific class for object we want to use. A skeleton file is available into /dev directory : *skeleton_api_class.class.php*
|
||||
To implement it into Dolibarr, you need to create a specific class for object we want to use. A skeleton file is available into /modulebuilder/class directory : *api_mymodule_class.class.php*
|
||||
The API class file must be put into object class directory, with specific file name. By example, API class file for '*myobject*' must be put as : /htdocs/*myobject*/class/api_*myobject*.class.php. Class must be named **MyobjectApi**.
|
||||
|
||||
If a module provide several object, use a different name for '*myobject*' and put the file into the same directory.
|
||||
If a module provide several object, use a different name for *'myobject'* and put the file into the same directory.
|
||||
|
||||
**Define url for methods**
|
||||
|
||||
|
||||
@ -42,10 +42,11 @@ class DolibarrApi
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
* @param string $cachedir Cache dir
|
||||
* @param DoliDb $db Database handler
|
||||
* @param string $cachedir Cache dir
|
||||
* @param boolean $refreshCache Update cache
|
||||
*/
|
||||
function __construct($db, $cachedir='')
|
||||
function __construct($db, $cachedir='', $refreshCache=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -54,7 +55,7 @@ class DolibarrApi
|
||||
|
||||
$this->db = $db;
|
||||
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
||||
$this->r = new Restler($production_mode);
|
||||
$this->r = new Restler($production_mode, $refreshCache);
|
||||
|
||||
$this->r->setAPIVersion(1);
|
||||
}
|
||||
@ -66,7 +67,7 @@ class DolibarrApi
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/* Disabled, most APIs does not share same signature for method index
|
||||
/* Disabled, most APIs does not share same signature for method index
|
||||
function index()
|
||||
{
|
||||
return array(
|
||||
@ -93,9 +94,9 @@ class DolibarrApi
|
||||
unset($object->linkedObjects);
|
||||
|
||||
unset($object->lines); // should be ->lines
|
||||
|
||||
|
||||
unset($object->fields);
|
||||
|
||||
|
||||
unset($object->oldline);
|
||||
|
||||
unset($object->error);
|
||||
@ -175,7 +176,7 @@ class DolibarrApi
|
||||
* @throws RestException
|
||||
*/
|
||||
static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') {
|
||||
|
||||
|
||||
// Features/modules to check
|
||||
$featuresarray = array($resource);
|
||||
if (preg_match('/&/', $resource)) {
|
||||
|
||||
@ -80,25 +80,25 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
{
|
||||
dol_syslog($key.' - '.$val);
|
||||
}*/
|
||||
|
||||
|
||||
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
|
||||
$api_key = '';
|
||||
if (isset($_GET['api_key']))
|
||||
if (isset($_GET['api_key']))
|
||||
{
|
||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||
$api_key = $_GET['api_key']; // For backward compatibility
|
||||
}
|
||||
if (isset($_GET['DOLAPIKEY']))
|
||||
if (isset($_GET['DOLAPIKEY']))
|
||||
{
|
||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||
$api_key = $_GET['DOLAPIKEY']; // With GET method
|
||||
}
|
||||
if (isset($_SERVER['HTTP_DOLAPIKEY']))
|
||||
if (isset($_SERVER['HTTP_DOLAPIKEY'])) // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||
{
|
||||
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
||||
}
|
||||
|
||||
if ($api_key)
|
||||
|
||||
if ($api_key)
|
||||
{
|
||||
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
||||
$sql.= " u.tms as date_modification, u.entity";
|
||||
|
||||
@ -34,25 +34,25 @@ class Login
|
||||
/**
|
||||
* Login
|
||||
*
|
||||
* Request the API token for a couple username / password.
|
||||
* 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 "api_key" into field at the top right of page (Note: "api_key" 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 "api_key" into field at the top right of page (Note: "api_key" can be found/set on the user page).
|
||||
*
|
||||
* @param string $login User login
|
||||
* @param string $password User password
|
||||
* @param int $entity Entity (when multicompany module is used). Empty means 1=first company.
|
||||
* @param string $entity Entity (when multicompany module is used). '' means 1=first company.
|
||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||
* @return array Response status and user token
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
*
|
||||
* @url GET /
|
||||
* @url POST /
|
||||
*/
|
||||
public function index($login, $password, $entity=0, $reset=0) {
|
||||
public function index($login, $password, $entity='', $reset=0) {
|
||||
|
||||
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication))
|
||||
$dolibarr_main_authentication = 'http,dolibarr';
|
||||
@ -62,6 +62,8 @@ class Login
|
||||
// Set authmode
|
||||
$authmode = explode(',', $dolibarr_main_authentication);
|
||||
|
||||
if ($entity == '') $entity=1;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
|
||||
if (empty($login))
|
||||
@ -70,21 +72,21 @@ class Login
|
||||
}
|
||||
|
||||
$token = 'failedtogenerateorgettoken';
|
||||
|
||||
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch(0, $login);
|
||||
|
||||
$tmpuser->fetch(0, $login, 0, 0, $entity);
|
||||
|
||||
// Renew the hash
|
||||
if (empty($tmpuser->api_key) || $reset)
|
||||
{
|
||||
// Generate token for user
|
||||
$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY,1);
|
||||
|
||||
|
||||
// We store API token into database
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " SET api_key = '".$this->db->escape($token)."'";
|
||||
$sql.= " WHERE login = '".$this->db->escape($login)."'";
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result)
|
||||
@ -96,13 +98,14 @@ class Login
|
||||
{
|
||||
$token = $tmpuser->api_key;
|
||||
}
|
||||
|
||||
|
||||
//return token
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'token' => $token,
|
||||
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
||||
'entity' => $tmpuser->entity,
|
||||
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -21,13 +21,21 @@
|
||||
* \defgroup api Module DolibarrApi
|
||||
* \brief API loader
|
||||
* Search files htdocs/<module>/class/api_<module>.class.php
|
||||
* \file htdocs/api/indexphp
|
||||
*
|
||||
* @todo User authentication with api_key
|
||||
* \file htdocs/api/index.php
|
||||
*/
|
||||
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1');
|
||||
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1');
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
|
||||
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
||||
@ -67,7 +75,31 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
||||
}
|
||||
|
||||
|
||||
$api = new DolibarrApi($db);
|
||||
|
||||
|
||||
// Analyze URLs
|
||||
// index.php/explorer do a redirect to index.php/explorer/
|
||||
// index.php/explorer/ called by swagger to build explorer page
|
||||
// index.php/explorer/.../....png|.css|.js called by swagger for resources to build explorer page
|
||||
// index.php/explorer/resources.json called by swagger to get list of all services
|
||||
// index.php/explorer/resources.json/xxx called by swagger to get detail of services xxx
|
||||
// index.php/xxx called by any REST client to run API
|
||||
|
||||
|
||||
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
||||
|
||||
|
||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||
$refreshcache=false;
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
$refreshcache=true;
|
||||
}
|
||||
|
||||
|
||||
$api = new DolibarrApi($db, '', $refreshcache);
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
|
||||
// Enable the Restler API Explorer.
|
||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||
@ -79,110 +111,82 @@ $api->r->addAuthenticationClass('DolibarrApiAccess','');
|
||||
// Define accepted mime types
|
||||
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
|
||||
|
||||
$listofapis = array();
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
foreach ($modulesdir as $dir)
|
||||
|
||||
// Call Explorer file for all APIs definitions
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
/*
|
||||
* Search available module
|
||||
*/
|
||||
//dol_syslog("Scan directory ".$dir." for API modules");
|
||||
// Scan all API files to load them
|
||||
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
$listofapis = array();
|
||||
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
// Search available module
|
||||
dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files");
|
||||
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$module = strtolower($reg[1]);
|
||||
$moduledirforclass = $module;
|
||||
$moduleforperm = $module;
|
||||
|
||||
if ($module == 'propale') {
|
||||
$moduledirforclass = 'comm/propal';
|
||||
$moduleforperm='propal';
|
||||
}
|
||||
elseif ($module == 'agenda') {
|
||||
$moduledirforclass = 'comm/action';
|
||||
}
|
||||
elseif ($module == 'adherent') {
|
||||
$moduledirforclass = 'adherents';
|
||||
}
|
||||
elseif ($module == 'banque') {
|
||||
$moduledirforclass = 'compta/bank';
|
||||
}
|
||||
elseif ($module == 'categorie') {
|
||||
$moduledirforclass = 'categories';
|
||||
}
|
||||
elseif ($module == 'facture') {
|
||||
$moduledirforclass = 'compta/facture';
|
||||
}
|
||||
elseif ($module == 'project') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'task') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'stock') {
|
||||
$moduledirforclass = 'product/stock';
|
||||
}
|
||||
elseif ($module == 'fournisseur') {
|
||||
$moduledirforclass = 'fourn';
|
||||
}
|
||||
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||
|
||||
if ($enabled)
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
|
||||
{
|
||||
/*
|
||||
* If exists, load the API class for enable module
|
||||
*
|
||||
* Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
*
|
||||
* @todo : use getElementProperties() function ?
|
||||
*/
|
||||
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
|
||||
$module = strtolower($reg[1]);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
$moduleforperm = $module;
|
||||
if ($module == 'propale') { $moduleforperm='propal'; }
|
||||
|
||||
$handle_part=@opendir(dol_osencode($dir_part));
|
||||
if (is_resource($handle_part))
|
||||
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||
|
||||
if ($enabled)
|
||||
{
|
||||
while (($file_searched = readdir($handle_part))!==false)
|
||||
{
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
// If exists, load the API class for enable module
|
||||
// Search files named api_<object>.class.php into /htdocs/<module>/class directory
|
||||
// @todo : use getElementProperties() function ?
|
||||
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
|
||||
|
||||
// Support of the deprecated API.
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
$handle_part=@opendir(dol_osencode($dir_part));
|
||||
if (is_resource($handle_part))
|
||||
{
|
||||
while (($file_searched = readdir($handle_part))!==false)
|
||||
{
|
||||
$classname = ucwords($reg[1]).'Api';
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
|
||||
// Support of the deprecated API.
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$api->r->addAPIClass($classname, '/');
|
||||
$classname = ucwords($reg[1]).'Api';
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$api->r->addAPIClass($classname, '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
|
||||
{
|
||||
$classname = ucwords($reg[1]);
|
||||
$classname = str_replace('_', '', $classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$listofapis[] = $classname;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
$classname = ucwords($reg[1]);
|
||||
$classname = str_replace('_', '', $classname);
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
|
||||
$listofapis[] = $classname;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,20 +195,60 @@ foreach ($modulesdir as $dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the classes before adding them to Restler.
|
||||
// The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
|
||||
sort($listofapis);
|
||||
foreach ($listofapis as $classname)
|
||||
{
|
||||
$api->r->addAPIClass($classname);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the classes before adding them to Restler. The Restler API Explorer
|
||||
// shows the classes in the order they are added and it's a mess if they are
|
||||
// not sorted.
|
||||
sort($listofapis);
|
||||
//var_dump($listofapis);
|
||||
foreach ($listofapis as $classname)
|
||||
// Call one APIs or one definition of an API
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
|
||||
{
|
||||
$api->r->addAPIClass($classname);
|
||||
$module = $reg[1];
|
||||
if ($module == 'explorer') // If we call page to explore details of a service
|
||||
{
|
||||
$module = $regbis[1];
|
||||
}
|
||||
|
||||
// Load a dedicated API file
|
||||
dol_syslog("Load a dedicated API file");
|
||||
|
||||
$module=strtolower($module);
|
||||
$moduledirforclass = getModuleDirForApiClass($module);
|
||||
|
||||
if (in_array($module, array('category','contact','customer','invoice','order','product','thirdparty','user'))) // Old Apis
|
||||
{
|
||||
$classfile = $module;
|
||||
if ($module == 'customer') { $classfile = 'thirdparty'; }
|
||||
if ($module == 'order') { $classfile = 'commande'; }
|
||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_deprecated_'.$classfile.'.class.php');
|
||||
$classname=ucwords($module);
|
||||
if ($module == 'customer') { $classname='Thirdparty'; }
|
||||
if ($module == 'order') { $classname='Commande'; }
|
||||
//var_dump($classfile);var_dump($classname);exit;
|
||||
|
||||
require_once $dir_part_file;
|
||||
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
$classfile = str_replace('_', '', $module);
|
||||
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||
$classname=ucwords($module);
|
||||
|
||||
require_once $dir_part_file;
|
||||
if (class_exists($classname)) $api->r->addAPIClass($classname);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
//var_dump($api);
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
$api->r->handle();
|
||||
|
||||
@ -40,7 +40,26 @@ function printBookmarksList($aDb, $aLangs)
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$url= $_SERVER["PHP_SELF"].(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
$url= $_SERVER["PHP_SELF"];
|
||||
|
||||
if (! empty($_SERVER["QUERY_STRING"]))
|
||||
{
|
||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
||||
}
|
||||
else
|
||||
{
|
||||
global $sortfield,$sortorder;
|
||||
$tmpurl='';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
||||
foreach($_POST as $key => $val)
|
||||
{
|
||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
||||
}
|
||||
|
||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
|
||||
@ -55,7 +74,8 @@ function printBookmarksList($aDb, $aLangs)
|
||||
// Url to go on create new bookmark page
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
|
||||
}
|
||||
// Menu with all bookmarks
|
||||
|
||||
@ -39,6 +39,7 @@ $id=GETPOST("id");
|
||||
$action=GETPOST("action","alpha");
|
||||
$title=GETPOST("title","alpha");
|
||||
$url=GETPOST("url","alpha");
|
||||
$urlsource=GETPOST("urlsource","alpha");
|
||||
$target=GETPOST("target","alpha");
|
||||
$userid=GETPOST("userid","int");
|
||||
$position=GETPOST("position","int");
|
||||
@ -64,7 +65,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
|
||||
if (GETPOST("cancel"))
|
||||
{
|
||||
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
@ -97,7 +98,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):DOL_URL_ROOT.'/bookmarks/list.php');
|
||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
@ -121,6 +122,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -153,15 +155,15 @@ if ($action == 'create')
|
||||
|
||||
print load_fiche_titre($langs->trans("NewBookmark"));
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("BookmarkTitle").'</td><td><input id="titlebookmark" class="flat minwidth100" name="title" value="'.$title.'"></td><td class="hideonsmartphone">'.$langs->trans("SetHereATitleForLink").'</td></tr>';
|
||||
dol_set_focus('#titlebookmark');
|
||||
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.dol_escape_htmltag($url).'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
|
||||
|
||||
// Target
|
||||
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
|
||||
@ -219,14 +221,14 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark');
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -304,7 +306,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if ($action == 'edit')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
@ -221,9 +221,7 @@ llxHeader("",$langs->trans("Categories"),$helpurl);
|
||||
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
/*
|
||||
* Fiche en mode creation
|
||||
*/
|
||||
// Create or add
|
||||
if ($action == 'create' || $_POST["addcat"] == 'addcat')
|
||||
{
|
||||
dol_set_focus('#label');
|
||||
@ -246,7 +244,7 @@ if ($user->rights->categorie->creer)
|
||||
|
||||
// Ref
|
||||
print '<tr>';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">';
|
||||
print'</td></tr>';
|
||||
|
||||
// Description
|
||||
@ -263,7 +261,8 @@ if ($user->rights->categorie->creer)
|
||||
|
||||
// Parent category
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $form->select_all_categories($type, $catorigin);
|
||||
print $form->select_all_categories($type, $catorigin, 'parent');
|
||||
print ajax_combobox('parent');
|
||||
print '</td></tr>';
|
||||
|
||||
$parameters=array();
|
||||
|
||||
@ -53,7 +53,7 @@ class Categorie extends CommonObject
|
||||
const TYPE_PROJECT = 6;
|
||||
const TYPE_BANK_LINE = 'bank_line';
|
||||
public $picto = 'category';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
@ -557,7 +557,7 @@ class Categorie extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang";
|
||||
@ -814,7 +814,7 @@ class Categorie extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($rec = $this->db->fetch_array($resql))
|
||||
while ($rec = $this->db->fetch_array($resql))
|
||||
{
|
||||
if ($onlyids)
|
||||
{
|
||||
@ -938,7 +938,7 @@ class Categorie extends CommonObject
|
||||
*
|
||||
* @return array Array of categories. this->cats and this->motherof are set.
|
||||
*/
|
||||
function get_full_arbo($type,$markafterid=0)
|
||||
function get_full_arbo($type, $markafterid=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -1355,7 +1355,7 @@ class Categorie extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c";
|
||||
$sql.= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid";
|
||||
$sql.= " ORDER BY c.label";
|
||||
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -1377,7 +1377,7 @@ class Categorie extends CommonObject
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1385,7 +1385,7 @@ class Categorie extends CommonObject
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
|
||||
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type];
|
||||
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
|
||||
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
@ -1408,7 +1408,7 @@ class Categorie extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $cats;
|
||||
}
|
||||
|
||||
@ -1434,7 +1434,7 @@ class Categorie extends CommonObject
|
||||
$cats = array();
|
||||
|
||||
// For backward compatibility
|
||||
if (is_numeric( $type )) {
|
||||
if (is_numeric($type)) {
|
||||
// We want to reverse lookup
|
||||
$map_type = array_flip( $this->MAP_ID );
|
||||
$type = $map_type[$type];
|
||||
@ -1782,8 +1782,8 @@ class Categorie extends CommonObject
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
|
||||
@ -36,9 +36,8 @@ $langs->load("categories");
|
||||
if (! $user->rights->categorie->lire) accessforbidden();
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT);
|
||||
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
|
||||
$catname=GETPOST('catname','alpha');
|
||||
$section=(GETPOST('section')?GETPOST('section'):0);
|
||||
|
||||
|
||||
/*
|
||||
@ -48,14 +47,15 @@ $section=(GETPOST('section')?GETPOST('section'):0);
|
||||
$categstatic = new Categorie($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea");
|
||||
else $title=$langs->trans("CategoriesArea");
|
||||
if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; }
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; }
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
|
||||
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
|
||||
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
|
||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
@ -104,7 +104,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
*/
|
||||
if ($catname || $id > 0)
|
||||
{
|
||||
$cats = $categstatic->rechercher($id,$catname,$type);
|
||||
$cats = $categstatic->rechercher($id, $catname, $typetext);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||
@ -140,7 +140,7 @@ print '<div class="fichecenter"><br>';
|
||||
|
||||
|
||||
// Charge tableau des categories
|
||||
$cate_arbo = $categstatic->get_full_arbo($type);
|
||||
$cate_arbo = $categstatic->get_full_arbo($typetext);
|
||||
|
||||
// Define fulltree array
|
||||
$fulltree=$cate_arbo;
|
||||
|
||||
@ -124,7 +124,7 @@ if ($object->id > 0)
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action');
|
||||
|
||||
$linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"');
|
||||
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Link to other agenda views
|
||||
$out='';
|
||||
@ -137,7 +137,7 @@ if ($object->id > 0)
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
|
||||
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
|
||||
|
||||
|
||||
$linkback.=$out;
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
@ -161,13 +161,13 @@ if ($object->id > 0)
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -228,7 +228,7 @@ if ($object->id > 0)
|
||||
print '<div class="assignedtouser">';
|
||||
print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</div>';
|
||||
if (in_array($user->id,array_keys($listofuserid)))
|
||||
if (in_array($user->id,array_keys($listofuserid)))
|
||||
{
|
||||
print '<div class="myavailability">';
|
||||
print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody
|
||||
@ -237,7 +237,7 @@ if ($object->id > 0)
|
||||
print ' </td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Construit liste des fichiers
|
||||
@ -255,7 +255,7 @@ if ($object->id > 0)
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder)
|
||||
{
|
||||
@ -338,6 +338,17 @@ if ($resql)
|
||||
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
print $nav;
|
||||
|
||||
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
|
||||
{
|
||||
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
|
||||
|
||||
//$param='month='.$monthshown.'&year='.$year;
|
||||
$hourminsec='100000';
|
||||
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
|
||||
$link.= $langs->trans("NewAction");
|
||||
$link.= '</a>';
|
||||
}
|
||||
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
@ -497,12 +508,12 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// User to do
|
||||
// User owner
|
||||
print '<td align="left">';
|
||||
if ($obj->fk_user_action > 0)
|
||||
{
|
||||
$userstatic->fetch($obj->fk_user_action);
|
||||
print $userstatic->getNomUrl(1);
|
||||
print $userstatic->getNomUrl(-1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
@ -729,8 +729,8 @@ foreach ($usernames as $username)
|
||||
{
|
||||
$var = ! $var;
|
||||
echo "<tr>";
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
|
||||
print $username->getNomUrl(-1,'',0,0,24,1,'');
|
||||
echo '<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
|
||||
print $username->getNomUrl(-1,'',0,0,20,1,'');
|
||||
print '</td>';
|
||||
$tmpday = $sav;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.datep";
|
||||
|
||||
@ -210,7 +210,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
@ -234,7 +234,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -558,7 +558,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -663,7 +663,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
@ -833,8 +833,8 @@ if (empty($reshook))
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -920,7 +920,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
@ -1065,7 +1065,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
@ -1360,7 +1360,7 @@ if ($action == 'create')
|
||||
}
|
||||
} else {
|
||||
print '<td>';
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty');
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
|
||||
@ -2305,7 +2305,7 @@ class Propal extends CommonObject
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->thirdparty->default_lang);
|
||||
$newlang=(GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $this->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
|
||||
@ -208,8 +208,8 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -801,8 +801,8 @@ if (empty($reshook))
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -1015,8 +1015,8 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -1102,7 +1102,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1155,7 +1155,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1477,7 +1477,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty');
|
||||
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
|
||||
@ -108,7 +108,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='ASC';
|
||||
if (! $sortfield) $sortfield='b.datev';
|
||||
if (! $sortfield) $sortfield='b.datev, b.dateo, b.rowid';
|
||||
|
||||
$mode_balance_ok=false;
|
||||
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected
|
||||
@ -436,6 +436,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@ -636,6 +637,7 @@ if ($resql)
|
||||
// print '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
/// ajax to adjust value date with plus and less picto
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
@ -717,6 +719,7 @@ if ($resql)
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (! empty($arrayfields['b.rowid']['checked']))
|
||||
{
|
||||
@ -855,7 +858,7 @@ if ($resql)
|
||||
exit;
|
||||
}
|
||||
|
||||
//Loop on each record
|
||||
// Loop on each record before
|
||||
$sign = 1;
|
||||
$i = 0;
|
||||
$sqlforbalance='SELECT SUM(b.amount) as balance';
|
||||
@ -865,7 +868,7 @@ if ($resql)
|
||||
$sqlforbalance.= " WHERE b.fk_account = ba.rowid";
|
||||
$sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||
$sqlforbalance.= " AND b.fk_account = ".$account;
|
||||
$sqlforbalance.= " AND b.datev < '" . $db->idate($db->jdate($objp->dv)) . "'";
|
||||
$sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "' OR (b.datev = '" . $db->idate($db->jdate($objp->dv)) . "' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
|
||||
$resqlforbalance = $db->query($sqlforbalance);
|
||||
//print $sqlforbalance;
|
||||
if ($resqlforbalance)
|
||||
|
||||
@ -464,7 +464,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -550,7 +550,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1371,7 +1371,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1586,8 +1586,8 @@ if (empty($reshook))
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -1656,7 +1656,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1832,8 +1832,8 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
@ -2732,9 +2732,9 @@ if ($action == 'create')
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyAmountHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyAmountVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyAmountTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -545,8 +545,8 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
@ -625,7 +625,7 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -810,8 +810,8 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
|
||||
$newlang = GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
|
||||
$newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
|
||||
@ -56,10 +56,10 @@ if ($action == 'builddoc')
|
||||
$rap = new pdf_paiement($db);
|
||||
|
||||
$outputlangs = $langs;
|
||||
if (GETPOST('lang_id'))
|
||||
if (GETPOST('lang_id','aZ09'))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||
$outputlangs->setDefaultLang(GETPOST('lang_id','aZ09'));
|
||||
}
|
||||
|
||||
// We save charset_output to restore it because write_file can change it if needed for
|
||||
|
||||
@ -251,7 +251,7 @@ if ($id)
|
||||
|
||||
|
||||
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -312,7 +312,7 @@ if (empty($reshook))
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
@ -585,7 +585,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -922,7 +922,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
@ -68,7 +68,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty
|
||||
if (! empty($newlang))
|
||||
|
||||
@ -30,15 +30,15 @@ $dellinkid = GETPOST('dellinkid','int');
|
||||
$addlinkid = GETPOST('idtolinkto','int');
|
||||
|
||||
// Link invoice to order
|
||||
if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $id > 0 && $addlinkid > 0)
|
||||
if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $id > 0 && $addlinkid > 0)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->add_object_linked(GETPOST('addlink'), $addlinkid);
|
||||
$result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid);
|
||||
}
|
||||
|
||||
// Delete link
|
||||
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0)
|
||||
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $dellinkid > 0)
|
||||
{
|
||||
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
|
||||
@ -35,7 +35,7 @@ if ($action == 'up' && $permissiontoedit)
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -57,7 +57,7 @@ if ($action == 'down' && $permissiontoedit)
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
|
||||
@ -400,7 +400,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
// Define output language (Here it is not used because we do only merging existing PDF)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
/*
|
||||
* Add file in email form
|
||||
*/
|
||||
if (GETPOST('addfile'))
|
||||
if (GETPOST('addfile','alpha'))
|
||||
{
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
@ -68,7 +68,7 @@ if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
|
||||
/*
|
||||
* Remove all files in email form
|
||||
*/
|
||||
if (GETPOST('removAll'))
|
||||
if (GETPOST('removAll','alpha'))
|
||||
{
|
||||
$trackid = GETPOST('trackid','aZ09');
|
||||
|
||||
@ -447,7 +447,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
|
||||
dol_syslog('Try to send email with no recipiend defined', LOG_WARNING);
|
||||
dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
|
||||
$action = 'presend';
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,21 +162,13 @@ if ($type == 'directory')
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'invoice_supplier')
|
||||
{
|
||||
$relativepath='facture';
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
||||
}
|
||||
else if ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
|
||||
// Auto area for customers orders
|
||||
else if ($module == 'propal') $upload_dir = $conf->propal->dir_output;
|
||||
// Auto area for customers orders
|
||||
else if ($module == 'order') $upload_dir = $conf->commande->dir_output;
|
||||
// Auto area for suppliers orders
|
||||
else if ($module == 'order_supplier')
|
||||
{
|
||||
$relativepath='commande';
|
||||
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
|
||||
}
|
||||
else if ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
|
||||
// Auto area for suppliers invoices
|
||||
else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
|
||||
// Auto area for products
|
||||
@ -198,6 +190,8 @@ if ($type == 'directory')
|
||||
$param.='&module='.$module;
|
||||
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
|
||||
|
||||
if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
|
||||
|
||||
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
|
||||
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_services_contracts.php
|
||||
* \ingroup produits,services
|
||||
* \brief Module de generation de l'affichage de la box services_vendus
|
||||
* \brief Widget of sells products
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
@ -124,7 +124,7 @@ class box_services_contracts extends ModeleBoxes
|
||||
$thirdpartytmp->id = $objp->socid;
|
||||
|
||||
// Multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on
|
||||
{
|
||||
$sqld = "SELECT label";
|
||||
$sqld.= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
|
||||
@ -255,14 +255,14 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
$out.= $s;
|
||||
}
|
||||
$out.= '</td>';
|
||||
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$sublink='';
|
||||
if (! empty($head['sublink'])) $sublink.= '<a href="'.$head['sublink'].'"'.(empty($head['target'])?' target="_blank"':'').'>';
|
||||
if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"');
|
||||
if (! empty($head['sublink'])) $sublink.= '</a>';
|
||||
|
||||
|
||||
$out.= '<td class="nocellnopadd boxclose right nowraponall">';
|
||||
$out.=$sublink;
|
||||
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
|
||||
@ -273,7 +273,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
$out.= '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';
|
||||
$out.= '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
$out.= "</tr>\n";
|
||||
}
|
||||
|
||||
@ -285,10 +285,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
{
|
||||
if (isset($contents[$i]))
|
||||
{
|
||||
|
||||
|
||||
// TR
|
||||
if (isset($contents[$i][0]['tr'])) $out.= '<tr valign="top" '.$contents[$i][0]['tr'].'>';
|
||||
if (isset($contents[$i][0]['tr'])) $out.= '<tr class="tdtop" '.$contents[$i][0]['tr'].'>';
|
||||
else $out.= '<tr class="oddeven">';
|
||||
|
||||
// Loop on each TD
|
||||
|
||||
@ -1486,7 +1486,7 @@ abstract class CommonObject
|
||||
$fieldname = 'multicurrency_code';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"';
|
||||
$sql .= ' SET '.$fieldname." = '".$this->db->escape($code)."'";
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@ -3510,7 +3510,7 @@ abstract class CommonObject
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->thirdparty->default_lang; // For language to language of customer
|
||||
if (! empty($newlang))
|
||||
{
|
||||
|
||||
@ -488,8 +488,8 @@ class Conf
|
||||
// By default, we propagate contacts
|
||||
if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
|
||||
|
||||
// By default, we use the zip town autofill
|
||||
if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=1;
|
||||
// By default, we do not use the zip town table but the table of third parties
|
||||
if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=0;
|
||||
|
||||
// By default, we open card if one found
|
||||
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;
|
||||
|
||||
@ -995,7 +995,7 @@ class Form
|
||||
unset($societetmp);
|
||||
}
|
||||
// mode 1
|
||||
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter;
|
||||
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:'');
|
||||
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
|
||||
$out.='<style type="text/css">
|
||||
.ui-autocomplete {
|
||||
@ -3463,7 +3463,7 @@ class Form
|
||||
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
|
||||
}
|
||||
|
||||
$output = '<select class="flat" name="'.$htmlname.'">';
|
||||
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$outarray=array();
|
||||
if (is_array($cate_arbo))
|
||||
{
|
||||
@ -4475,7 +4475,7 @@ class Form
|
||||
* Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle.
|
||||
* Sinon la TVA proposee par defaut=0. Fin de regle.
|
||||
* @param bool $options_only Return HTML options lines only (for ajax treatment)
|
||||
* @param int $mode 1=Add code into key in select list
|
||||
* @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key
|
||||
* @return string
|
||||
*/
|
||||
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0)
|
||||
|
||||
@ -266,7 +266,7 @@ class FormAccounting extends Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
|
||||
@ -690,6 +690,7 @@ class FormFile
|
||||
{
|
||||
$headershown=1;
|
||||
$out.= '<div class="titre">'.$titletoshow.'</div>'."\n";
|
||||
$out.= '<div class="div-table-responsive-no-min">';
|
||||
$out.= '<table class="noborder" summary="listofdocumentstable" id="'.$modulepart.'_table" width="100%">'."\n";
|
||||
}
|
||||
|
||||
@ -1001,6 +1002,7 @@ class FormFile
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n";
|
||||
|
||||
@ -1105,8 +1107,6 @@ class FormFile
|
||||
&& $file['name'] != '..'
|
||||
&& ! preg_match('/\.meta$/i',$file['name']))
|
||||
{
|
||||
|
||||
|
||||
if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid'];
|
||||
|
||||
$editline=0;
|
||||
|
||||
@ -528,7 +528,12 @@ class FormMail extends Form
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$out.= $form->multiselectarray("receiver", $tmparray, GETPOST("receiver"), null, null, 'inline-block minwidth500', null, "");
|
||||
$withtoselected=GETPOST("receiver"); // Array of selected value
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
|
||||
{
|
||||
$withtoselected = array_keys($tmparray);
|
||||
}
|
||||
$out.= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
@ -556,7 +561,8 @@ class FormMail extends Form
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$out.= $form->multiselectarray("receivercc", $tmparray, GETPOST("receivercc"), null, null, 'inline-block minwidth500',null, "");
|
||||
$withtoccselected=GETPOST("receivercc"); // Array of selected value
|
||||
$out.= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500',null, "");
|
||||
}
|
||||
}
|
||||
$out.= "</td></tr>\n";
|
||||
@ -584,8 +590,8 @@ class FormMail extends Form
|
||||
{
|
||||
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
//$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
|
||||
$out.= $form->multiselectarray("receiverccc", $tmparray, GETPOST("receiverccc"), null, null, null,null, "90%");
|
||||
$withtocccselected=GETPOST("receiverccc"); // Array of selected value
|
||||
$out.= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, null, null, null,null, "90%");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ class Menu
|
||||
/**
|
||||
* Add a menu entry into this->liste (at end)
|
||||
*
|
||||
* @param string $url Url to follow on click
|
||||
* @param string $url Url to follow on click (does not include DOL_URL_ROOT)
|
||||
* @param string $titre Label of menu to add
|
||||
* @param integer $level Level of menu to add
|
||||
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
|
||||
@ -59,11 +59,14 @@ class Menu
|
||||
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
||||
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
|
||||
* @param int $position Position (not used yet)
|
||||
* @param string $id Id
|
||||
* @param string $idsel Id sel
|
||||
* @param string $classname Class name
|
||||
* @return void
|
||||
*/
|
||||
function add($url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0)
|
||||
function add($url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0, $id='', $idsel='', $classname='')
|
||||
{
|
||||
$this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position);
|
||||
$this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,12 +81,15 @@ class Menu
|
||||
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
||||
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
|
||||
* @param int $position Position (not used yet)
|
||||
* @param string $id Id
|
||||
* @param string $idsel Id sel
|
||||
* @param string $classname Class name
|
||||
* @return void
|
||||
*/
|
||||
function insert($idafter, $url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0)
|
||||
function insert($idafter, $url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0, $id='', $idsel='', $classname='')
|
||||
{
|
||||
$array_start = array_slice($this->liste,0,($idafter+1));
|
||||
$array_new = array(0=>array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu,'position'=>$position));
|
||||
$array_new = array(0=>array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu,'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname));
|
||||
$array_end = array_slice($this->liste,($idafter+1));
|
||||
$this->liste=array_merge($array_start,$array_new,$array_end);
|
||||
}
|
||||
@ -100,7 +106,7 @@ class Menu
|
||||
|
||||
/**
|
||||
* Return number of visible entries (gray or not)
|
||||
*
|
||||
*
|
||||
* @return int Number of visible (gray or not) menu entries
|
||||
*/
|
||||
function getNbOfVisibleMenuEntries()
|
||||
|
||||
@ -602,7 +602,7 @@ class Menubase
|
||||
//$tabMenu[$b]['langs'] = $menu['langs'];
|
||||
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
|
||||
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
|
||||
$tabMenu[$b]['position'] = $menu['position'];
|
||||
$tabMenu[$b]['position'] = (int) $menu['position'];
|
||||
|
||||
$b++;
|
||||
}
|
||||
|
||||
@ -93,6 +93,16 @@ print '
|
||||
background-position-y: 16px;
|
||||
padding: 1em 15px 1em 40px;
|
||||
}
|
||||
li.lilevel0 font.vsmenudisabled {
|
||||
/* background-image: url(/dolibarr_dev/htdocs/theme/eldy/img/next.png) !important; */
|
||||
background-repeat: no-repeat !important;
|
||||
background-position-x: 10px;
|
||||
background-position-y: 16px;
|
||||
padding: 1em 15px 1em 40px;
|
||||
background: #f8f8f8;
|
||||
display: block;
|
||||
font-size: 16px !important;
|
||||
}
|
||||
li.lilevel1 {
|
||||
padding: 1em 15px 0.5em 40px;
|
||||
border-top: 1px solid #aaa;
|
||||
@ -184,7 +194,7 @@ if (! class_exists('MenuManager'))
|
||||
}
|
||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||
$menumanager->loadMenu('all','all');
|
||||
//var_dump($menumanager->tabMenu);exit;
|
||||
//var_dump($menumanager);exit;
|
||||
$menumanager->showmenu('jmobile');
|
||||
|
||||
print '</body>';
|
||||
|
||||
@ -85,7 +85,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
|
||||
$formresource=new FormResource($db);
|
||||
|
||||
|
||||
// Resource
|
||||
print '<tr>';
|
||||
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
|
||||
@ -94,7 +94,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
print $formresource->select_resource_list($resourceid, "resourceid", '', 1, 0, 0, null, '', 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
|
||||
@ -251,7 +251,7 @@ function show_array_actions_to_do($max=5)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -347,7 +347,7 @@ function show_array_last_actions_done($max=5)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -458,7 +458,7 @@ function actions_prepare_head($object)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
|
||||
$resource=new DolResource($db);
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
|
||||
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
|
||||
$nbResources=count($listofresourcelinked);
|
||||
@ -506,6 +506,11 @@ function calendars_prepare_head($param)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewList");
|
||||
$head[$h][2] = 'cardlist';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewDay");
|
||||
$head[$h][2] = 'cardday';
|
||||
@ -529,16 +534,12 @@ function calendars_prepare_head($param)
|
||||
$head[$h][2] = 'cardpertype';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewPerUser");
|
||||
$head[$h][2] = 'cardperuser';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewList");
|
||||
$head[$h][2] = 'cardlist';
|
||||
$h++;
|
||||
|
||||
$object=new stdClass();
|
||||
|
||||
|
||||
@ -37,9 +37,9 @@
|
||||
* @param int $autoselect Automatic selection if just one value
|
||||
* @param array $ajaxoptions Multiple options array
|
||||
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
|
||||
* Ex: array('disabled'=>
|
||||
* Ex: array('show'=>
|
||||
* Ex: array('update_textarea'=>
|
||||
* Ex: array('disabled'=> )
|
||||
* Ex: array('show'=> )
|
||||
* Ex: array('update_textarea'=> )
|
||||
* @return string Script
|
||||
*/
|
||||
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
|
||||
@ -181,12 +181,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
|
||||
});
|
||||
}
|
||||
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
|
||||
|
||||
|
||||
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
|
||||
}
|
||||
,delay: 500
|
||||
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
|
||||
|
||||
|
||||
return $("<li>")
|
||||
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
|
||||
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )
|
||||
@ -352,8 +352,8 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
|
||||
/**
|
||||
* Make content of an input box selected when we click into input field.
|
||||
*
|
||||
* @param string $htmlname Id of html object
|
||||
*
|
||||
* @param string $htmlname Id of html object
|
||||
* @param string $addlink Add a 'link to' after
|
||||
*/
|
||||
function ajax_autoselect($htmlname, $addlink='')
|
||||
@ -383,7 +383,7 @@ function ajax_autoselect($htmlname, $addlink='')
|
||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
|
||||
if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
|
||||
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
|
||||
@ -392,13 +392,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
||||
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
|
||||
|
||||
$tmpplugin='select2';
|
||||
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
|
||||
dir: \'ltr\',
|
||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
||||
minimumInputLength: '.$minLengthToAutocomplete.'
|
||||
minimumInputLength: '.$minLengthToAutocomplete.'
|
||||
})';
|
||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||
$msg.= ';'."\n";
|
||||
|
||||
@ -162,7 +162,7 @@ function societe_prepare_head(Societe $object)
|
||||
$head[$h][2] = 'rib';
|
||||
$h++;
|
||||
}
|
||||
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
@ -217,7 +217,7 @@ function societe_prepare_head(Societe $object)
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
@ -234,7 +234,7 @@ function societe_prepare_head(Societe $object)
|
||||
}
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
|
||||
// Log
|
||||
/*$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
@ -334,7 +334,7 @@ function getCountry($searchkey,$withcode='',$dbtouse=0,$outputlangs='',$entconv=
|
||||
global $db,$langs;
|
||||
|
||||
$result='';
|
||||
|
||||
|
||||
// Check parameters
|
||||
if (empty($searchkey) && empty($searchlabel))
|
||||
{
|
||||
@ -421,23 +421,28 @@ function getState($id,$withcode='',$dbtouse=0)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le nom traduit ou code+nom d'une devise
|
||||
* Return label of currency or code+label
|
||||
*
|
||||
* @param string $code_iso Code iso de la devise
|
||||
* @param int $withcode '1'=affiche code + nom
|
||||
* @return string Nom traduit de la devise
|
||||
* @param string $code_iso Code iso of currency
|
||||
* @param int $withcode '1'=show code + label
|
||||
* @param Translate $outputlangs Output language
|
||||
* @return string Label translated of currency
|
||||
*/
|
||||
function currency_name($code_iso,$withcode='')
|
||||
function currency_name($code_iso, $withcode='', $outputlangs=null)
|
||||
{
|
||||
global $langs,$db;
|
||||
|
||||
// Si il existe une traduction, on peut renvoyer de suite le libelle
|
||||
if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso)
|
||||
if (empty($outputlangs)) $outputlangs=$langs;
|
||||
|
||||
$outputlangs->load("dict");
|
||||
|
||||
// If there is a translation, we can send immediatly the label
|
||||
if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso)
|
||||
{
|
||||
return $langs->trans("Currency".$code_iso);
|
||||
return ($withcode?$code_iso.' - ':'').$outputlangs->trans("Currency".$code_iso);
|
||||
}
|
||||
|
||||
// Si pas de traduction, on consulte le libelle par defaut en table
|
||||
// If no translation, we read table to get label by default
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$sql.= " WHERE code_iso='".$code_iso."'";
|
||||
|
||||
@ -457,8 +462,8 @@ function currency_name($code_iso,$withcode='')
|
||||
{
|
||||
return $code_iso;
|
||||
}
|
||||
|
||||
}
|
||||
return 'ErrorWhenReadingCurrencyLabel';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -499,7 +504,7 @@ function getFormeJuridiqueLabel($code)
|
||||
/**
|
||||
* Return if a country is inside the EEC (European Economic Community)
|
||||
* TODO Add a field into country dictionary.
|
||||
*
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @return boolean true = country inside EEC, false = country outside EEC
|
||||
*/
|
||||
@ -649,7 +654,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
// Opp percent
|
||||
print '<td align="right">';
|
||||
if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%';
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
// Status
|
||||
print '<td align="right">'.$projecttmp->getLibStatut(5).'</td>';
|
||||
|
||||
@ -671,7 +676,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
@ -735,7 +740,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
$param="socid=".$object->id;
|
||||
@ -777,44 +782,44 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
|
||||
// Photo - Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Position
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Address - Phone - Email
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
||||
|
||||
// Status
|
||||
print '<td class="liste_titre maxwidthonsmartphone">';
|
||||
print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Add to agenda
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
|
||||
{
|
||||
$colspan++;
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
|
||||
// Edit
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
|
||||
|
||||
$i=0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
$contactstatic->id = $obj->rowid;
|
||||
$contactstatic->ref = $obj->ref;
|
||||
$contactstatic->statut = $obj->statut;
|
||||
@ -838,7 +843,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
$contactstatic->country_code = $country_code;
|
||||
|
||||
$contactstatic->setGenderFromCivility();
|
||||
|
||||
|
||||
print "<tr>";
|
||||
|
||||
// Photo - Name
|
||||
@ -846,7 +851,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
||||
print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1);
|
||||
print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage));
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Job position
|
||||
print '<td>';
|
||||
if ($obj->poste) print $obj->poste;
|
||||
@ -1036,7 +1041,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
global $form;
|
||||
|
||||
global $param;
|
||||
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($filterobj)) dol_print_error('','BadParameter');
|
||||
|
||||
@ -1068,7 +1073,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda').")";
|
||||
if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
|
||||
if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
|
||||
if (get_class($filterobj) == 'Adherent')
|
||||
if (get_class($filterobj) == 'Adherent')
|
||||
{
|
||||
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
@ -1086,7 +1091,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
@ -1114,7 +1119,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
|
||||
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
$tododone='';
|
||||
@ -1128,7 +1133,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
'dateend'=>$db->jdate($obj->dp2),
|
||||
'note'=>$obj->label,
|
||||
'percent'=>$obj->percent,
|
||||
|
||||
|
||||
'userid'=>$obj->user_id,
|
||||
'login'=>$obj->user_login,
|
||||
'userfirstname'=>$obj->user_firstname,
|
||||
@ -1146,7 +1151,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
'libelle'=>$obj->alabel, // deprecated
|
||||
'apicto'=>$obj->apicto
|
||||
);
|
||||
|
||||
|
||||
$numaction++;
|
||||
$i++;
|
||||
}
|
||||
@ -1191,7 +1196,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
'note'=>$obj->note,
|
||||
'percent'=>$obj->percentage,
|
||||
'acode'=>$obj->acode,
|
||||
|
||||
|
||||
'userid'=>$obj->user_id,
|
||||
'login'=>$obj->user_login,
|
||||
'userfirstname'=>$obj->user_firstname,
|
||||
@ -1213,7 +1218,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email)))
|
||||
{
|
||||
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -1222,7 +1227,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
|
||||
|
||||
$actionstatic=new ActionComm($db);
|
||||
$userstatic=new User($db);
|
||||
$contactstatic = new Contact($db);
|
||||
@ -1243,9 +1248,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$out.='<input type="hidden" name="id" value="'.$filterobj->id.'" />';
|
||||
}
|
||||
if (get_class($filterobj) == 'Societe') $out.='<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
|
||||
|
||||
|
||||
$out.="\n";
|
||||
|
||||
|
||||
$out.='<div class="div-table-responsive-no-min">';
|
||||
$out.='<table class="noborder" width="100%">';
|
||||
|
||||
@ -1270,7 +1275,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$out.=$searchpicto;
|
||||
$out.='</td>';
|
||||
$out.='</tr>';
|
||||
|
||||
|
||||
$out.='<tr class="liste_titre">';
|
||||
if ($donetodo)
|
||||
{
|
||||
@ -1293,26 +1298,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
$out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
$out.='</tr>';
|
||||
|
||||
|
||||
foreach ($histo as $key=>$value)
|
||||
{
|
||||
|
||||
|
||||
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
|
||||
|
||||
$out.="<tr ".$bc[$var].">";
|
||||
|
||||
|
||||
// Done or todo
|
||||
if ($donetodo)
|
||||
{
|
||||
$out.='<td class="nowrap">';
|
||||
$out.='</td>';
|
||||
}
|
||||
|
||||
|
||||
// Ref
|
||||
$out.='<td class="nowrap">';
|
||||
$out.=$actionstatic->getNomUrl(1, -1);
|
||||
$out.='</td>';
|
||||
|
||||
|
||||
// Author of event
|
||||
$out.='<td>';
|
||||
//$userstatic->id=$histo[$key]['userid'];
|
||||
@ -1321,7 +1326,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$userstatic->fetch($histo[$key]['userid']);
|
||||
$out.=$userstatic->getNomUrl(-1);
|
||||
$out.='</td>';
|
||||
|
||||
|
||||
// Title
|
||||
$out.='<td>';
|
||||
if (isset($histo[$key]['type']) && $histo[$key]['type']=='action')
|
||||
@ -1360,7 +1365,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && ! $histo[$key]['dateend'] && $histo[$key]['datestart'] && $db->jdate($histo[$key]['datestart']) < ($now - $delay_warning)) $late=1;
|
||||
if ($late) $out.=img_warning($langs->trans("Late")).' ';
|
||||
$out.="</td>\n";
|
||||
|
||||
|
||||
// Type
|
||||
$out.='<td>';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
@ -1375,7 +1380,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
else {
|
||||
$typelabel = $actionstatic->type;
|
||||
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
|
||||
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
|
||||
$out.=$typelabel;
|
||||
}
|
||||
$out.='</td>';
|
||||
@ -1445,7 +1450,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
|
||||
// Actions
|
||||
$out.='<td></td>';
|
||||
|
||||
|
||||
$out.="</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
@ -1454,7 +1459,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
}
|
||||
|
||||
$out.='</form>';
|
||||
|
||||
|
||||
if ($noprint) return $out;
|
||||
else print $out;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ function dol_shutdown()
|
||||
* @param string $check Type of check
|
||||
* ''=no check (deprecated)
|
||||
* 'none'=no check (only for param that should have very rich content)
|
||||
* 'int'=check it's numeric
|
||||
* 'int'=check it's numeric (integer or float)
|
||||
* 'alpha'=check it's text and sign
|
||||
* 'aZ'=check it's a-z only
|
||||
* 'aZ09'=check it's simple alpha string (recommended for keys)
|
||||
@ -749,7 +749,8 @@ function dol_string_unaccent($str)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string from all punctuation characters to use it as a ref or login
|
||||
* Clean a string from all punctuation characters to use it as a ref or login.
|
||||
* This is a more complete function than dol_sanitizeFileName.
|
||||
*
|
||||
* @param string $str String to clean
|
||||
* @param string $newstr String to replace forbidden chars with
|
||||
@ -760,7 +761,7 @@ function dol_string_unaccent($str)
|
||||
*/
|
||||
function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='')
|
||||
{
|
||||
$forbidden_chars_to_replace=array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=");
|
||||
$forbidden_chars_to_replace=array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
|
||||
$forbidden_chars_to_remove=array();
|
||||
if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace;
|
||||
//$forbidden_chars_to_remove=array("(",")");
|
||||
@ -3458,7 +3459,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
|
||||
* @param string $titre Title to show (required)
|
||||
* @param int $page Numero of page to show in navigation links (required)
|
||||
* @param string $file Url of page (required)
|
||||
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder)
|
||||
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function.
|
||||
* @param string $sortfield Field to sort on ('' by default)
|
||||
* @param string $sortorder Order to sort ('' by default)
|
||||
* @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
|
||||
@ -4162,7 +4163,7 @@ function getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
|
||||
* @param Societe $buyer Company object
|
||||
* @param Societe $seller Company object
|
||||
* @param int $firstparamisid 1 if first param is id into table (use this if you can)
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
|
||||
* @see getTaxesFromId
|
||||
*/
|
||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
|
||||
@ -4200,22 +4201,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
{
|
||||
if (! isOnlyOneLocalTax(1))
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
elseif ($local == 2)
|
||||
{
|
||||
if (! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -4224,22 +4225,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
{
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(! isOnlyOneLocalTax(2))
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy);
|
||||
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6094,13 +6095,13 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
|
||||
/**
|
||||
* Set focus onto field with selector
|
||||
*
|
||||
* @param string $selector Selector ('#id') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
|
||||
* @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
|
||||
* @return string HTML code to set focus
|
||||
*/
|
||||
function dol_set_focus($selector)
|
||||
{
|
||||
print "\n".'<!-- Set focus onto a specific field -->'."\n";
|
||||
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.$selector.'").focus(); });</script>'."\n";
|
||||
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2121,8 +2121,8 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
|
||||
* Applies the Cartesian product algorithm to an array
|
||||
* Source: http://stackoverflow.com/a/15973172
|
||||
*
|
||||
* @param array $input Array of products
|
||||
* @return array Array of combinations
|
||||
* @param array $input Array of products
|
||||
* @return array Array of combinations
|
||||
*/
|
||||
function cartesianArray(array $input) {
|
||||
// filter out empty values
|
||||
@ -2145,3 +2145,70 @@ function cartesianArray(array $input) {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get name of directory where the api_...class.php file is stored
|
||||
*
|
||||
* @param string $module Module name
|
||||
* @return string Directory name
|
||||
*/
|
||||
function getModuleDirForApiClass($module)
|
||||
{
|
||||
$moduledirforclass=$module;
|
||||
|
||||
if (in_array($module, array('login', 'access', 'status', 'documents'))) {
|
||||
$moduledirforclass = 'api';
|
||||
}
|
||||
if (preg_match('/^dictionary/', $module)) {
|
||||
$moduledirforclass = 'api';
|
||||
}
|
||||
|
||||
if ($module == 'contact' || $module == 'contacts' || $module == 'customer' || $module == 'thirdparty' || $module == 'thirdparties') {
|
||||
$moduledirforclass = 'societe';
|
||||
}
|
||||
if ($module == 'propale' || $module == 'proposals') {
|
||||
$moduledirforclass = 'comm/propal';
|
||||
}
|
||||
elseif ($module == 'agenda' || $module == 'agendaevents') {
|
||||
$moduledirforclass = 'comm/action';
|
||||
}
|
||||
elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') {
|
||||
$moduledirforclass = 'adherents';
|
||||
}
|
||||
elseif ($module == 'banque' || $module == 'bankaccounts') {
|
||||
$moduledirforclass = 'compta/bank';
|
||||
}
|
||||
elseif ($module == 'category' || $module == 'categorie') {
|
||||
$moduledirforclass = 'categories';
|
||||
}
|
||||
elseif ($module == 'order' || $module == 'orders') {
|
||||
$moduledirforclass = 'commande';
|
||||
}
|
||||
elseif ($module == 'facture' || $module == 'invoice' || $module == 'invoices') {
|
||||
$moduledirforclass = 'compta/facture';
|
||||
}
|
||||
elseif ($module == 'products') {
|
||||
$moduledirforclass = 'product';
|
||||
}
|
||||
elseif ($module == 'project' || $module == 'projects' || $module == 'tasks') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'task') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'stock' || $module == 'stockmovements' || $module == 'warehouses') {
|
||||
$moduledirforclass = 'product/stock';
|
||||
}
|
||||
elseif ($module == 'fournisseur' || $module == 'supplierinvoices') {
|
||||
$moduledirforclass = 'fourn';
|
||||
}
|
||||
elseif ($module == 'expensereports') {
|
||||
$moduledirforclass = 'expensereport';
|
||||
}
|
||||
elseif ($module == 'users') {
|
||||
$moduledirforclass = 'user';
|
||||
}
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
@ -1068,10 +1068,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
// Show page nb only on iso languages (so default Helvetica font)
|
||||
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
|
||||
{
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy);
|
||||
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
|
||||
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
|
||||
else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
|
||||
else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
|
||||
}
|
||||
|
||||
return $marginwithfooter;
|
||||
|
||||
@ -212,6 +212,7 @@ 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', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
|
||||
-- Setup
|
||||
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', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->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, 10, __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, 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', 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, 30, __ENTITY__);
|
||||
@ -221,6 +222,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', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __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', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __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', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__);
|
||||
-- Accounting period
|
||||
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" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
|
||||
-- Binding
|
||||
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', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 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 && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
|
||||
@ -246,8 +249,6 @@ 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=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__);
|
||||
-- Accounting period
|
||||
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', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'FiscalPeriod', 1, 'admin', '', '', 2, 4, __ENTITY__);
|
||||
-- Rapports compta simple
|
||||
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', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __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->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||
|
||||
@ -62,10 +62,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
||||
$classname = 'class="tmenu menuhider"';
|
||||
$idsel='menu';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry_auguria('', 1, '#', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry_auguria($showmode);
|
||||
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
|
||||
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
$num = count($newTabMenu);
|
||||
@ -84,10 +81,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
||||
$url = $shorturl = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:'');
|
||||
|
||||
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
|
||||
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
|
||||
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
|
||||
{
|
||||
$param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu=';
|
||||
$param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
}
|
||||
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
|
||||
{
|
||||
@ -95,7 +92,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
||||
}
|
||||
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
//$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
$shorturl = $url;
|
||||
|
||||
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
||||
}
|
||||
|
||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
||||
@ -118,10 +118,18 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
||||
}
|
||||
else if ($showmode == 2) $classname='class="tmenu"';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry_auguria($showmode);
|
||||
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), '');
|
||||
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu']?$newTabMenu[$i]['leftmenu']:''), $newTabMenu[$i]['position'], $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Sort on position
|
||||
$menu->liste = dol_sort_array($menu->liste, 'position');
|
||||
|
||||
// Output menu entries
|
||||
foreach($menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
|
||||
if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']);
|
||||
}
|
||||
|
||||
$showmode=1;
|
||||
@ -293,6 +301,16 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
print "<!-- End SearchForm -->\n";
|
||||
}
|
||||
|
||||
if (is_array($moredata) && ! empty($moredata['bookmarks']))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Begin Bookmarks -->\n";
|
||||
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
||||
print $moredata['bookmarks'];
|
||||
print '</div>'."\n";
|
||||
print "<!-- End Bookmarks -->\n";
|
||||
}
|
||||
|
||||
// We update newmenu with entries found into database
|
||||
$menuArbo = new Menubase($db,'auguria');
|
||||
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
|
||||
@ -556,16 +574,6 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
||||
if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block
|
||||
}
|
||||
|
||||
if (is_array($moredata) && ! empty($moredata['bookmarks']))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Begin Bookmarks -->\n";
|
||||
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
||||
print $moredata['bookmarks'];
|
||||
print '</div>'."\n";
|
||||
print "<!-- End Bookmarks -->\n";
|
||||
}
|
||||
|
||||
return count($menu_array);
|
||||
}
|
||||
|
||||
|
||||
@ -60,10 +60,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
$classname = 'class="tmenu menuhider"';
|
||||
$idsel='menu';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
|
||||
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Home
|
||||
@ -73,10 +70,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='home';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/index.php?mainmenu=home&leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '');
|
||||
$menu->add('/index.php?mainmenu=home&leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
|
||||
|
||||
// Third parties
|
||||
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
|
||||
@ -91,10 +85,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='companies';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/societe/index.php?mainmenu=companies&leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '');
|
||||
$menu->add('/societe/index.php?mainmenu=companies&leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '', 20, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Products-Services
|
||||
@ -120,10 +111,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
$chaine.=$langs->trans("TMenuServices");
|
||||
}
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", '');
|
||||
$menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Commercial
|
||||
@ -147,10 +135,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='commercial';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "");
|
||||
$menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Financial
|
||||
@ -177,10 +162,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='accountancy';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/compta/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '');
|
||||
$menu->add('/compta/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '', 50, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Bank
|
||||
@ -198,10 +180,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='bank';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/compta/bank/index.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '');
|
||||
$menu->add('/compta/bank/index.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Projects
|
||||
@ -218,10 +197,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='project';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '');
|
||||
$menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '', 70, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// HRM
|
||||
@ -238,10 +214,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='hrm';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/hrm/index.php?mainmenu=hrm&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/hrm/index.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
|
||||
$menu->add('/hrm/index.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
|
||||
@ -260,10 +233,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='tools';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("TMenuTools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
|
||||
$menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Members
|
||||
@ -278,10 +248,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
else $classname = 'class="tmenu"';
|
||||
$idsel='members';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '');
|
||||
$menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
|
||||
@ -297,6 +264,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||
if ($showmode == 1)
|
||||
{
|
||||
// url = url from host, shorturl = relative path into dolibarr sources
|
||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
{
|
||||
@ -307,7 +275,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
|
||||
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
|
||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
//$shorturl = $shorturl.($param?'?'.$param:'');
|
||||
$shorturl = $url;
|
||||
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
||||
}
|
||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
||||
@ -321,10 +291,18 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
}
|
||||
else if ($showmode == 2) $classname='class="tmenu"';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), '');
|
||||
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu']?$newTabMenu[$i]['leftmenu']:''), $newTabMenu[$i]['position'], $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
// Sort on position
|
||||
$menu->liste = dol_sort_array($menu->liste, 'position');
|
||||
|
||||
// Output menu entries
|
||||
foreach($menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
|
||||
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry($menuval['enabled']);
|
||||
}
|
||||
|
||||
$showmode=1;
|
||||
@ -978,7 +956,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
|
||||
}*/
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60);
|
||||
|
||||
// Fiscal year
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
|
||||
}
|
||||
|
||||
// Binding
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
|
||||
@ -1102,12 +1086,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
|
||||
|
||||
// Fiscal year
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_periods", $langs->trans("FiscalPeriod"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
|
||||
}
|
||||
}
|
||||
|
||||
// Accountancy (simple)
|
||||
@ -1605,7 +1583,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$url = $shorturl = $tmp[0];
|
||||
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
|
||||
|
||||
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined.
|
||||
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
|
||||
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
|
||||
{
|
||||
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
|
||||
|
||||
@ -76,39 +76,47 @@ class MenuManager
|
||||
$res='ErrorBadParameterForMode';
|
||||
|
||||
$noout=0;
|
||||
if ($mode == 'jmobile') $noout=1;
|
||||
//if ($mode == 'jmobile') $noout=1;
|
||||
|
||||
if ($mode == 'topnb')
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($mode == 'top' || $mode == 'jmobile')
|
||||
if ($mode == 'top')
|
||||
{
|
||||
if (empty($noout)) print_start_menu_array_empty();
|
||||
|
||||
// Home
|
||||
$showmode=1;
|
||||
$idsel='home';
|
||||
$classname='class="tmenusel"';
|
||||
$usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
|
||||
|
||||
// Show/Hide vertical menu
|
||||
if ($mode != 'jmobile' && $mode != 'topnb' && (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$showmode=1;
|
||||
$classname = 'class="tmenu menuhider"';
|
||||
$idsel='menu';
|
||||
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
|
||||
$this->menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
|
||||
}
|
||||
|
||||
if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode);
|
||||
if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu=', $id, $idsel, $classname, $this->atarget);
|
||||
if (empty($noout)) print_end_menu_entry_empty($showmode);
|
||||
$this->menu->add(dol_buildpath('/index.php',1), $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '');
|
||||
// Home
|
||||
$showmode=1;
|
||||
$classname='class="tmenusel"';
|
||||
$idsel='home';
|
||||
|
||||
$this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
|
||||
|
||||
|
||||
// Sort on position
|
||||
$this->menu->liste = dol_sort_array($this->menu->liste, 'position');
|
||||
|
||||
// Output menu entries
|
||||
foreach($this->menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) print_start_menu_entry_empty($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
|
||||
if (empty($noout)) print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
|
||||
if (empty($noout)) print_end_menu_entry_empty($menuval['enabled']);
|
||||
}
|
||||
|
||||
$showmode=1;
|
||||
if (empty($noout)) print_start_menu_entry_empty('','class="tmenuend"',$showmode);
|
||||
@ -123,7 +131,195 @@ class MenuManager
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'left' || $mode == 'jmobile')
|
||||
if ($mode == 'jmobile') // Used to get menu in xml ul/li
|
||||
{
|
||||
// Home
|
||||
$showmode=1;
|
||||
$classname='class="tmenusel"';
|
||||
$idsel='home';
|
||||
|
||||
$this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
|
||||
|
||||
|
||||
// $this->menu->liste is top menu
|
||||
//var_dump($this->menu->liste);exit;
|
||||
$lastlevel = array();
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
if ($val['enabled'] == 1)
|
||||
{
|
||||
$relurl=dol_buildpath($val['url'],1);
|
||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
||||
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
||||
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// Add font-awesome
|
||||
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
|
||||
|
||||
print $val['titre'];
|
||||
print '</a>'."\n";
|
||||
|
||||
// Search submenu fot this mainmenu entry
|
||||
$tmpmainmenu=$val['mainmenu'];
|
||||
$tmpleftmenu='all';
|
||||
$submenu=new Menu();
|
||||
|
||||
$langs->load("admin"); // Load translation file admin.lang
|
||||
$submenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
|
||||
$submenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
|
||||
$submenu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
||||
$submenu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
||||
$submenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
||||
$submenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
|
||||
$submenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
|
||||
|
||||
$submenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
||||
$submenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
||||
$submenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
|
||||
$submenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||
$submenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
||||
$submenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||
$submenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||
$submenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
|
||||
$submenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||
|
||||
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
|
||||
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
|
||||
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
|
||||
|
||||
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
|
||||
$canonnexturl=preg_replace('/\?.*$/','',$nexturl);
|
||||
//var_dump($canonrelurl);
|
||||
//var_dump($canonnexturl);
|
||||
print '<ul>'."\n";
|
||||
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|
||||
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
|
||||
{
|
||||
// We add sub entry
|
||||
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
}
|
||||
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
print '</a>';
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
if ($val['level']==0)
|
||||
{
|
||||
if ($val['enabled'])
|
||||
{
|
||||
$lastlevel[0]='enabled';
|
||||
}
|
||||
else if ($showmenu) // Not enabled but visible (so greyed)
|
||||
{
|
||||
$lastlevel[0]='greyed';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastlevel[0]='hidden';
|
||||
}
|
||||
}
|
||||
|
||||
$lastlevel2 = array();
|
||||
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
$showmenu=true;
|
||||
if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu=false;
|
||||
|
||||
// If at least one parent is not enabled, we do not show any menu of all children
|
||||
if ($val2['level'] > 0)
|
||||
{
|
||||
$levelcursor = $val2['level']-1;
|
||||
while ($levelcursor >= 0)
|
||||
{
|
||||
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu=false;
|
||||
$levelcursor--;
|
||||
}
|
||||
}
|
||||
|
||||
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
||||
{
|
||||
$relurl2=dol_buildpath($val2['url'],1);
|
||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
||||
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
||||
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
||||
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
||||
|
||||
$disabled='';
|
||||
if (! $val2['enabled'])
|
||||
{
|
||||
$disabled=" vsmenudisabled";
|
||||
}
|
||||
|
||||
print str_pad('',$val2['level']+1);
|
||||
print '<li class="lilevel'.($val2['level']+1);
|
||||
if ($val2['level']==0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
|
||||
print $disabled.'">'; // ui-btn to highlight on clic
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
print '<a href="'.$relurl2.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
$lastlevel2[$val2['level']]='enabled';
|
||||
}
|
||||
else // Not allowed but visible (greyed)
|
||||
{
|
||||
print '<a href="#" class="vsmenudisabled">';
|
||||
$lastlevel2[$val2['level']]='greyed';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
$lastlevel2[$val2['level']]='enabled';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lastlevel2[$val2['level']]='greyed';
|
||||
}
|
||||
}
|
||||
//var_dump($val2['level']);
|
||||
//var_dump($lastlevel2);
|
||||
print $val2['titre'];
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
print '</a>';
|
||||
else
|
||||
print '</a>';
|
||||
}
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
}
|
||||
if ($val['enabled'] == 2)
|
||||
{
|
||||
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
|
||||
}
|
||||
print '</li>';
|
||||
print '</ul>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'left')
|
||||
{
|
||||
// Put here left menu entries
|
||||
// ***** START *****
|
||||
@ -134,8 +330,10 @@ class MenuManager
|
||||
$this->menu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
||||
$this->menu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
||||
$this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
||||
$this->menu->add("/admin/fiscalyear.php", $langs->trans("Fiscalyear"),1);
|
||||
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
||||
$this->menu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
|
||||
$this->menu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
|
||||
|
||||
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
||||
$this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
||||
$this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
|
||||
$this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||
@ -143,7 +341,6 @@ class MenuManager
|
||||
$this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||
$this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||
$this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
|
||||
if (! empty($conf->accounting->enabled)) $this->menu->add("/accountancy/admin/account.php", $langs->trans("Chartofaccounts"),1);
|
||||
$this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||
|
||||
// ***** END *****
|
||||
@ -170,15 +367,15 @@ class MenuManager
|
||||
$lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
|
||||
if (($alt%2==0))
|
||||
{
|
||||
print '<div class="blockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Place tabulation
|
||||
// Add tabulation
|
||||
$tabstring='';
|
||||
$tabul=($this->menu->liste[$i]['level'] - 1);
|
||||
if ($tabul > 0)
|
||||
@ -243,10 +440,10 @@ class MenuManager
|
||||
unset($this->menu->liste);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($mode == 'jmobile')
|
||||
{
|
||||
foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
{
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
@ -296,7 +493,7 @@ class MenuManager
|
||||
break; // Only first menu entry (so home)
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
unset($this->menu);
|
||||
|
||||
return $res;
|
||||
|
||||
@ -652,7 +652,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
if ((float) DOL_VERSION >= 6.0)
|
||||
{
|
||||
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
|
||||
$content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath('cabinetmed/doc/', 1)));
|
||||
$content = dolMd2Html($content, 'parsedown',
|
||||
array(
|
||||
'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1),
|
||||
'img/'=>dol_buildpath(strtolower($this->name).'/img/', 1),
|
||||
'images/'=>dol_buildpath(strtolower($this->name).'/imgages/', 1),
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -678,6 +683,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the changelog. First check ChangeLog-la_LA.md then ChangeLog.md
|
||||
*
|
||||
* @return string Content of ChangeLog
|
||||
*/
|
||||
function getChangeLog()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
$filefound= false;
|
||||
|
||||
// Define path to file README.md.
|
||||
// First check README-la_LA.md then README.md
|
||||
$pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog-'.$langs->defaultlang.'.md', 0);
|
||||
if (dol_is_file($pathoffile))
|
||||
{
|
||||
$filefound = true;
|
||||
}
|
||||
if (! $filefound)
|
||||
{
|
||||
$pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog.md', 0);
|
||||
if (dol_is_file($pathoffile))
|
||||
{
|
||||
$filefound = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound) // Mostly for external modules
|
||||
{
|
||||
$content = file_get_contents($pathoffile);
|
||||
|
||||
if ((float) DOL_VERSION >= 6.0)
|
||||
{
|
||||
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
|
||||
$content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = nl2br($content);
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the publisher name
|
||||
*
|
||||
|
||||
@ -229,7 +229,7 @@ class CommActionRapport
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$eventstatic->id=$obj->id;
|
||||
$eventstatic->percentage=$obj->percentage;
|
||||
$eventstatic->percentage=$obj->percent;
|
||||
$eventstatic->fulldayevent=$obj->fulldayevent;
|
||||
$eventstatic->punctual=$obj->punctual;
|
||||
|
||||
@ -266,7 +266,14 @@ class CommActionRapport
|
||||
|
||||
// Date
|
||||
$pdf->SetXY($this->marge_gauche, $y);
|
||||
$pdf->MultiCell(22, $height, dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"), 0, 'L', 0);
|
||||
$textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour");
|
||||
if ($obj->dp2) {
|
||||
if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day"))
|
||||
$textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour");
|
||||
else
|
||||
$textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour");
|
||||
}
|
||||
$pdf->MultiCell(22, $height, $textdate, 0, 'L', 0);
|
||||
$y0 = $pdf->GetY();
|
||||
|
||||
// Third party
|
||||
|
||||
@ -86,17 +86,17 @@ class modAgenda extends DolibarrModules
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($sqlreadactions))
|
||||
{
|
||||
//if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation).
|
||||
//if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation).
|
||||
if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default.
|
||||
//if (preg_match('/^_MODIFY/',$obj->code)) continue; // We don't track such events by default.
|
||||
$this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1");
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db->lasterror());
|
||||
}
|
||||
|
||||
|
||||
// New pages on tabs
|
||||
// -----------------
|
||||
$this->tabs = array();
|
||||
@ -197,7 +197,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php',
|
||||
'langs'=>'agenda',
|
||||
'position'=>100,
|
||||
'position'=>15,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -235,7 +235,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda',
|
||||
'langs'=>'agenda',
|
||||
'position'=>102,
|
||||
'position'=>140,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -247,7 +247,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
|
||||
'langs'=>'agenda',
|
||||
'position'=>103,
|
||||
'position'=>141,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -259,7 +259,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
|
||||
'langs'=>'agenda',
|
||||
'position'=>104,
|
||||
'position'=>142,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -271,7 +271,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
|
||||
'langs'=>'agenda',
|
||||
'position'=>105,
|
||||
'position'=>143,
|
||||
'perms'=>'$user->rights->agenda->allactions->read',
|
||||
'enabled'=>'$user->rights->agenda->allactions->read',
|
||||
'target'=>'',
|
||||
@ -283,7 +283,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
|
||||
'langs'=>'agenda',
|
||||
'position'=>106,
|
||||
'position'=>144,
|
||||
'perms'=>'$user->rights->agenda->allactions->read',
|
||||
'enabled'=>'$user->rights->agenda->allactions->read',
|
||||
'target'=>'',
|
||||
@ -296,7 +296,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda',
|
||||
'langs'=>'agenda',
|
||||
'position'=>112,
|
||||
'position'=>110,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -308,7 +308,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine',
|
||||
'langs'=>'agenda',
|
||||
'position'=>113,
|
||||
'position'=>111,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine',
|
||||
'langs'=>'agenda',
|
||||
'position'=>114,
|
||||
'position'=>112,
|
||||
'perms'=>'$user->rights->agenda->myactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -332,7 +332,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1',
|
||||
'langs'=>'agenda',
|
||||
'position'=>115,
|
||||
'position'=>113,
|
||||
'perms'=>'$user->rights->agenda->allactions->read',
|
||||
'enabled'=>'$user->rights->agenda->allactions->read',
|
||||
'target'=>'',
|
||||
@ -344,7 +344,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1',
|
||||
'langs'=>'agenda',
|
||||
'position'=>116,
|
||||
'position'=>114,
|
||||
'perms'=>'$user->rights->agenda->allactions->read',
|
||||
'enabled'=>'$user->rights->agenda->allactions->read',
|
||||
'target'=>'',
|
||||
@ -357,7 +357,7 @@ class modAgenda extends DolibarrModules
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda',
|
||||
'langs'=>'agenda',
|
||||
'position'=>120,
|
||||
'position'=>160,
|
||||
'perms'=>'$user->rights->agenda->allactions->read',
|
||||
'enabled'=>'$conf->agenda->enabled',
|
||||
'target'=>'',
|
||||
@ -407,5 +407,5 @@ class modAgenda extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' ORDER BY ac.datep';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -70,8 +70,8 @@ class modCashDesk extends DolibarrModules
|
||||
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
|
||||
$this->langfiles = array("cashdesk");
|
||||
$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
|
||||
$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
|
||||
//$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
|
||||
//$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
@ -61,11 +61,11 @@ class pdf_standardlabel extends CommonStickerGenerator
|
||||
*/
|
||||
function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
|
||||
{
|
||||
global $mysoc,$conf,$langs;
|
||||
global $forceimgscalewidth,$forceimgscaleheight;
|
||||
global $mysoc, $conf, $langs;
|
||||
global $forceimgscalewidth, $forceimgscaleheight;
|
||||
|
||||
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
|
||||
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
|
||||
$imgscaleheight=(empty($forceimgscaleheight)?0.5:$forceimgscaleheight); // Scale of image for height (1=Full height of sticker)
|
||||
|
||||
// We are in a new page, then we must add a page
|
||||
if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) {
|
||||
|
||||
@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
|
||||
<?php
|
||||
<?php
|
||||
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
|
||||
if ($nolinesbefore) {
|
||||
?>
|
||||
@ -120,10 +120,10 @@ if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay=2;
|
||||
?>
|
||||
<td class="linecolnum" align="center" width="5">
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
$coldisplay=0;
|
||||
$coldisplay=0;
|
||||
}
|
||||
?>
|
||||
|
||||
@ -278,13 +278,13 @@ else {
|
||||
<td class="nobottom linecoluht" align="right">
|
||||
<input type="text" size="5" name="price_ht" id="price_ht" class="flat right" value="<?php echo (isset($_POST["price_ht"])?GETPOST("price_ht",'alpha',2):''); ?>">
|
||||
</td>
|
||||
|
||||
|
||||
<?php if (!empty($conf->multicurrency->enabled)) { $colspan++;?>
|
||||
<td class="nobottom linecoluht_currency" align="right">
|
||||
<input type="text" size="5" name="multicurrency_price_ht" id="multicurrency_price_ht" class="flat right" value="<?php echo (isset($_POST["multicurrency_price_ht"])?GETPOST("multicurrency_price_ht",'alpha',2):''); ?>">
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php if (! empty($inputalsopricewithtax)) { ?>
|
||||
<td class="nobottom linecoluttc" align="right">
|
||||
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?GETPOST("price_ttc",'alpha',2):''); ?>">
|
||||
@ -738,9 +738,10 @@ function setforfree() {
|
||||
function setforpredef() {
|
||||
console.log("Call setforpredef. We hide some fields");
|
||||
jQuery("#select_type").val(-1);
|
||||
|
||||
jQuery("#prod_entry_mode_free").prop('checked',false).change();
|
||||
jQuery("#prod_entry_mode_predef").prop('checked',true).change();
|
||||
jQuery("#price_ht").hide();
|
||||
jQuery("#price_ht").val('').hide();
|
||||
jQuery("#multicurrency_price_ht").hide();
|
||||
jQuery("#price_ttc").hide(); // May no exists
|
||||
jQuery("#tva_tx").hide();
|
||||
|
||||
@ -109,7 +109,6 @@ $hookmanager->initHooks(array('expeditioncard','globalcard'));
|
||||
$permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -195,8 +194,8 @@ if (empty($reshook))
|
||||
|
||||
$object->note = GETPOST('note','alpha');
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $origin_id;
|
||||
$object->fk_project = GETPOST('projectid');
|
||||
$object->origin_id = $origin_id;
|
||||
$object->fk_project = GETPOST('projectid','int');
|
||||
$object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int');
|
||||
$object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int');
|
||||
$object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int');
|
||||
@ -214,7 +213,7 @@ if (empty($reshook))
|
||||
|
||||
$object->socid = $objectsrc->socid;
|
||||
$object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment
|
||||
$object->model_pdf = GETPOST('model');
|
||||
$object->model_pdf = GETPOST('model','alpha');
|
||||
$object->date_delivery = $date_delivery; // Date delivery planed
|
||||
$object->fk_delivery_address = $objectsrc->fk_delivery_address;
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id','int');
|
||||
@ -453,7 +452,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -550,7 +549,7 @@ if (empty($reshook))
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
@ -704,7 +703,7 @@ if ($action == 'create')
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
|
||||
$projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0;
|
||||
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
|
||||
|
||||
$langs->load("projects");
|
||||
@ -890,6 +889,7 @@ if ($action == 'create')
|
||||
if (! empty($line->date_start)) $type=1;
|
||||
if (! empty($line->date_end)) $type=1;
|
||||
|
||||
print '<!-- line '.$line->rowid.' for product -->'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
// Product label
|
||||
@ -979,7 +979,7 @@ if ($action == 'create')
|
||||
print '<td align="center">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
if (GETPOST('qtyl'.$indiceAsked)) $defaultqty=GETPOST('qtyl'.$indiceAsked);
|
||||
if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int');
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
}
|
||||
@ -1107,8 +1107,8 @@ if ($action == 'create')
|
||||
// ship from multiple locations
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
|
||||
print '<!-- Case warehouse not already known and product does not need lot -->';
|
||||
print '<td></td><td></td></tr>'."\n"; // end line and start a new one for each warehouse
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
@ -1195,7 +1195,8 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
print '<!-- Case warehouse not already known and product need lot -->';
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
$subj=0;
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
@ -1222,6 +1223,7 @@ if ($action == 'create')
|
||||
//var_dump($dbatch);
|
||||
$batchStock = + $dbatch->qty; // To get a numeric
|
||||
$deliverableQty = min($quantityToBeDelivered,$batchStock);
|
||||
if ($deliverableQty < 0) $deliverableQty = 0;
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
@ -1233,8 +1235,11 @@ if ($action == 'create')
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
$productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
|
||||
print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1);
|
||||
//print $line->fk_product.' - '.$dbatch->batch;
|
||||
print $langs->trans("Batch").': ';
|
||||
$result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
|
||||
if ($result > 0) print $productlotObject->getNomUrl(1);
|
||||
else print 'TableLotIncompleteRunRepair';
|
||||
print ' ('.$dbatch->qty.')';
|
||||
//print $langs->trans("DetailBatchFormat", 'ee'.$dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
$quantityToBeDelivered -= $deliverableQty;
|
||||
@ -1350,7 +1355,7 @@ else if ($id || $ref)
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head=shipping_prepare_head($object);
|
||||
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending');
|
||||
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, 'sending');
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
@ -1762,7 +1767,7 @@ else if ($id || $ref)
|
||||
$object->fetch_thirdparty();
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
@ -1817,6 +1822,7 @@ else if ($id || $ref)
|
||||
// Loop on each product to send/sent
|
||||
for ($i = 0 ; $i < $num_prod ; $i++)
|
||||
{
|
||||
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
@ -1889,14 +1895,14 @@ else if ($id || $ref)
|
||||
$j = 0;
|
||||
foreach($val as $shipmentline_id=> $shipmentline_var)
|
||||
{
|
||||
if ($shipmentline_id == $lines[$i]->rowid) continue; // We want to show only "other shipments"
|
||||
if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) continue; // We want to show only "other shipments"
|
||||
|
||||
$j++;
|
||||
if ($j > 1) print '<br>';
|
||||
$shipment_static->fetch($shipmentline_var['shipment_id']);
|
||||
print $shipment_static->getNomUrl(1);
|
||||
print ' - '.$shipmentline_var['qty_shipped'];
|
||||
$htmltext=$langs->trans("DateValidation").' : '.dol_print_date($shipmentline_var['date_valid'], 'dayhour');
|
||||
$htmltext=$langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($shipmentline_var['date_valid'], 'dayhour'));
|
||||
if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0)
|
||||
{
|
||||
$warehousestatic->fetch($shipmentline_var['warehouse']);
|
||||
|
||||
@ -49,7 +49,7 @@ class Expedition extends CommonObject
|
||||
public $table_element_line="expeditiondet";
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
public $picto = 'sending';
|
||||
|
||||
|
||||
var $socid;
|
||||
var $ref_customer;
|
||||
var $ref_int;
|
||||
@ -399,7 +399,7 @@ class Expedition extends CommonObject
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$expeditionline = new ExpeditionLigne($this->db);
|
||||
@ -918,7 +918,7 @@ class Expedition extends CommonObject
|
||||
$this->error='ADDLINE_WAS_CALLED_INSTEAD_OF_ADDLINEBATCH';
|
||||
return -4;
|
||||
}
|
||||
|
||||
|
||||
// extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
$line->array_options = $array_options;
|
||||
@ -1319,7 +1319,8 @@ class Expedition extends CommonObject
|
||||
|
||||
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
|
||||
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
|
||||
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
|
||||
$sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc";
|
||||
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
|
||||
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
|
||||
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
|
||||
@ -1368,8 +1369,13 @@ class Expedition extends CommonObject
|
||||
$line->line_id = $obj->line_id;
|
||||
$line->rowid = $obj->line_id; // TODO deprecated
|
||||
$line->id = $obj->line_id;
|
||||
$line->fk_origin_line = $obj->fk_origin_line;
|
||||
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
|
||||
|
||||
$line->fk_origin = 'orderline';
|
||||
$line->fk_origin_line = $obj->fk_origin_line;
|
||||
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
|
||||
|
||||
$line->fk_expedition = $this->id; // id of parent
|
||||
|
||||
$line->product_type = $obj->product_type;
|
||||
$line->fk_product = $obj->fk_product;
|
||||
$line->fk_product_type = $obj->fk_product_type;
|
||||
@ -1392,8 +1398,10 @@ class Expedition extends CommonObject
|
||||
|
||||
$line->pa_ht = $obj->pa_ht;
|
||||
|
||||
$localtax_array=array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx);
|
||||
|
||||
// For invoicing
|
||||
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0
|
||||
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc, $localtax_array); // We force type to 0
|
||||
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
|
||||
$line->qty = $line->qty_shipped;
|
||||
$line->total_ht = $tabprice[0];
|
||||
@ -1401,6 +1409,7 @@ class Expedition extends CommonObject
|
||||
$line->total_localtax2 = $tabprice[10];
|
||||
$line->total_ttc = $tabprice[2];
|
||||
$line->total_tva = $tabprice[1];
|
||||
$line->vat_src_code = $obj->vat_src_code;
|
||||
$line->tva_tx = $obj->tva_tx;
|
||||
$line->localtax1_tx = $obj->localtax1_tx;
|
||||
$line->localtax2_tx = $obj->localtax2_tx;
|
||||
@ -1414,6 +1423,14 @@ class Expedition extends CommonObject
|
||||
$this->total_localtax1+= $tabprice[9];
|
||||
$this->total_localtax2+= $tabprice[10];
|
||||
|
||||
// Multicurrency
|
||||
$this->fk_multicurrency = $obj->fk_multicurrency;
|
||||
$this->multicurrency_code = $obj->multicurrency_code;
|
||||
$this->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
if ($originline != $obj->fk_origin_line)
|
||||
{
|
||||
$line->detail_batch = array();
|
||||
@ -1482,7 +1499,7 @@ class Expedition extends CommonObject
|
||||
$label = '<u>' . $langs->trans("ShowSending") . '</u>';
|
||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
||||
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
|
||||
|
||||
|
||||
$url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id;
|
||||
|
||||
if ($short) return $url;
|
||||
@ -1498,7 +1515,7 @@ class Expedition extends CommonObject
|
||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip"';
|
||||
}
|
||||
|
||||
|
||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -425,7 +425,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -542,7 +542,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -665,7 +665,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -788,7 +788,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -910,7 +910,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -953,7 +953,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1170,7 +1170,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
@ -1236,7 +1236,7 @@ if (empty($reshook))
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
|
||||
@ -684,7 +684,10 @@ if ($resql)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'>'.'<td colspan="9" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
$colspan=1;
|
||||
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
|
||||
|
||||
print '<tr>'.'<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
// Show total line
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user