commit
cd1f8dd1da
2
.github/workflows/stale-issues-safe.yml
vendored
2
.github/workflows/stale-issues-safe.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 10 days (you should still be able to re-open it if required).'
|
||||
stale-label: 'Issue Stale (automatic label)'
|
||||
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres'
|
||||
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,hacktoberfest,hacktoberfest-accepted,good first issue,Bug Security (CVE),Analysis of PR in progress'
|
||||
days-before-stale: 365
|
||||
days-before-close: 10
|
||||
operations-per-run: 100
|
||||
|
||||
13
.gitignore
vendored
13
.gitignore
vendored
@ -41,3 +41,16 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
# Node Modules
|
||||
build/yarn-error.log
|
||||
build/node_modules/
|
||||
node_modules/
|
||||
|
||||
#yarn
|
||||
yarn.lock
|
||||
|
||||
#package-lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
os: linux
|
||||
dist: xenial
|
||||
#dist: bionic
|
||||
sudo: required
|
||||
# Deprecated: The key sudo has no effect anymore.
|
||||
#sudo: required
|
||||
|
||||
language: php
|
||||
|
||||
|
||||
@ -164,6 +164,12 @@ source_file = htdocs/langs/en_US/hrm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.intracommreport]
|
||||
file_filter = htdocs/langs/<lang>/intracommreport.lang
|
||||
source_file = htdocs/langs/en_US/intracommreport.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.install]
|
||||
file_filter = htdocs/langs/<lang>/install.lang
|
||||
source_file = htdocs/langs/en_US/install.lang
|
||||
|
||||
@ -12,7 +12,8 @@ NEW: Module Reception (for a more accurate management of your receptions) moved
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Properties ->contactid has been renamed into ->contact_id
|
||||
* Properties ->contactid have been renamed into ->contact_id
|
||||
* Properties ->titre have been renamed into ->title
|
||||
* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id (english)
|
||||
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you used the old syntax in
|
||||
your email templates.
|
||||
@ -24,6 +25,9 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml') so no html will be allowed. Use GETPOST(..., 'restricthtml') to accept HTML.
|
||||
* If you have links in your code with '&action=delete' as a parameter, you must also add '&token='.newToken() as another parameter to avoid CSRF protection errors.
|
||||
* The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of amount.
|
||||
* The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed.
|
||||
* Depreciate all methods with name valide(). Use instead methods validate().
|
||||
|
||||
|
||||
***** ChangeLog for 12.0.3 compared to 12.0.2 *****
|
||||
FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||

|
||||

|
||||
[](https://php.net/)
|
||||
[](https://github.com/Dolibarr/dolibarr)
|
||||
|
||||
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).
|
||||
|
||||
|
||||
@ -12,8 +12,11 @@ services:
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: dolibarr
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
- internal-pod
|
||||
- external-pod
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
|
||||
@ -620,6 +620,9 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file dolibarr.pl
|
||||
# \brief Dolibarr script install for Virtualmin Pro
|
||||
# \author (c)2009-2019 Regis Houssin <regis.houssin@inodbox.com>
|
||||
# \author (c)2009-2020 Regis Houssin <regis.houssin@inodbox.com>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "10.0.0", "9.0.3", "8.0.5", "7.0.5", "6.0.8" );
|
||||
return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_release
|
||||
@ -77,6 +77,16 @@ if ($ver >= 3.6) {
|
||||
push(@rv, "Dolibarr requires PHP version 5.3 or later");
|
||||
}
|
||||
}
|
||||
if ($ver >= 12.0) {
|
||||
# Check for PHP 5.6+
|
||||
local $phpv = &get_php_version($phpver || 5, $d);
|
||||
if (!$phpv) {
|
||||
push(@rv, "Could not work out exact PHP version");
|
||||
}
|
||||
elsif ($phpv < 5.6) {
|
||||
push(@rv, "Dolibarr requires PHP version 5.6 or later");
|
||||
}
|
||||
}
|
||||
|
||||
return @rv;
|
||||
}
|
||||
@ -376,7 +386,7 @@ sub script_dolibarr_realversion
|
||||
local ($d, $opts, $sinfo) = @_;
|
||||
local $lref = &read_file_lines("$opts->{'dir'}/filefunc.inc.php", 1);
|
||||
foreach my $l (@$lref) {
|
||||
if ($l =~ /'DOL_VERSION','([0-9a-z\.\-]+)'/) {
|
||||
if ($l =~ /'DOL_VERSION',\s?'([0-9a-z\.\-]+)'/) {
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
@ -390,6 +400,8 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
@ -410,7 +422,7 @@ return $ver eq $vers[0] ? undef : $vers[0];
|
||||
|
||||
sub script_dolibarr_site
|
||||
{
|
||||
return 'http://www.dolibarr.org/';
|
||||
return 'https://www.dolibarr.org/';
|
||||
}
|
||||
|
||||
sub script_dolibarr_passmode
|
||||
|
||||
@ -196,6 +196,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
|
||||
@ -276,6 +276,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
|
||||
@ -193,6 +193,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
|
||||
@ -204,6 +204,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/imports
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
|
||||
BIN
dev/resources/iso-normes/Intracommreport-ManuelDebXml.pdf
Normal file
BIN
dev/resources/iso-normes/Intracommreport-ManuelDebXml.pdf
Normal file
Binary file not shown.
BIN
dev/resources/iso-normes/Intracommreport-ManuelDesXML.pdf
Normal file
BIN
dev/resources/iso-normes/Intracommreport-ManuelDesXML.pdf
Normal file
Binary file not shown.
@ -357,8 +357,8 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$line = str_replace(" time with time zone", " time", $line);
|
||||
$line = str_replace(" time without time zone", " time", $line);
|
||||
|
||||
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line);
|
||||
|
||||
if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) {
|
||||
$field = getfieldname($line);
|
||||
|
||||
BIN
doc/images/invoice.png
Normal file
BIN
doc/images/invoice.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
@ -294,13 +294,11 @@ if ($resql)
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
// Box to select active chart of account
|
||||
print $langs->trans("Selectchartofaccounts")." : ";
|
||||
@ -343,15 +341,15 @@ if ($resql)
|
||||
|
||||
// Line for search fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
|
||||
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="'.$search_labelshort.'"></td>';
|
||||
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat width100" name="search_account" value="'.$search_account.'"></td>';
|
||||
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat width150" name="search_label" value="'.$search_label.'"></td>';
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat width100" name="search_labelshort" value="'.$search_labelshort.'"></td>';
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat width100" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (!empty($arrayfields['aa.reconcilable']['checked'])) print '<td class="liste_titre"> </td>'; }
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
@ -416,18 +414,24 @@ if ($resql)
|
||||
// Account parent
|
||||
if (!empty($arrayfields['aa.account_parent']['checked']))
|
||||
{
|
||||
if (!empty($obj->account_parent))
|
||||
// Note: obj->account_parent is a foreign key to a rowid. It is field in child table and obj->rowid2 is same, but in parent table.
|
||||
// So for orphans, obj->account_parent is set but not obj->rowid2
|
||||
if (!empty($obj->account_parent) && !empty($obj->rowid2))
|
||||
{
|
||||
print "<td>";
|
||||
print '<!-- obj->account_parent = '.$obj->account_parent.' obj->rowid2 = '.$obj->rowid2.' -->';
|
||||
$accountparent->id = $obj->rowid2;
|
||||
$accountparent->label = $obj->label2;
|
||||
$accountparent->account_number = $obj->account_number2;
|
||||
|
||||
print "<td>";
|
||||
$accountparent->account_number = $obj->account_number2; // Sotre an account number for output
|
||||
print $accountparent->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
if (!empty($obj->account_parent)) {
|
||||
print '<!-- Bad value for obj->account_parent = '.$obj->account_parent.': is a rowid that does not exists -->';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
@ -481,11 +485,11 @@ if ($resql)
|
||||
// Action
|
||||
print '<td class="center">';
|
||||
if ($user->rights->accounting->chartofaccount) {
|
||||
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
|
||||
print '<a class="editfielda" href="./card.php?action=update&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print ' ';
|
||||
print '<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
|
||||
print '<a class="marginleftonly" href="./card.php?action=delete&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ if ($action == 'display' || $action == 'delete') {
|
||||
print '<td class="right">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&account_category='.$cat_id.'&cptid='.$cpt->rowid.'">';
|
||||
print $langs->trans("DeleteFromCat");
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink');
|
||||
print img_picto($langs->trans("DeleteFromCat"), 'unlink', 'class="paddingleft"');
|
||||
print "</a>";
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -47,9 +47,9 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
$list_account_main = array(
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array();
|
||||
@ -120,9 +120,9 @@ if ($action == 'update') {
|
||||
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -159,20 +159,20 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("ThirdParties").' | '.$langs->trans("Users").'</td><td></td></tr>';
|
||||
|
||||
foreach ($list_account_main as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$keydesc = $key.'_Desc';
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$keydesc = $key.'_Desc';
|
||||
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -300,16 +300,16 @@ if ($action == 'create')
|
||||
|
||||
if (!empty($user->rights->accounting->fiscalyear->write))
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* \brief Setup page to configure journals
|
||||
*/
|
||||
|
||||
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/subaccount.php
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief List accounting sub-account
|
||||
* \brief List of accounting sub-account (auxiliary accounts)
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -59,10 +59,10 @@ if (!$sortfield) $sortfield = "label";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
$arrayfields = array(
|
||||
'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['reconcilable']);
|
||||
@ -80,17 +80,17 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (!empty($cancel)) $action = '';
|
||||
if (!empty($cancel)) $action = '';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_subaccount = "";
|
||||
$search_label = "";
|
||||
$search_type = "";
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_subaccount = "";
|
||||
$search_label = "";
|
||||
$search_type = "";
|
||||
$search_array_options = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -100,13 +100,15 @@ if (empty($reshook))
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("ReportThirdParty"));
|
||||
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
// Customer
|
||||
$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '0' as type, sa.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= ' WHERE sa.entity IN ('.getEntity('societe').')';
|
||||
$sql .= ' AND sa.code_compta <> ""';
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
@ -142,13 +144,13 @@ if (strlen(trim($search_subaccount))) {
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("sa.nom", $search_label);
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$search_type."'";
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
|
||||
|
||||
// Supplier
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '1' as type, sa.entity FROM ".MAIN_DB_PREFIX."societe sa";
|
||||
$sql .= ' WHERE sa.entity IN ('.getEntity('societe').')';
|
||||
$sql .= ' AND sa.code_compta_fournisseur <> ""';
|
||||
$sql .= " WHERE sa.entity IN (".getEntity('societe').")";
|
||||
$sql .= " AND sa.code_compta_fournisseur <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
@ -184,13 +186,13 @@ if (strlen(trim($search_subaccount))) {
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("sa.nom", $search_label);
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$search_type."'";
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
|
||||
|
||||
// User
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '2' as type, u.entity FROM ".MAIN_DB_PREFIX."user u";
|
||||
$sql .= ' WHERE u.entity IN ('.getEntity('user').')';
|
||||
$sql .= ' AND u.accountancy_code <> ""';
|
||||
$sql .= " WHERE u.entity IN (".getEntity('user').")";
|
||||
$sql .= " AND u.accountancy_code <> ''";
|
||||
//print $sql;
|
||||
if (strlen(trim($search_subaccount))) {
|
||||
$lengthpaddingaccount = 0;
|
||||
@ -226,7 +228,7 @@ if (strlen(trim($search_subaccount))) {
|
||||
}
|
||||
}
|
||||
if (strlen(trim($search_label))) $sql .= natural_search("u.lastname", $search_label);
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$search_type."'";
|
||||
if (!empty($search_type) && $search_type >= 0) $sql .= " HAVING type LIKE '".$db->escape($search_type)."'";
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -268,18 +270,18 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans('ReportThirdParty'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
print '<div class="warning">'.$langs->trans("WarningCreateSubAccounts").'</div>';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Line for search fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@ -293,7 +295,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['subaccount']['checked'])) print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['label']['checked'])) print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], "label", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
@ -335,17 +337,17 @@ if ($resql)
|
||||
// Customer
|
||||
if ($obj->type == 0)
|
||||
{
|
||||
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
|
||||
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
|
||||
}
|
||||
// Supplier
|
||||
elseif ($obj->type == 1)
|
||||
{
|
||||
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
|
||||
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
|
||||
}
|
||||
// User
|
||||
elseif ($obj->type == 2)
|
||||
{
|
||||
$s .= '<a class="user-back" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
|
||||
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->id.'">'.$langs->trans("Employee").'</a>';
|
||||
}
|
||||
print $s;
|
||||
print '</td>';
|
||||
|
||||
@ -339,7 +339,7 @@ if ($action != 'export_csv')
|
||||
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
|
||||
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||
print '<td class="center">'.$link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -328,7 +328,7 @@ llxHeader('', $langs->trans("CreateMvts"));
|
||||
|
||||
// Confirmation to delete the command
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !isset($_POST['begin']) && !isset($_GET['begin']) && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
|
||||
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export)
|
||||
{
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values'))
|
||||
{
|
||||
@ -529,7 +529,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping");
|
||||
$title_page = $langs->trans("Operations").' - '.$langs->trans("Journals");
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -608,22 +608,21 @@ if ($action == 'delbookkeepingyear') {
|
||||
'default' => $deljournal
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
//$param=''; param started before
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.urlencode($sortfield).'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.urlencode($sortorder).'">';
|
||||
|
||||
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
||||
else $buttonLabel = $langs->trans("ExportList");
|
||||
@ -638,13 +637,14 @@ $newcardbutton .= '<span class="valignmiddle marginrightonly">'.$langs->trans("I
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export);
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly'));
|
||||
|
||||
$url = './card.php?action=create';
|
||||
if (!empty($socid)) $url .= '&socid='.$socid;
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', $url, '', $user->rights->accounting->mouvements->creer);
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
@ -670,12 +670,10 @@ if (!empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -703,25 +701,25 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'" placeholder="'.$langs->trans("From").'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'" placeholder="'.$langs->trans("to").'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
@ -771,12 +769,10 @@ if (!empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1);
|
||||
print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1);
|
||||
print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -785,12 +781,10 @@ if (!empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1);
|
||||
print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1);
|
||||
print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -799,12 +793,10 @@ if (!empty($arrayfields['t.date_export']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From').' ';
|
||||
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1);
|
||||
print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to').' ';
|
||||
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1);
|
||||
print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -1049,10 +1041,10 @@ while ($i < min($num, $limit))
|
||||
print '<td class="nowraponall center">';
|
||||
if (empty($line->date_export)) {
|
||||
if ($user->rights->accounting->mouvements->creer) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
|
||||
print '<a class="editfielda paddingleft marginrightonly" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
|
||||
print '<a class="reposition paddingleft marginrightonly" href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -33,7 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
@ -55,6 +54,7 @@ if ($search_accountancy_code_end == - 1) {
|
||||
}
|
||||
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
|
||||
$search_label_operation = GETPOST('search_label_operation', 'alpha');
|
||||
$search_mvt_num = GETPOST('search_mvt_num', 'int');
|
||||
$search_direction = GETPOST('search_direction', 'alpha');
|
||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||
$search_debit = GETPOST('search_debit', 'alpha');
|
||||
@ -86,7 +86,7 @@ $hookmanager->initHooks(array('bookkeepingbyaccountlist'));
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
|
||||
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
|
||||
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
|
||||
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
|
||||
$sql .= $db->plimit(1);
|
||||
@ -149,6 +149,7 @@ if (empty($reshook))
|
||||
$search_label_account = '';
|
||||
$search_doc_ref = '';
|
||||
$search_label_operation = '';
|
||||
$search_mvt_num = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
$search_date_start = '';
|
||||
@ -193,6 +194,10 @@ if (empty($reshook))
|
||||
$filter['t.label_compte'] = $search_label_account;
|
||||
$param .= '&search_label_compte=' . urlencode($search_label_account);
|
||||
}
|
||||
if (!empty($search_mvt_num)) {
|
||||
$filter['t.piece_num'] = $search_mvt_num;
|
||||
$param .= '&search_mvt_num=' . urlencode($search_mvt_num);
|
||||
}
|
||||
if (!empty($search_doc_ref)) {
|
||||
$filter['t.doc_ref'] = $search_doc_ref;
|
||||
$param .= '&search_doc_ref=' . urlencode($search_doc_ref);
|
||||
@ -294,7 +299,7 @@ $formfile = new FormFile($db);
|
||||
$formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping").' '.strtolower($langs->trans("By")).' '.strtolower($langs->trans("AccountAccounting"));
|
||||
$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' ('.$langs->trans("Bookkeeping").')';
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
@ -358,7 +363,7 @@ if ($action == 'delbookkeepingyear') {
|
||||
'default' => $deljournal
|
||||
);
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
@ -370,16 +375,19 @@ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$opt
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected'));
|
||||
|
||||
$newcardbutton .= ' ';
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
|
||||
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
@ -394,10 +402,10 @@ $moreforfilter = '';
|
||||
// Accountancy account
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('AccountAccounting').': ';
|
||||
$moreforfilter .= '<div class="nowrap">';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||
$moreforfilter .= $langs->trans('From').' ';
|
||||
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200');
|
||||
$moreforfilter .= $langs->trans('to').' ';
|
||||
$moreforfilter .= ' '.$langs->trans('to').' ';
|
||||
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200');
|
||||
$moreforfilter .= '</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
@ -425,12 +433,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) {
|
||||
if (!empty($arrayfields['t.doc_date']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
|
||||
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1);
|
||||
print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
@ -697,10 +703,10 @@ while ($i < min($num, $limit))
|
||||
print '<td class="nowraponall center">';
|
||||
if (empty($line->date_export)) {
|
||||
if ($user->rights->accounting->mouvements->creer) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_edit().'</a>';
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
print ' <a href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
|
||||
print ' <a class="paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delmouv&mvt_num='.$line->piece_num.$param.'&page='.$page.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -448,7 +448,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
|
||||
* @param string $option 'bookkeeping', 'bookkeepinglistbyaccount', 'accountcard'
|
||||
* @param string $option 'ledger', 'journals', 'accountcard'
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '')
|
||||
@ -460,12 +460,12 @@ class AccountingAccount extends CommonObject
|
||||
|
||||
$result = '';
|
||||
|
||||
if (empty($option) || $option == 'bookkeeping') {
|
||||
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
|
||||
$labelurl = $langs->trans("ShowAccountingAccountInBookKeeping");
|
||||
} elseif ($option == 'bookkeepinglistbyaccount') {
|
||||
if (empty($option) || $option == 'ledger') {
|
||||
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
|
||||
$labelurl = $langs->trans("ShowAccountingAccountInBookKeepingByAccount");
|
||||
$labelurl = $langs->trans("ShowAccountingAccountInLedger");
|
||||
} elseif ($option == 'journals') {
|
||||
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
|
||||
$labelurl = $langs->trans("ShowAccountingAccountInJournals");
|
||||
} elseif ($option == 'accountcard') {
|
||||
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
|
||||
$labelurl = $langs->trans("ShowAccountingAccount");
|
||||
|
||||
@ -57,80 +57,80 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string Date of source document, in db date NOT NULL
|
||||
*/
|
||||
/**
|
||||
* @var string Date of source document, in db date NOT NULL
|
||||
*/
|
||||
public $doc_date;
|
||||
|
||||
/**
|
||||
* @var int Deadline for payment
|
||||
*/
|
||||
/**
|
||||
* @var int Deadline for payment
|
||||
*/
|
||||
public $date_lim_reglement;
|
||||
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $doc_type;
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $doc_type;
|
||||
|
||||
/**
|
||||
* @var string doc_ref
|
||||
*/
|
||||
/**
|
||||
* @var string doc_ref
|
||||
*/
|
||||
public $doc_ref;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_doc;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_docdet;
|
||||
|
||||
/**
|
||||
* @var string thirdparty code
|
||||
*/
|
||||
public $thirdparty_code;
|
||||
/**
|
||||
* @var string thirdparty code
|
||||
*/
|
||||
public $thirdparty_code;
|
||||
|
||||
/**
|
||||
* @var string subledger account
|
||||
*/
|
||||
/**
|
||||
* @var string subledger account
|
||||
*/
|
||||
public $subledger_account;
|
||||
|
||||
/**
|
||||
* @var string subledger label
|
||||
*/
|
||||
/**
|
||||
* @var string subledger label
|
||||
*/
|
||||
public $subledger_label;
|
||||
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $numero_compte;
|
||||
|
||||
/**
|
||||
* @var string label compte
|
||||
*/
|
||||
public $label_compte;
|
||||
/**
|
||||
* @var string label compte
|
||||
*/
|
||||
public $label_compte;
|
||||
|
||||
/**
|
||||
* @var string label operation
|
||||
*/
|
||||
public $label_operation;
|
||||
/**
|
||||
* @var string label operation
|
||||
*/
|
||||
public $label_operation;
|
||||
|
||||
/**
|
||||
* @var float FEC:Debit
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Debit
|
||||
*/
|
||||
public $debit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Credit
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Credit
|
||||
*/
|
||||
public $credit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated Use $amount
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated Use $amount
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
@ -138,34 +138,34 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var string FEC:Sens (Not necessary)
|
||||
*/
|
||||
/**
|
||||
* @var string FEC:Sens (Not necessary)
|
||||
*/
|
||||
public $sens;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_author;
|
||||
|
||||
/**
|
||||
* @var string key for import
|
||||
*/
|
||||
/**
|
||||
* @var string key for import
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
/**
|
||||
* @var string code journal
|
||||
*/
|
||||
/**
|
||||
* @var string code journal
|
||||
*/
|
||||
public $code_journal;
|
||||
|
||||
/**
|
||||
* @var string label journal
|
||||
*/
|
||||
/**
|
||||
* @var string label journal
|
||||
*/
|
||||
public $journal_label;
|
||||
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
@ -179,8 +179,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ class BookKeeping extends CommonObject
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -504,11 +504,11 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -578,7 +578,7 @@ class BookKeeping extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.$mode.' (';
|
||||
@ -673,8 +673,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null, $mode = '')
|
||||
{
|
||||
public function fetch($id, $ref = null, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -771,8 +771,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -904,11 +904,11 @@ class BookKeeping extends CommonObject
|
||||
* @param int $offset Offset limit
|
||||
* @param array $filter Filter array
|
||||
* @param string $filtermode Filter mode (AND or OR)
|
||||
* @param int $showAlreadyExportMovements Show movements when field 'date_export' is not empty (0:No / 1:Yes (Default))
|
||||
* @param int $showAlreadyExportMovements Show movements when field 'date_export' is not empty (0:No / 1:Yes (Default))
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $showAlreadyExportMovements = 1)
|
||||
{
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $showAlreadyExportMovements = 1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -940,7 +940,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
@ -960,8 +960,8 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} else {
|
||||
@ -970,9 +970,9 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
||||
if ($showAlreadyExportMovements == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if ($showAlreadyExportMovements == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ class BookKeeping extends CommonObject
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
@ -1133,8 +1133,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode ('' or _tmp')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function update(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -1300,8 +1300,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function delete(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
@ -1348,8 +1348,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $importkey Import key
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteByImportkey($importkey)
|
||||
{
|
||||
public function deleteByImportkey($importkey)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
@ -1379,11 +1379,11 @@ class BookKeeping extends CommonObject
|
||||
* @param int $delmonth Month
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||
{
|
||||
global $langs;
|
||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (empty($delyear) && empty($journal))
|
||||
if (empty($delyear) && empty($journal))
|
||||
{
|
||||
$this->error = 'ErrorOneFieldRequired';
|
||||
return -1;
|
||||
@ -1428,8 +1428,8 @@ class BookKeeping extends CommonObject
|
||||
* @param int $piecenum Piecenum to delete
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteMvtNum($piecenum)
|
||||
{
|
||||
public function deleteMvtNum($piecenum)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1463,8 +1463,8 @@ class BookKeeping extends CommonObject
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
@ -1511,8 +1511,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$now = dol_now();
|
||||
@ -1548,8 +1548,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
public function fetchPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
|
||||
@ -1613,8 +1613,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
public function fetchAllPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
@ -1664,16 +1664,16 @@ class BookKeeping extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Export bookkeeping
|
||||
*
|
||||
* @param string $model Model
|
||||
* @return int Result
|
||||
*/
|
||||
public function export_bookkeeping($model = 'ebp')
|
||||
{
|
||||
// phpcs:enable
|
||||
public function export_bookkeeping($model = 'ebp')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
@ -1739,10 +1739,10 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($direction == 0)
|
||||
if ($direction == 0)
|
||||
{
|
||||
$next_piecenum = $this->getNextNumMvt();
|
||||
$now = dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
if ($next_piecenum < 0) {
|
||||
$error++;
|
||||
@ -1819,22 +1819,22 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@ -1891,7 +1891,7 @@ class BookKeeping extends CommonObject
|
||||
return $out;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Description of a root accounting account
|
||||
*
|
||||
@ -1900,7 +1900,7 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function get_compte_racine($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
@ -1932,16 +1932,16 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Description of accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string Account desc
|
||||
*/
|
||||
public function get_compte_desc($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
public function get_compte_desc($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
@ -1989,13 +1989,13 @@ class BookKeepingLine
|
||||
public $doc_ref;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_doc;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_docdet;
|
||||
|
||||
public $thirdparty_code;
|
||||
@ -2007,26 +2007,26 @@ class BookKeepingLine
|
||||
public $debit;
|
||||
public $credit;
|
||||
|
||||
/**
|
||||
* @var float Amount
|
||||
* @deprecated see $amount
|
||||
*/
|
||||
/**
|
||||
* @var float Amount
|
||||
* @deprecated see $amount
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
* @var float Amount
|
||||
*/
|
||||
/**
|
||||
* @var float Amount
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var string Sens
|
||||
*/
|
||||
public $sens;
|
||||
public $lettering_code;
|
||||
/**
|
||||
* @var string Sens
|
||||
*/
|
||||
public $sens;
|
||||
public $lettering_code;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_author;
|
||||
|
||||
public $import_key;
|
||||
@ -2035,17 +2035,17 @@ class BookKeepingLine
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
public $date_creation;
|
||||
|
||||
/**
|
||||
* @var integer|string $date_modification;
|
||||
*/
|
||||
public $date_modification;
|
||||
public $date_modification;
|
||||
|
||||
/**
|
||||
* @var integer|string $date_export;
|
||||
*/
|
||||
public $date_export;
|
||||
/**
|
||||
* @var integer|string $date_export;
|
||||
*/
|
||||
public $date_export;
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ print '<script type="text/javascript">
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " u.rowid as userid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.label, aa.labelshort, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
@ -311,7 +311,7 @@ if ($result) {
|
||||
$expensereportstatic->ref = $objp->ref;
|
||||
$expensereportstatic->id = $objp->erid;
|
||||
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->id = $objp->userid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
|
||||
@ -190,7 +190,7 @@ if (empty($chartaccountcode))
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " u.rowid as userid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
@ -356,7 +356,7 @@ if ($result) {
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->id = $objp->userid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
|
||||
@ -180,10 +180,10 @@ if ($result) {
|
||||
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
|
||||
|
||||
$tabcompany = array();
|
||||
$tabuser = array();
|
||||
@ -970,8 +970,9 @@ if (empty($action) || $action == 'view') {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>');
|
||||
print '</div>';
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
|
||||
|
||||
@ -181,7 +181,12 @@ if (empty($reshook)) {
|
||||
if ($result > 0) {
|
||||
// Creation user
|
||||
$nuser = new User($db);
|
||||
$result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml'));
|
||||
$tmpuser = dol_clone($object);
|
||||
if (GETPOST('internalorexternal', 'aZ09') == 'internal') {
|
||||
$tmpuser->fk_soc = 0;
|
||||
}
|
||||
|
||||
$result = $nuser->create_from_member($tmpuser, GETPOST('login', 'alphanohtml'));
|
||||
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
@ -1279,11 +1284,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$formquestion = array(
|
||||
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
|
||||
);
|
||||
$text = $langs->trans("ConfirmCreateLogin").'<br>';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
if ($object->socid > 0) $text .= $langs->trans("UserWillBeExternalUser");
|
||||
else $text .= $langs->trans("UserWillBeInternalUser");
|
||||
if (!empty($conf->societe->enabled) && $object->socid > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
$formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal")));
|
||||
}
|
||||
$text = '';
|
||||
if (!empty($conf->societe->enabled) && $object->socid <= 0) {
|
||||
$text .= $langs->trans("UserWillBeInternalUser").'<br>';
|
||||
}
|
||||
$text .= $langs->trans("ConfirmCreateLogin");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
||||
}
|
||||
|
||||
|
||||
@ -436,7 +436,7 @@ if ($sall) {
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter = '';
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Categories').': ';
|
||||
|
||||
@ -110,7 +110,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($object->error) {
|
||||
if ($object->error) {
|
||||
$errmsg = $object->error;
|
||||
} else {
|
||||
foreach ($object->errors as $error) {
|
||||
@ -128,13 +128,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) {
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $adh->error;
|
||||
}
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $adh->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$object->fetch($rowid);
|
||||
$object->fetch($rowid);
|
||||
$result = $adh->fetch($object->fk_adherent);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
@ -172,13 +172,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print "\n";
|
||||
print "\n";
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
@ -195,24 +195,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type));
|
||||
print'</td></tr>';
|
||||
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
|
||||
print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="10" name="amount" value="'.price($object->amount).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="2">';
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
|
||||
|
||||
// Bank line
|
||||
@ -234,11 +234,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print "\n";
|
||||
@ -251,69 +251,69 @@ if ($rowid && $action != 'edit') {
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $adh->fetch($object->fk_adherent);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete') {
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete') {
|
||||
//$formquestion=array();
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
$text = $langs->trans("ConfirmDeleteSubscription");
|
||||
if (!empty($conf->banque->enabled) && !empty($conf->global->ADHERENT_BANK_USE)) $text .= '<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("DeleteSubscription"), $text, "confirm_delete", $formquestion, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ($object->fk_type > 0 || $adh->typeid > 0) {
|
||||
$typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
|
||||
$adht->fetch($typeid);
|
||||
print $adht->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("NoType");
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ($object->fk_type > 0 || $adh->typeid > 0) {
|
||||
$typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
|
||||
$adht->fetch($typeid);
|
||||
print $adht->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("NoType");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->dateh, 'day').'</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr>';
|
||||
// Date end subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur">'.dol_print_date($object->datef, 'day').'</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
@ -330,20 +330,20 @@ if ($rowid && $action != 'edit') {
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if (!$bankline->rappro) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>";
|
||||
} else {
|
||||
@ -351,19 +351,19 @@ if ($rowid && $action != 'edit') {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
// Delete
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents generes
|
||||
/*
|
||||
// Documents generes
|
||||
/*
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
@ -375,23 +375,23 @@ if ($rowid && $action != 'edit') {
|
||||
*/
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -154,17 +154,20 @@ print "<br>";
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
|
||||
// Show message
|
||||
$message = '';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal);
|
||||
$message .= '<br>';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlical .=$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical);
|
||||
$message .= '<br>';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss);
|
||||
$message .= '<br>';
|
||||
$message .= '<br>';
|
||||
|
||||
@ -400,7 +400,7 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
|
||||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
@ -558,13 +558,13 @@ $langs->load("companies");
|
||||
|
||||
// Managing Director(s)
|
||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
||||
|
||||
// GDPR contact
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
||||
print '</td><td>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
||||
|
||||
// Capital
|
||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
|
||||
@ -83,17 +83,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if ($action == 'setMAIN_ENABLE_DEFAULT_VALUES')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('actionmodify'))
|
||||
@ -102,57 +102,57 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
||||
|
||||
if (($action == 'add' || (GETPOST('add') && $action != 'update')))
|
||||
{
|
||||
if (empty($defaulturl))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaultkey))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaulturl))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaultkey))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
if (empty($urlpage))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($key))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($urlpage))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($key))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")";
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
}
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")";
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -189,15 +189,15 @@ $param = '&mode='.$mode;
|
||||
$enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'title_setup');
|
||||
@ -228,7 +228,7 @@ dol_fiche_head($head, $mode, '', -1, '');
|
||||
|
||||
if ($mode == 'sortorder')
|
||||
{
|
||||
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
||||
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
||||
}
|
||||
if ($mode == 'mandatory')
|
||||
{
|
||||
@ -253,30 +253,30 @@ print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param
|
||||
$texthelp = $langs->trans("TheKeyIsTheNameOfHtmlField");
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
} else {
|
||||
$texthelp = 'field or alias.field';
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
$texthelp = 'field or alias.field';
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
}
|
||||
print_liste_field_titre($textkey, $_SERVER["PHP_SELF"], 'param', '', $param, '', $sortfield, $sortorder);
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount')); // Must match list into GETPOST
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount')); // Must match list into GETPOST
|
||||
unset($substitutionarray['__USER_SIGNATURE__']);
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp .= $key.' -> '.$val.'<br>';
|
||||
}
|
||||
$textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||
} else {
|
||||
$texthelp = 'ASC or DESC';
|
||||
$textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp);
|
||||
}
|
||||
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp .= $key.' -> '.$val.'<br>';
|
||||
}
|
||||
$textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||
} else {
|
||||
$texthelp = 'ASC or DESC';
|
||||
$textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp);
|
||||
}
|
||||
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
// Entity
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder);
|
||||
@ -301,9 +301,9 @@ print '</td>';
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||
print '</td>';
|
||||
}
|
||||
// Limit to superadmin
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity)
|
||||
@ -361,32 +361,32 @@ if ($result)
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
print '</td>';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
// Actions
|
||||
print '<td class="center">';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
} else {
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$id.'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
|
||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$id.'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
|
||||
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -395,7 +395,7 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'other', 'ecm'));
|
||||
@ -89,9 +89,9 @@ dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -113,9 +113,9 @@ if ($action == 'create') {
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'other', 'ecm'));
|
||||
@ -89,9 +89,9 @@ dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -113,9 +113,9 @@ if ($action == 'create') {
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -393,7 +393,7 @@ foreach ($object->fields as $key => $val)
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -64,33 +65,46 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
if ($action == 'update' && !$cancel)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
// Send mode parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
if (! $error && ! GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MAIN_MAIL_EMAIL_FROM")), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
if (! $error && ! isValidEmail(GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorBadEMail", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')), null, 'errors');
|
||||
$action = 'edit';
|
||||
}
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
// Content parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
if (! $error) {
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_MAILS", GETPOST("MAIN_DISABLE_ALL_MAILS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_FORCE_SENDTO", GETPOST("MAIN_MAIL_FORCE_SENDTO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ENABLED_USER_DEST_SELECT", GETPOST("MAIN_MAIL_ENABLED_USER_DEST_SELECT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
// Send mode parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE", GETPOST("MAIN_MAIL_SENDMODE", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT", GETPOST("MAIN_MAIL_SMTP_PORT", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER", GETPOST("MAIN_MAIL_SMTP_SERVER", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID", GETPOST("MAIN_MAIL_SMTPS_ID", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW", GETPOST("MAIN_MAIL_SMTPS_PW", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS", GETPOST("MAIN_MAIL_EMAIL_TLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS", GETPOST("MAIN_MAIL_EMAIL_STARTTLS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_ENABLED", GETPOST("MAIN_MAIL_EMAIL_DKIM_ENABLED", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_DOMAIN", GETPOST("MAIN_MAIL_EMAIL_DKIM_DOMAIN", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_SELECTOR", GETPOST("MAIN_MAIL_EMAIL_DKIM_SELECTOR", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", GETPOST("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
// Content parameters
|
||||
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM", GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_ERRORS_TO", GETPOST("MAIN_MAIL_ERRORS_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", GETPOST("MAIN_MAIL_AUTOCOPY_TO", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'MAIN_MAIL_DEFAULT_FROMTYPE', GETPOST('MAIN_MAIL_DEFAULT_FROMTYPE', 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -462,8 +476,8 @@ if ($action == 'edit')
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("OtherOptions").'</td><td></td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
||||
print '<tr class="oddeven"><td class="fieldrequired">'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).'</td>';
|
||||
print '<td><input class="flat minwidth200" name="MAIN_MAIL_EMAIL_FROM" value="'.(!empty($conf->global->MAIN_MAIL_EMAIL_FROM) ? $conf->global->MAIN_MAIL_EMAIL_FROM : '');
|
||||
print '"></td></tr>';
|
||||
|
||||
// Default from type
|
||||
@ -538,7 +552,7 @@ if ($action == 'edit')
|
||||
print $text;
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
print $form->textwithpicto('', $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC"), 1, 'warning');
|
||||
print $form->textwithpicto('', $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 1, 'warning');
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
@ -637,7 +651,7 @@ if ($action == 'edit')
|
||||
print '</table>';
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
|
||||
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC"), 0, 0, 'warning');
|
||||
print info_admin($langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"), 0, 0, 'warning');
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -474,7 +474,7 @@ foreach ($object->fields as $key => $val)
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
|
||||
@ -147,29 +147,30 @@ $tabfieldcheck = array();
|
||||
$tabfieldcheck[25] = array();
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList = array();
|
||||
|
||||
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
|
||||
$elementList = array();
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire) $elementList['propal_send'] = $langs->trans('MailToSendProposal');
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire) $elementList['order_send'] = $langs->trans('MailToSendOrder');
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire) $elementList['facture_send'] = $langs->trans('MailToSendInvoice');
|
||||
if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->trans('MailToSendShipment');
|
||||
if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception');
|
||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention');
|
||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation');
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
|
||||
if ($conf->societe->enabled && $user->rights->societe->lire) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
|
||||
if ($conf->adherent->enabled && $user->rights->adherent->lire) $elementList['member'] = $langs->trans('MailToMember');
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = $langs->trans('MailToSendContract');
|
||||
if ($conf->projet->enabled) $elementList['project'] = $langs->trans('MailToProject');
|
||||
if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = $langs->trans('MailToTicket');
|
||||
if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = $langs->trans('RecruitmentCandidatures');
|
||||
if ($conf->agenda->enabled) $elementList['actioncomm_send'] = $langs->trans('MailToSendEventPush');
|
||||
$elementList['user'] = $langs->trans('MailToUser');
|
||||
// Add all and none after the sort
|
||||
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
|
||||
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
|
||||
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
|
||||
if ($conf->adherent->enabled && $user->rights->adherent->lire) $elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
|
||||
if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
|
||||
if ($conf->societe->enabled && $user->rights->societe->lire) $elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
|
||||
if ($conf->projet->enabled) $elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire) $elementList['propal_send'] = dol_escape_htmltag($langs->trans('MailToSendProposal'));
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire) $elementList['order_send'] = dol_escape_htmltag($langs->trans('MailToSendOrder'));
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire) $elementList['facture_send'] = dol_escape_htmltag($langs->trans('MailToSendInvoice'));
|
||||
if ($conf->expedition->enabled) $elementList['shipping_send'] = dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||
if ($conf->reception->enabled) $elementList['reception_send'] = dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) $elementList['order_supplier_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) $elementList['invoice_supplier_send'] = dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
|
||||
if ($conf->ticket->enabled && $user->rights->ticket->read) $elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
if ($conf->agenda->enabled) $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
|
||||
$parameters = array('elementList'=>$elementList);
|
||||
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
@ -179,11 +180,7 @@ if ($reshook == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add all and none after the sort
|
||||
$elementList['all'] = '-- '.$langs->trans("All").' -- ('.$langs->trans('VisibleEverywhere').')';
|
||||
$elementList['none'] = '-- '.$langs->trans("None").' -- ('.$langs->trans('VisibleNowhere').')';
|
||||
|
||||
asort($elementList);
|
||||
//asort($elementList);
|
||||
|
||||
$id = 25;
|
||||
|
||||
@ -303,7 +300,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
// We modify the line
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
{
|
||||
$rowidcol = "rowid";
|
||||
@ -414,7 +411,7 @@ $formadmin = new FormAdmin($db);
|
||||
$help_url = '';
|
||||
$title = $langs->trans("EMailsSetup");
|
||||
|
||||
llxHeader('', $title);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$linkback = '';
|
||||
$titlepicto = 'title_setup';
|
||||
@ -430,10 +427,9 @@ if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
|
||||
$sql = "SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
|
||||
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
|
||||
$sql .= " WHERE entity IN (".getEntity('email_template').")";
|
||||
if (!$user->admin)
|
||||
@ -481,7 +477,7 @@ if ($action == 'view') {
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); $align="center"; }
|
||||
if ($fieldlist[$field] == 'private') { $align = 'center'; }
|
||||
if ($fieldlist[$field] == 'position') { $align = 'center'; }
|
||||
|
||||
@ -492,7 +488,7 @@ if ($action == 'view') {
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
print '<td class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value]))
|
||||
{
|
||||
@ -570,14 +566,12 @@ if ($action == 'view') {
|
||||
} elseif ($tmpfieldlist == 'joinfiles') {
|
||||
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">';
|
||||
} else {
|
||||
if ($context != 'hide') {
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
} else print ' ';
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
print '</td>';
|
||||
if ($tmpfieldlist == 'topic') {
|
||||
@ -591,11 +585,6 @@ if ($action == 'view') {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$colspan = count($fieldlist) + 1;
|
||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
@ -641,26 +630,24 @@ if ($resql)
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
$filterfound = 0;
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($value == 'label') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
} elseif ($value == 'lang') {
|
||||
print '<td class="liste_titre">';
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
print '</td>';
|
||||
} elseif ($value == 'fk_user') {
|
||||
print '<td class="liste_titre">';
|
||||
$restrictid = array();
|
||||
if (!$user->admin) $restrictid = array($user->id);
|
||||
//var_dump($restrictid);
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth150');
|
||||
print '</td>';
|
||||
} elseif ($value == 'topic') {
|
||||
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
} elseif ($value == 'type_template') {
|
||||
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1, '', 0, 1);
|
||||
print '</td>';
|
||||
} elseif (!in_array($value, array('content', 'content_lines'))) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
@ -792,6 +779,13 @@ if ($resql)
|
||||
|
||||
print "</tr>\n";
|
||||
} else {
|
||||
if ($obj->module) {
|
||||
$tempmodulekey = $obj->module;
|
||||
if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$keyforobj = 'type_template';
|
||||
if (!in_array($obj->$keyforobj, array_keys($elementList)))
|
||||
{
|
||||
@ -819,22 +813,26 @@ if ($resql)
|
||||
{
|
||||
if (in_array($fieldlist[$field], array('content', 'content_lines'))) continue;
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$align = "";
|
||||
$class = "tddict";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($value == 'label' || $value == 'topic')
|
||||
{
|
||||
if ($value == 'label' || $value == 'topic') {
|
||||
$valuetoshow = dol_escape_htmltag($valuetoshow);
|
||||
}
|
||||
if ($value == 'type_template')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
if ($value == 'label') {
|
||||
$class .= ' tdoverflowmax100';
|
||||
}
|
||||
if ($value == 'lang' && $valuetoshow)
|
||||
{
|
||||
/*if ($value == 'topic') {
|
||||
$class .= ' tdoverflowmax300';
|
||||
}*/
|
||||
if ($value == 'type_template') {
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
$align = "center";
|
||||
}
|
||||
if ($value == 'lang' && $valuetoshow) {
|
||||
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
||||
}
|
||||
if ($value == 'fk_user')
|
||||
{
|
||||
if ($value == 'fk_user') {
|
||||
if ($valuetoshow > 0)
|
||||
{
|
||||
$fuser = new User($db);
|
||||
@ -842,29 +840,25 @@ if ($resql)
|
||||
$valuetoshow = $fuser->getNomUrl(1);
|
||||
}
|
||||
}
|
||||
if ($value == 'private')
|
||||
{
|
||||
if ($value == 'private') {
|
||||
$align = "center";
|
||||
if ($valuetoshow) $valuetoshow = yn($valuetoshow);
|
||||
else $valuetoshow = '';
|
||||
}
|
||||
if ($value == 'position')
|
||||
{
|
||||
if ($value == 'position') {
|
||||
$align = "center";
|
||||
}
|
||||
if ($value == 'joinfiles')
|
||||
{
|
||||
if ($value == 'joinfiles') {
|
||||
$align = "center";
|
||||
if ($valuetoshow) $valuetoshow = 1;
|
||||
else $valuetoshow = '';
|
||||
}
|
||||
if ($align) $class .= ' '.$align;
|
||||
|
||||
$class = 'tddict';
|
||||
// Show value for field
|
||||
if ($showfield)
|
||||
{
|
||||
if ($showfield) {
|
||||
print '<!-- '.$fieldlist[$field].' -->';
|
||||
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
print '<td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -963,7 +957,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf, $langs, $user, $db;
|
||||
global $form;
|
||||
global $elementList, $sourceList;
|
||||
global $elementList;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
@ -972,9 +966,8 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
if ($fieldlist[$field] == 'fk_user')
|
||||
{
|
||||
print '<td>';
|
||||
if ($user->admin)
|
||||
{
|
||||
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
if ($user->admin) {
|
||||
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
} else {
|
||||
if ($context == 'add') // I am not admin and we show the add form
|
||||
{
|
||||
@ -1017,14 +1010,14 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
// Le type de template
|
||||
elseif ($fieldlist[$field] == 'type_template')
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="center">';
|
||||
if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList)))
|
||||
{
|
||||
// Current tempalte type is an unknown type, so we must keep it as it is.
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
|
||||
print $obj->{$fieldlist[$field]};
|
||||
} else {
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone');
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1, '', 0, 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||
|
||||
@ -330,10 +330,10 @@ if ($conf->use_javascript_ajax)
|
||||
$entry .= '</td></tr></table>';
|
||||
|
||||
$buttons = '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons .= ' ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons .= ' ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
|
||||
$data[] = array(
|
||||
'rowid'=>$menu['rowid'],
|
||||
|
||||
@ -28,6 +28,8 @@
|
||||
* \brief Page to activate/disable all modules
|
||||
*/
|
||||
|
||||
if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -662,9 +664,9 @@ if ($mode == 'common' || $mode == 'commonkanban')
|
||||
// Version (with picto warning or not)
|
||||
$version = $objMod->getVersion(0);
|
||||
$versiontrans = '';
|
||||
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
|
||||
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright');
|
||||
if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright');
|
||||
if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright');
|
||||
if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
|
||||
$versiontrans .= $objMod->getVersion(1);
|
||||
}
|
||||
@ -701,11 +703,11 @@ if ($mode == 'common' || $mode == 'commonkanban')
|
||||
if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
|
||||
} else {
|
||||
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
||||
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">';
|
||||
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">';
|
||||
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$codeenabledisable .= '</a>';
|
||||
} else {
|
||||
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value='.$modName.'&mode='.$mode.'&confirm=yes'.$param.'">';
|
||||
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=reset&value='.$modName.'&mode='.$mode.'&confirm=yes'.$param.'">';
|
||||
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$codeenabledisable .= '</a>';
|
||||
}
|
||||
@ -1151,8 +1153,6 @@ if ($mode == 'develop')
|
||||
|
||||
print '<tr class="oddeven" height="80">'."\n";
|
||||
print '<td class="left">';
|
||||
//span class="fa fa-bug"></span>
|
||||
//print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner.png">';
|
||||
print '<div class="imgmaxheight50 logo_setup"></div>';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
|
||||
|
||||
@ -58,50 +58,50 @@ if (!$mode) $mode = 'setup';
|
||||
|
||||
if ($action == 'setconst' && $user->admin)
|
||||
{
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||
|
||||
foreach ($setupconstarray as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
foreach ($setupconstarray as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
|
||||
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
}
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
@ -131,275 +131,275 @@ if (GETPOST('error')) {
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
{
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
|
||||
foreach ($list as $key)
|
||||
{
|
||||
$supported = 0;
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported = 1;
|
||||
if (!$supported) continue; // show only supported
|
||||
foreach ($list as $key)
|
||||
{
|
||||
$supported = 0;
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported = 1;
|
||||
if (!$supported) continue; // show only supported
|
||||
|
||||
|
||||
$OAUTH_SERVICENAME = 'Unknown';
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'GitHub';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'Google';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if (!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
$OAUTH_SERVICENAME = 'Unknown';
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'GitHub';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'Google';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if (!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeTest';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeLive';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeTest';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeLive';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
$urltorenew = '';
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
// Token
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try {
|
||||
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
// Return an error if token not found
|
||||
}
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
// Token
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try {
|
||||
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
// Return an error if token not found
|
||||
}
|
||||
|
||||
// Set other properties
|
||||
$refreshtoken = false;
|
||||
$expiredat = '';
|
||||
// Set other properties
|
||||
$refreshtoken = false;
|
||||
$expiredat = '';
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
|
||||
$endoflife = $tokenobj->getEndOfLife();
|
||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
}
|
||||
}
|
||||
$endoflife = $tokenobj->getEndOfLife();
|
||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$submit_enabled = 0;
|
||||
$submit_enabled = 0;
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("SeePreviousTab");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("SeePreviousTab");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("IsTokenGenerated");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
|
||||
else print $langs->trans("NoAccessToken");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// Links to delete/checks token
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew)
|
||||
{
|
||||
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms)
|
||||
{
|
||||
print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("IsTokenGenerated");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
|
||||
else print $langs->trans("NoAccessToken");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// Links to delete/checks token
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew)
|
||||
{
|
||||
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms)
|
||||
{
|
||||
print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//var_dump($tokenobj);
|
||||
print $tokenobj->getAccessToken().'<br>';
|
||||
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
|
||||
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//var_dump($tokenobj);
|
||||
print $tokenobj->getAccessToken().'<br>';
|
||||
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
|
||||
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||
print ''.join(',',$tokenobj->getExtraParams());
|
||||
print '</textarea>';*/
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
// Token refresh
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_REFRESH").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($refreshtoken);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
// Token refresh
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_REFRESH").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($refreshtoken);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Token expired
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($expire);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Token expired
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($expire);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Token expired at
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Token expired at
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
if (!empty($driver))
|
||||
{
|
||||
if ($submit_enabled) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>';
|
||||
}
|
||||
}
|
||||
if (!empty($driver))
|
||||
{
|
||||
if ($submit_enabled) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
{
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
if (!empty($driver))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
if (count($printer->getlistAvailablePrinters())) {
|
||||
if ($printer->listAvailablePrinters() == 0) {
|
||||
print $printer->resprint;
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('PleaseConfigureDriverfromList');
|
||||
}
|
||||
}
|
||||
print '<table class="noborder centpercent">';
|
||||
if (!empty($driver))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
if (count($printer->getlistAvailablePrinters())) {
|
||||
if ($printer->listAvailablePrinters() == 0) {
|
||||
print $printer->resprint;
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('PleaseConfigureDriverfromList');
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($mode == 'userconf' && $user->admin)
|
||||
{
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
print '<th>'.$langs->trans("PrintDriver").'</th>';
|
||||
print '<th>'.$langs->trans("Printer").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterLocation").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterId").'</th>';
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
print '<th>'.$langs->trans("PrintDriver").'</th>';
|
||||
print '<th>'.$langs->trans("Printer").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterLocation").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterId").'</th>';
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -43,7 +43,7 @@ $printername = GETPOST('printername', 'alpha');
|
||||
$printerid = GETPOST('printerid', 'int');
|
||||
$parameter = GETPOST('parameter', 'alpha');
|
||||
|
||||
$template = GETPOST('template', 'alpha');
|
||||
$template = GETPOST('template', 'nohtml');
|
||||
$templatename = GETPOST('templatename', 'alpha');
|
||||
$templateid = GETPOST('templateid', 'int');
|
||||
|
||||
@ -53,16 +53,16 @@ if (!$mode) $mode = 'config';
|
||||
|
||||
// used in library escpos maybe useful if php doesn't support gzdecode
|
||||
if (!function_exists('gzdecode')) {
|
||||
/**
|
||||
* Gzdecode
|
||||
*
|
||||
* @param string $data data to deflate
|
||||
* @return string data deflated
|
||||
*/
|
||||
function gzdecode($data)
|
||||
{
|
||||
return gzinflate(substr($data, 10, -8));
|
||||
}
|
||||
/**
|
||||
* Gzdecode
|
||||
*
|
||||
* @param string $data data to deflate
|
||||
* @return string data deflated
|
||||
*/
|
||||
function gzdecode($data)
|
||||
{
|
||||
return gzinflate(substr($data, 10, -8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,167 +71,167 @@ if (!function_exists('gzdecode')) {
|
||||
*/
|
||||
|
||||
if ($action == 'addprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printername)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printername)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (empty($parameter)) {
|
||||
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
|
||||
}
|
||||
if (empty($parameter)) {
|
||||
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterAdded", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterAdded", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'deleteprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->deletePrinter($printerid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->deletePrinter($printerid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterDeleted", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterDeleted", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'updateprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterUpdated", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterUpdated", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'testprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// test
|
||||
$ret = $printer->sendTestToPrinter($printerid);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
// test
|
||||
$ret = $printer->sendTestToPrinter($printerid);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'testtemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
// if (empty($printerid)) {
|
||||
// $error++;
|
||||
// setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
// }
|
||||
$error = 0;
|
||||
// if (empty($printerid)) {
|
||||
// $error++;
|
||||
// setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
// }
|
||||
|
||||
// if (! $error) {
|
||||
// if (! $error) {
|
||||
// test
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
//$object->initAsSpecimen();
|
||||
$object->fetch(18);
|
||||
//var_dump($object->lines);
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'updatetemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($templateid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($templateid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateUpdated", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateUpdated", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'addtemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($templatename)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($templatename)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addTemplate($templatename, $template);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addTemplate($templatename, $template);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateAdded", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateAdded", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'deletetemplate' && $user->admin) {
|
||||
@ -273,116 +273,116 @@ $head = receiptprinteradmin_prepare_head($mode);
|
||||
|
||||
// mode = config
|
||||
if ($mode == 'config' && $user->admin) {
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<input type="hidden" name="action" value="addprinter">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updateprinter">';
|
||||
}
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<input type="hidden" name="action" value="addprinter">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updateprinter">';
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Type").'</th>';
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listprinters();
|
||||
$nbofprinters = count($printer->listprinters);
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Type").'</th>';
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listprinters();
|
||||
$nbofprinters = count($printer->listprinters);
|
||||
|
||||
if ($action != 'editprinter') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="printername"></td>';
|
||||
$ret = $printer->selectTypePrinter();
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter();
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||
print '<td class="right">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($action != 'editprinter') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="printername"></td>';
|
||||
$ret = $printer->selectTypePrinter();
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter();
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||
print '<td class="right">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
for ($line = 0; $line < $nbofprinters; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editprinter' && $printer->listprinters[$line]['rowid'] == $printerid) {
|
||||
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
|
||||
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||
print '<td>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_type_name']).'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||
// edit icon
|
||||
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
for ($line = 0; $line < $nbofprinters; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editprinter' && $printer->listprinters[$line]['rowid'] == $printerid) {
|
||||
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
|
||||
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||
print '<td>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_type_name']).'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||
// edit icon
|
||||
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
// mode = template
|
||||
@ -390,56 +390,56 @@ if ($mode == 'template' && $user->admin) {
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="action" value="addtemplate">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="action" value="addtemplate">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Template").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listPrintersTemplates();
|
||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
$max = count($printer->listprinterstemplates);
|
||||
for ($line = 0; $line < $max; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||
// edit icon
|
||||
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Template").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listPrintersTemplates();
|
||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
$max = count($printer->listprinterstemplates);
|
||||
for ($line = 0; $line < $max; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||
// edit icon
|
||||
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != 'edittemplate') {
|
||||
print '<tr>';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||
@ -448,35 +448,35 @@ if ($mode == 'template' && $user->admin) {
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
if ($action != 'edittemplate') {
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$langs->loadLangs(array("bills", "companies"));
|
||||
foreach ($printer->tags as $key => $val) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><'.$key.'></td><td>'.$langs->trans($val).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
$langs->loadLangs(array("bills", "companies"));
|
||||
foreach ($printer->tags as $key => $val) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>{'.$key.'}</td><td>'.$langs->trans($val).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -45,9 +45,9 @@ $upload_dir = $conf->admin->dir_temp;
|
||||
|
||||
if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_add_file_process($upload_dir, 1, 0, 'userfile');
|
||||
dol_add_file_process($upload_dir, 1, 0, 'userfile');
|
||||
}
|
||||
|
||||
if ($action == 'updateform')
|
||||
@ -144,14 +144,14 @@ print '</td>';
|
||||
print '<td>';
|
||||
if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$basedir = preg_replace('/"/', '', dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
|
||||
$listdir = explode(';', ini_get('safe_mode_exec_dir'));
|
||||
if (!in_array($basedir, $listdir))
|
||||
{
|
||||
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
|
||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||
}
|
||||
$langs->load("errors");
|
||||
$basedir = preg_replace('/"/', '', dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
|
||||
$listdir = explode(';', ini_get('safe_mode_exec_dir'));
|
||||
if (!in_array($basedir, $listdir))
|
||||
{
|
||||
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
|
||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
|
||||
|
||||
@ -49,7 +49,7 @@ llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("PerfDolibarr"), '', 'title_setup');
|
||||
|
||||
print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
|
||||
@ -265,14 +265,19 @@ $db->close();
|
||||
*/
|
||||
function getActivatedExtensions()
|
||||
{
|
||||
$file = getConfigFilePath();
|
||||
$handle = fopen(GetConfigFilePath(), "r");
|
||||
$file = trim(getConfigFilePath());
|
||||
$handle = fopen($file, "r");
|
||||
$content = fread($handle, filesize($file));
|
||||
|
||||
fclose($handle);
|
||||
|
||||
$configLines = explode("\r", $content);
|
||||
|
||||
// For compatibility with LF (Line Feed)
|
||||
if (empty($configLines) || count($configLines) < 2) {
|
||||
$configLines = explode("\n", $content);
|
||||
}
|
||||
|
||||
$extensions = array();
|
||||
$lastLine = "";
|
||||
|
||||
@ -281,11 +286,13 @@ function getActivatedExtensions()
|
||||
$line = trim($line);
|
||||
|
||||
// ignore comment lines
|
||||
if (substr($line, 0, 1) === ";")
|
||||
if (substr($line, 0, 1) === ";" || empty($line))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// var_dump($line);
|
||||
|
||||
// extension
|
||||
if (substr($line, 0, 9) === "extension" && substr($line, 0, 10) !== "extension_")
|
||||
{
|
||||
|
||||
143
htdocs/admin/system/security.php
Normal file
143
htdocs/admin/system/security.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/system/security.php
|
||||
* \brief Page to show Security information
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("install", "other", "admin"));
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
if (GETPOST('action', 'aZ09') == 'donothing')
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$nowstring = dol_print_date(dol_now(), 'dayhourlog');
|
||||
|
||||
llxHeader();
|
||||
|
||||
print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
|
||||
|
||||
// Recupere la version de PHP
|
||||
$phpversion = version_php();
|
||||
print "<br><strong>PHP</strong> - ".$langs->trans("Version").": ".$phpversion."<br>\n";
|
||||
|
||||
// Recupere la version du serveur web
|
||||
print "<br><strong>Web server</strong> - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ConfigFile"), '', '');
|
||||
|
||||
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
|
||||
// dolibarr_main_prod
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', '');
|
||||
|
||||
print '<strong>'.$langs->trans("PermissionOnFileInWebRoot").'</strong>: ';
|
||||
// TODO
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("Modules"), '', '');
|
||||
|
||||
// XDebug
|
||||
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
|
||||
$test = !function_exists('xdebug_is_enabled');
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
|
||||
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module log
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("Syslog"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
$test = empty($conf->debugbar->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else {
|
||||
print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"), '', '');
|
||||
|
||||
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
|
||||
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." (Recommanded value: 'password_hash')<br>";
|
||||
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
|
||||
print '<br>';
|
||||
// TODO
|
||||
|
||||
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
|
||||
// TODO
|
||||
print '<br>';
|
||||
|
||||
print '<strong>'.$langs->trans("SecurityAudit").'</strong>: ';
|
||||
// TODO Disabled or enabled ?
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -65,6 +65,7 @@ if ($action == 'delete')
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -119,7 +120,9 @@ if (in_array($type, array('pgsql'))) {
|
||||
print "});\n";
|
||||
print "</script>\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("Backup"), '', 'title_setup');
|
||||
$title = $langs->trans("Backup");
|
||||
|
||||
print load_fiche_titre($title, '', 'title_setup');
|
||||
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
|
||||
|
||||
print '<div class="center opacitymedium">';
|
||||
@ -139,7 +142,9 @@ print '<br>';
|
||||
|
||||
print '<div id="backupdatabaseleft" class="fichehalfleft" >';
|
||||
|
||||
print load_fiche_titre($title ? $title : $langs->trans("BackupDumpWizard"));
|
||||
$title = $langs->trans("BackupDumpWizard");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<table width="100%" class="'.($useinecm ? 'nobordernopadding' : 'liste').' nohover">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -155,19 +160,19 @@ print '<td class="tdtop">';
|
||||
print '<div id="div_container_exportoptions">';
|
||||
print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
|
||||
print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
|
||||
print '<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
|
||||
print '</div>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
|
||||
print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
|
||||
print '<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
|
||||
print '</div>';
|
||||
} elseif (in_array($type, array('pgsql'))) {
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
|
||||
print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
|
||||
print '</div>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
|
||||
print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
|
||||
print '</div>';
|
||||
} else {
|
||||
print 'No method available with database '.$label;
|
||||
print 'No method available with database '.$label;
|
||||
}
|
||||
print '</fieldset>';
|
||||
print '</div>';
|
||||
@ -178,200 +183,200 @@ print '<td class="tdtop">';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions">';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</div>';
|
||||
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="NONE" selected>NONE</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '<option value="DB2">DB2</option>';
|
||||
print '<option value="MAXDB">MAXDB</option>';
|
||||
print '<option value="MYSQL323">MYSQL323</option>';
|
||||
print '<option value="MYSQL40">MYSQL40</option>';
|
||||
print '<option value="MSSQL">MSSQL</option>';
|
||||
print '<option value="ORACLE">ORACLE</option>';
|
||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="NONE" selected>NONE</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '<option value="DB2">DB2</option>';
|
||||
print '<option value="MAXDB">MAXDB</option>';
|
||||
print '<option value="MYSQL323">MYSQL323</option>';
|
||||
print '<option value="MYSQL40">MYSQL40</option>';
|
||||
print '<option value="MSSQL">MSSQL</option>';
|
||||
print '<option value="ORACLE">ORACLE</option>';
|
||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
||||
print '<label for="checkbox_use_quick">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
||||
print '<label for="checkbox_use_quick">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '</label>';
|
||||
print '<br/>';
|
||||
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
|
||||
print '<input type="checkbox" name="drop"'.((! GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '<input type="checkbox" name="drop"'.((! GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
|
||||
print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
|
||||
print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
|
||||
print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
|
||||
print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print "<!-- Fieldset mysql_nobin -->\n";
|
||||
print '<fieldset id="mysql_nobin_options">';
|
||||
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print "<!-- Fieldset mysql_nobin -->\n";
|
||||
print '<fieldset id="mysql_nobin_options">';
|
||||
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
|
||||
print '</div>';
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</fieldset>';
|
||||
print '</div>';
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("Datas").'</legend>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("Datas").'</legend>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
}
|
||||
|
||||
if (in_array($type, array('pgsql'))) {
|
||||
print "<!-- Fieldset pg_dump -->\n";
|
||||
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
|
||||
print "<!-- Fieldset pg_dump -->\n";
|
||||
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@ -418,16 +423,16 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
// 'id' => 'radio_compression_zip',
|
||||
// 'label' => $langs->trans("FormatZip")
|
||||
// );
|
||||
$compression['bz'] = array(
|
||||
$compression['bz'] = array(
|
||||
'function' => 'bzopen',
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
} else {
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
@ -480,14 +485,14 @@ print '<br>';
|
||||
|
||||
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||
{
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
//print $paramclear;
|
||||
//print $paramclear;
|
||||
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
@ -568,20 +573,20 @@ $filecompression['zip'] = array('function' => 'dol_compress_dir', 'id' => 'radio
|
||||
$i = 0;
|
||||
foreach ($filecompression as $key => $val)
|
||||
{
|
||||
if (!$val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
} else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
if (!$val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
} else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -122,7 +122,7 @@ $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 = GETPOST("mysqldump", 'none'); // 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))
|
||||
@ -163,7 +163,7 @@ if ($what == 'mysqlnobin')
|
||||
// POSTGRESQL
|
||||
if ($what == 'postgresql')
|
||||
{
|
||||
$cmddump = GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump = GETPOST("postgresqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump = dol_sanitizePathName($cmddump);
|
||||
|
||||
/* Not required, the command is output on screen but not ran for pgsql
|
||||
|
||||
@ -113,7 +113,7 @@ $utils = new Utils($db);
|
||||
if ($compression == 'zip')
|
||||
{
|
||||
$file .= '.zip';
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.log|\/temp\/|documents\/admin\/documents\/)/');
|
||||
$ret = dol_compress_dir(DOL_DATA_ROOT, $outputdir."/".$file, $compression, '/(\.back|\.old|\.log|[\\\/]temp[\\\/]|documents[\\\/]admin[\\\/]documents[\\\/])/i');
|
||||
if ($ret < 0)
|
||||
{
|
||||
if ($ret == -2) {
|
||||
|
||||
@ -167,7 +167,7 @@ $usefilter = 0;
|
||||
|
||||
$sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,";
|
||||
$sql .= " e.fk_user, e.description, e.prefix_session,";
|
||||
$sql .= " u.login";
|
||||
$sql .= " u.login, u.admin, u.entity, u.firstname, u.lastname, u.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
$sql .= " WHERE e.entity IN (".getEntity('event').")";
|
||||
@ -337,7 +337,18 @@ if ($result)
|
||||
{
|
||||
$userstatic->id = $obj->fk_user;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->admin = $obj->admin;
|
||||
$userstatic->entity = $obj->entity;
|
||||
$userstatic->status = $obj->status;
|
||||
|
||||
print $userstatic->getLoginUrl(1);
|
||||
if (!empty($conf->multicompany->enabled) && $userstatic->admin && !$userstatic->entity)
|
||||
{
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"');
|
||||
} elseif ($userstatic->admin)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"');
|
||||
}
|
||||
} else print ' ';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -73,16 +73,16 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$transkey = '';
|
||||
$transvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
$transkey = '';
|
||||
$transvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
@ -139,25 +139,25 @@ if ($action == 'add')
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")";
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
$transkey = "";
|
||||
$transvalue = "";
|
||||
} else {
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -196,15 +196,15 @@ $enabledisablehtml = '';
|
||||
$enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
||||
@ -247,43 +247,43 @@ if ($mode == 'overwrite')
|
||||
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disablededit = ' disabled';
|
||||
|
||||
print '<div class="justify"><span class="opacitymedium">';
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print ' ('.$langs->trans("SeeAlso", '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>').')<br>';
|
||||
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||
print '</span></div>';
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print ' ('.$langs->trans("SeeAlso", '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>').')<br>';
|
||||
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||
print '</span></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<input type="hidden" name="action" value="'.($action == 'edit' ? 'update' : 'add').'">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Line to add new record
|
||||
print "\n";
|
||||
// Line to add new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue) ? $transvalue : "").'">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue) ? $transvalue : "").'">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
||||
@ -292,118 +292,118 @@ if ($mode == 'overwrite')
|
||||
}
|
||||
else
|
||||
{*/
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnabledTranslationOverwriteBefore")).'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnabledTranslationOverwriteBefore")).'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
// Show constants
|
||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "\n";
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
} else {
|
||||
print dol_escape_htmltag($obj->transvalue);
|
||||
}
|
||||
print '</td>';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
} else {
|
||||
print dol_escape_htmltag($obj->transvalue);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="submit" class="button buttongen" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button buttongen" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
} else {
|
||||
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print '<td class="center">';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="submit" class="button buttongen" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<input type="submit" class="button buttongen" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
} else {
|
||||
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'searchkey')
|
||||
{
|
||||
$langcode = GETPOST('langcode') ?GETPOST('langcode') : $langs->defaultlang;
|
||||
$langcode = GETPOST('langcode') ?GETPOST('langcode') : $langs->defaultlang;
|
||||
|
||||
$newlang = new Translate('', $conf);
|
||||
$newlang->setDefaultLang($langcode);
|
||||
$newlang = new Translate('', $conf);
|
||||
$newlang->setDefaultLang($langcode);
|
||||
|
||||
$newlangfileonly = new Translate('', $conf);
|
||||
$newlangfileonly->setDefaultLang($langcode);
|
||||
$newlangfileonly = new Translate('', $conf);
|
||||
$newlangfileonly->setDefaultLang($langcode);
|
||||
|
||||
$recordtoshow = array();
|
||||
$recordtoshow = array();
|
||||
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
$nbtotaloffiles = 0;
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
$nbtotaloffiles = 0;
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
var_dump($transvalue);*/
|
||||
if (empty($langcode) || $langcode == '-1') $nbempty++;
|
||||
if (empty($transkey)) $nbempty++;
|
||||
if (empty($transvalue)) $nbempty++;
|
||||
if ($action == 'search' && ($nbempty > 999)) // 999 to disable this
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
|
||||
} else {
|
||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||
$i = 0;
|
||||
foreach ($modulesdir as $keydir => $tmpsearchdir)
|
||||
{
|
||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||
if (empty($langcode) || $langcode == '-1') $nbempty++;
|
||||
if (empty($transkey)) $nbempty++;
|
||||
if (empty($transvalue)) $nbempty++;
|
||||
if ($action == 'search' && ($nbempty > 999)) // 999 to disable this
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
|
||||
} else {
|
||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||
$i = 0;
|
||||
foreach ($modulesdir as $keydir => $tmpsearchdir)
|
||||
{
|
||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||
|
||||
// Directory of translation files
|
||||
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
|
||||
$dir_lang_osencoded = dol_osencode($dir_lang);
|
||||
// Directory of translation files
|
||||
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
|
||||
$dir_lang_osencoded = dol_osencode($dir_lang);
|
||||
|
||||
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
foreach ($filearray as $file)
|
||||
{
|
||||
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
foreach ($filearray as $file)
|
||||
{
|
||||
$tmpfile = preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$moduledirname = (basename(dirname(dirname($dir_lang))));
|
||||
|
||||
@ -416,135 +416,135 @@ if ($mode == 'searchkey')
|
||||
if ($result < 0) print 'Failed to load language file '.$tmpfile.'<br>'."\n";
|
||||
else $nbtotaloffiles++;
|
||||
//print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Now search into translation array
|
||||
foreach ($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) continue;
|
||||
if ($transvalue && !preg_match('/'.preg_quote($transvalue, '/').'/i', $val)) continue;
|
||||
$recordtoshow[$key] = $val;
|
||||
}
|
||||
}
|
||||
// Now search into translation array
|
||||
foreach ($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) continue;
|
||||
if ($transvalue && !preg_match('/'.preg_quote($transvalue, '/').'/i', $val)) continue;
|
||||
$recordtoshow[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
//print '<br>';
|
||||
$nbtotalofrecordswithoutfilters = count($newlang->tab_translate);
|
||||
$nbtotalofrecords = count($recordtoshow);
|
||||
$num = $limit + 1;
|
||||
if (($offset + $num) > $nbtotalofrecords) $num = $limit;
|
||||
//print '<br>';
|
||||
$nbtotalofrecordswithoutfilters = count($newlang->tab_translate);
|
||||
$nbtotalofrecords = count($recordtoshow);
|
||||
$num = $limit + 1;
|
||||
if (($offset + $num) > $nbtotalofrecords) $num = $limit;
|
||||
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
if ($nbtotalofrecords > 0) $title .= ' <span class="opacitymedium colorblack paddingleft">('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')</span>';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
if ($nbtotalofrecords > 0) $title .= ' <span class="opacitymedium colorblack paddingleft">('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')</span>';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Line to search new record
|
||||
print "\n";
|
||||
// Line to search new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="1" name="entitysearch" value="'.$conf->entity.'">';
|
||||
}
|
||||
else
|
||||
{*/
|
||||
print '<input type="hidden" name="entitysearch" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="nowrap right">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<input type="hidden" name="entitysearch" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="nowrap right">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow);
|
||||
|
||||
// Show result
|
||||
$i = 0;
|
||||
foreach ($recordtoshow as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($i <= $offset) continue;
|
||||
if ($i > ($offset + $limit)) break;
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td class="right nowraponall">';
|
||||
if (!empty($newlangfileonly->tab_translate[$key]))
|
||||
{
|
||||
if ($val != $newlangfileonly->tab_translate[$key])
|
||||
{
|
||||
// retrieve rowid
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE transkey = '".$key."'";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
}
|
||||
print '<a class="editfielda reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=edit">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
print ' ';
|
||||
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
|
||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
//print $key.'-'.$val;
|
||||
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.$langcode.'&transkey='.$key.'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
|
||||
}
|
||||
// Show result
|
||||
$i = 0;
|
||||
foreach ($recordtoshow as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($i <= $offset) continue;
|
||||
if ($i > ($offset + $limit)) break;
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td class="right nowraponall">';
|
||||
if (!empty($newlangfileonly->tab_translate[$key]))
|
||||
{
|
||||
if ($val != $newlangfileonly->tab_translate[$key])
|
||||
{
|
||||
// retrieve rowid
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE transkey = '".$key."'";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
}
|
||||
print '<a class="editfielda reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=edit">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
print ' ';
|
||||
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
|
||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
//print $key.'-'.$val;
|
||||
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.$langcode.'&transkey='.$key.'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$transifexlangfile = '$'; // $ means 'All'
|
||||
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$transifexlangfile = '$'; // $ means 'All'
|
||||
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
||||
|
||||
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto($langs->trans('FixOnTransifex'), 'globe').'</a>';
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto($langs->trans('FixOnTransifex'), 'globe').'</a>';
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>'.$val.'</td>';
|
||||
}*/
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -124,252 +124,252 @@ $sourceList = array();
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield = explode(',', $tabfield[$id]);
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', $tabfield[$id]);
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
// Check that all fields are filled
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (!empty($_POST['ref']))
|
||||
{
|
||||
$websitekey = strtolower($_POST['ref']);
|
||||
}
|
||||
// Clean parameters
|
||||
if (!empty($_POST['ref']))
|
||||
{
|
||||
$websitekey = strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/* $website=new Website($db);
|
||||
/* $website=new Website($db);
|
||||
$website->ref=
|
||||
$website->description=
|
||||
$website->virtualhost=
|
||||
$website->create($user); */
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",status)";
|
||||
$sql .= " VALUES(";
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",status)";
|
||||
$sql .= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $newid.",";
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= ",1)";
|
||||
// List of values
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $newid.",";
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= ",1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$website = new Website($db);
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$website->fetch($rowid);
|
||||
$website = new Website($db);
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$website->fetch($rowid);
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
|
||||
{
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
$sql .= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
|
||||
{
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
$sql .= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
||||
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors');
|
||||
} else {
|
||||
@rename($srcfile, $destfile);
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors');
|
||||
} else {
|
||||
@rename($srcfile, $destfile);
|
||||
|
||||
// We must now rename $website->ref into $newname inside files
|
||||
$arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html');
|
||||
$listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$');
|
||||
// We must now rename $website->ref into $newname inside files
|
||||
$arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html');
|
||||
$listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$');
|
||||
foreach ($listofilestochange as $key => $value)
|
||||
{
|
||||
dolReplaceInFile($value['fullname'], $arrayreplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
{
|
||||
dolReplaceInFile($value['fullname'], $arrayreplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel', 'alpha'))
|
||||
{
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$website = new Website($db);
|
||||
$website->fetch($rowid);
|
||||
$website = new Website($db);
|
||||
$website->fetch($rowid);
|
||||
|
||||
if ($website->id > 0)
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if ($website->id > 0)
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($website->ref)
|
||||
{
|
||||
dol_delete_dir_recursive($conf->website->dir_output.'/'.$website->ref);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, 'Failed to load website with id '.$rowid);
|
||||
}
|
||||
if ($website->ref)
|
||||
{
|
||||
dol_delete_dir_recursive($conf->website->dir_output.'/'.$website->ref);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, 'Failed to load website with id '.$rowid);
|
||||
}
|
||||
}
|
||||
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ print "<br>\n";
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1, 220);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1, 220);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@ -420,205 +420,205 @@ if ($action == 'delete')
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused = 0;
|
||||
$var = false;
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused = 0;
|
||||
$var = false;
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$align = '';
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$align = '';
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td class="'.$align.'">';
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
elseif (!empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
print '<td colspan="4">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<td colspan="4">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val, 'alpha'))
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val, 'alpha'))
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
|
||||
print '<td colspan="3" class="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
print '<td colspan="3" class="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// List of websites in database
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<br>';
|
||||
// List of websites in database
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield = 1; // Par defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
/*
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield = 1; // Par defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
|
||||
{
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
|
||||
{
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$fieldname = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$fieldname;
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$fieldname = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$fieldname;
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $isdisable = 1; // true by default
|
||||
if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first.
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $isdisable = 1; // true by default
|
||||
if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first.
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&';
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
||||
print "</td>";
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
|
||||
else print '<td class="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
|
||||
else print '<td class="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
@ -649,7 +649,7 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$fieldname = $fieldlist[$field];
|
||||
$fieldname = $fieldlist[$field];
|
||||
if ($fieldlist[$field] == 'lang')
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -386,7 +386,7 @@ foreach ($object->fields as $key => $val)
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
|
||||
@ -85,7 +85,7 @@ $search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -311,6 +311,7 @@ foreach ($search as $key => $val)
|
||||
}
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||
}
|
||||
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
@ -485,7 +486,7 @@ foreach ($object->fields as $key => $val)
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
|
||||
@ -113,7 +113,7 @@ if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
|
||||
// print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -112,7 +112,7 @@ if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
print $form->selectUnits($line->fk_unit, "units");
|
||||
// print $form->selectUnits($line->fk_unit, "units");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ print '</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
print '<td class="linecoluseunit nowrap left">';
|
||||
$label = $line->getLabelOfUnit('short');
|
||||
$label = $tmpproduct->getLabelOfUnit('long');
|
||||
if ($label !== '') {
|
||||
print $langs->trans($label);
|
||||
}
|
||||
@ -111,21 +111,21 @@ print '</td>';
|
||||
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||
print '<td class="linecoledit center">';
|
||||
$coldisplay++;
|
||||
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
|
||||
} else {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
|
||||
} else {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecoldelete center">';
|
||||
$coldisplay++;
|
||||
if (($line->fk_prev_id == null) && empty($disableremove)) {
|
||||
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="linecoldelete center">';
|
||||
$coldisplay++;
|
||||
if (($line->fk_prev_id == null) && empty($disableremove)) {
|
||||
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
|
||||
print '<td class="linecolmove tdlineupdown center">';
|
||||
@ -146,14 +146,14 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||
$coldisplay++;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="3"></td>';
|
||||
$coldisplay = $coldisplay + 3;
|
||||
print '<td colspan="3"></td>';
|
||||
$coldisplay = $coldisplay + 3;
|
||||
}
|
||||
|
||||
if ($action == 'selectlines') {
|
||||
print '<td class="linecolcheck center">';
|
||||
print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
|
||||
print '</td>';
|
||||
print '<td class="linecolcheck center">';
|
||||
print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -141,7 +141,7 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
||||
</fieldset>
|
||||
|
||||
<!-- ========================= Cadre "Amount" ============================= -->
|
||||
<form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=valide_achat">
|
||||
<form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=validate_sell">
|
||||
<input type="hidden" name="hdnChoix" value="" />
|
||||
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
|
||||
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
|
||||
|
||||
@ -97,7 +97,7 @@ if ($obj_facturation->amountReturned()) {
|
||||
|
||||
</table>
|
||||
|
||||
<form id="frmValidation" class="formulaire2" method="post" action="validation_verif.php?action=valide_facture">
|
||||
<form id="frmValidation" class="formulaire2" method="post" action="validation_verif.php?action=validate_invoice">
|
||||
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
|
||||
<p class="note_label">
|
||||
<?php
|
||||
|
||||
@ -42,7 +42,7 @@ switch ($action)
|
||||
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
|
||||
break;
|
||||
|
||||
case 'valide_achat':
|
||||
case 'validate_sell':
|
||||
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
|
||||
|
||||
$company = new Societe($db);
|
||||
@ -112,7 +112,7 @@ switch ($action)
|
||||
break;
|
||||
|
||||
|
||||
case 'valide_facture':
|
||||
case 'validate_invoice':
|
||||
$now = dol_now();
|
||||
|
||||
// Recuperation de la date et de l'heure
|
||||
@ -344,7 +344,7 @@ switch ($action)
|
||||
}
|
||||
break;
|
||||
|
||||
// End of case: valide_facture
|
||||
// End of case: validate_invoice
|
||||
}
|
||||
|
||||
unset($_SESSION['serObjFacturation']);
|
||||
|
||||
@ -33,16 +33,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$langs->load("categories");
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref');
|
||||
$type = GETPOST('type');
|
||||
$ref = GETPOST('ref', 'alphanohtml');
|
||||
$type = GETPOST('type', 'alphanohtml');
|
||||
$action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit');
|
||||
$confirm = GETPOST('confirm');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$label = GETPOST('label');
|
||||
$description = GETPOST('description');
|
||||
$color = GETPOST('color', 'alpha');
|
||||
$label = GETPOST('label', 'alphanohtml');
|
||||
$description = GETPOST('description', 'restricthtml');
|
||||
$color = preg_replace('/[^0-9a-f#]/i', '', GETPOST('color', 'alphanohtml'));
|
||||
$visible = GETPOST('visible');
|
||||
$parent = GETPOST('parent');
|
||||
|
||||
|
||||
@ -44,8 +44,8 @@ $confirm = GETPOST('confirm');
|
||||
|
||||
if ($id == '' && $label == '')
|
||||
{
|
||||
dol_print_error('', 'Missing parameter id');
|
||||
exit();
|
||||
dol_print_error('', 'Missing parameter id');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -70,34 +70,34 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar
|
||||
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id) {
|
||||
$file = $_FILES['userfile'];
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if (empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]))
|
||||
{
|
||||
setEventMessage($file['name'][$i].' : '.$langs->trans(empty($file['tmp_name'][$i]) ? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
unset($file['name'][$i], $file['type'][$i], $file['tmp_name'][$i], $file['error'][$i], $file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($object->id) {
|
||||
$file = $_FILES['userfile'];
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if (empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]))
|
||||
{
|
||||
setEventMessage($file['name'][$i].' : '.$langs->trans(empty($file['tmp_name'][$i]) ? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
unset($file['name'][$i], $file['type'][$i], $file['tmp_name'][$i], $file['error'][$i], $file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($file['tmp_name'])) {
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
}
|
||||
if (!empty($file['tmp_name'])) {
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
|
||||
{
|
||||
$object->delete_photo($upload_dir."/".$_GET["file"]);
|
||||
$object->delete_photo($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
if ($action == 'addthumb' && $_GET["file"])
|
||||
{
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ if ($object->id)
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
@ -137,7 +137,7 @@ if ($object->id)
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@ -159,7 +159,7 @@ if ($object->id)
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -213,62 +213,62 @@ if ($object->id)
|
||||
|
||||
if (is_array($listofphoto) && count($listofphoto))
|
||||
{
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center">';
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center">';
|
||||
|
||||
foreach ($listofphoto as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
foreach ($listofphoto as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename = $obj['photo_vignette'];
|
||||
} else {
|
||||
$filename = $obj['photo'];
|
||||
}
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename = $obj['photo_vignette'];
|
||||
} else {
|
||||
$filename = $obj['photo'];
|
||||
}
|
||||
|
||||
// Nom affiche
|
||||
$viewfilename = $obj['photo'];
|
||||
// Nom affiche
|
||||
$viewfilename = $obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100 / $nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100 / $nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($nbphoto < 1)
|
||||
@ -277,7 +277,7 @@ if ($object->id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("ErrorUnknown");
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -83,43 +83,43 @@ $cancel != $langs->trans("Cancel") &&
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
// check parameters
|
||||
$forcelangprod = GETPOST('forcelangprod', 'alpha');
|
||||
$libelle = GETPOST('libelle', 'alpha');
|
||||
$desc = GETPOST('desc', 'restricthtml');
|
||||
$forcelangprod = GETPOST('forcelangprod', 'alpha');
|
||||
$libelle = GETPOST('libelle', 'alpha');
|
||||
$desc = GETPOST('desc', 'restricthtml');
|
||||
|
||||
if (empty($forcelangprod)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Translation'));
|
||||
}
|
||||
if (empty($forcelangprod)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Translation'));
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$forcelangprod).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
if (!$error) {
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$forcelangprod).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// update de l'objet
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
}
|
||||
if (!$error) {
|
||||
// update de l'objet
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
}
|
||||
|
||||
// sauvegarde en base
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
}
|
||||
// sauvegarde en base
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'add';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
if ($error) {
|
||||
$action = 'add';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Validation de l'edition
|
||||
@ -132,13 +132,13 @@ $cancel != $langs->trans("Cancel") &&
|
||||
|
||||
foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet
|
||||
{
|
||||
$libelle = GETPOST('libelle-'.$key, 'alpha');
|
||||
$desc = GETPOST('desc-'.$key);
|
||||
$libelle = GETPOST('libelle-'.$key, 'alpha');
|
||||
$desc = GETPOST('desc-'.$key);
|
||||
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$key).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$key).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
|
||||
if ($key == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
@ -149,17 +149,17 @@ $cancel != $langs->trans("Cancel") &&
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
if ($error) {
|
||||
$action = 'edit';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -181,10 +181,10 @@ $head = categories_prepare_head($object, $type);
|
||||
$cnt_trans = 0;
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
}
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
}
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'translation', $langs->trans($title), -1, 'category');
|
||||
@ -195,7 +195,7 @@ $object->ref = $object->label;
|
||||
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
foreach ($ways as $way) {
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
@ -238,11 +238,11 @@ print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '')
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
|
||||
if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
|
||||
if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
@ -258,20 +258,20 @@ if ($action == 'edit')
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="vedit">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Label
|
||||
$libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
|
||||
$libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$libelle.'"></td></tr>';
|
||||
// Desc
|
||||
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
|
||||
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
|
||||
$doleditor->Create();
|
||||
@ -293,20 +293,20 @@ if ($action == 'edit')
|
||||
print '</form>';
|
||||
} elseif ($action != 'add')
|
||||
{
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
if (!empty($object->multilangs))
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$s = picto_from_langcode($key);
|
||||
$s = picto_from_langcode($key);
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'&type='.$type.'">'.img_delete('', '').'</a></td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
||||
if (!empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>'.$object->multilangs[$key]["other"].'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>'.$object->multilangs[$key]["other"].'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
@ -329,11 +329,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="vadd">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Translation').'</td><td>';
|
||||
print $formadmin->select_language(GETPOST('forcelangprod', 'alpha'), 'forcelangprod', 0, $object->multilangs);
|
||||
print $formadmin->select_language(GETPOST('forcelangprod', 'alpha'), 'forcelangprod', 0, $object->multilangs);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td>';
|
||||
print '<td><input name="libelle" class="minwidth200 maxwidth300" value="'.GETPOST('libelle', 'alpha').'"></td></tr>';
|
||||
|
||||
@ -71,8 +71,6 @@ $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
|
||||
$remindertype = GETPOST('selectremindertype', 'aZ09');
|
||||
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
|
||||
|
||||
//var_dump($_POST); exit;
|
||||
|
||||
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
|
||||
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
|
||||
|
||||
@ -111,8 +109,6 @@ if ($id > 0 && $action != 'add') {
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
//var_dump($_POST);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('actioncard', 'globalcard'));
|
||||
|
||||
@ -144,7 +140,7 @@ if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned')
|
||||
{
|
||||
if ($val['id'] == $idtoremove || $val['id'] == -1) unset($tmpassigneduserids[$key]);
|
||||
}
|
||||
//var_dump($_POST['removedassigned']);exit;
|
||||
|
||||
$_SESSION['assignedtouser'] = json_encode($tmpassigneduserids);
|
||||
$donotclearsession = 1;
|
||||
if ($action == 'add') $action = 'create';
|
||||
@ -393,7 +389,7 @@ if (empty($reshook) && $action == 'add')
|
||||
$moreparam = '';
|
||||
if ($user->id != $object->userownerid) $moreparam = "filtert=-1"; // We force to remove filter so created record is visible when going back to per user view.
|
||||
|
||||
//Create reminders
|
||||
// Create reminders
|
||||
if ($addreminder == 'on'){
|
||||
$actionCommReminder = new ActionCommReminder($db);
|
||||
|
||||
@ -1068,49 +1064,48 @@ if ($action == 'create')
|
||||
// Location
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth300" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" class="minwidth300 maxwidth150onsmartphone" value="'.(GETPOST('location') ? GETPOST('location') : $object->location).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
$listofuserid = array();
|
||||
$listofcontactid = array();
|
||||
$listofotherid = array();
|
||||
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
$assignedtouser = GETPOST("assignedtouser") ?GETPOST("assignedtouser") : (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : $user->id);
|
||||
if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first
|
||||
$listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 1; // 1 by default at first init
|
||||
//$listofuserid[$user->id] = array('id'=>$user->id, 'mandatory'=>0, 'transparency'=>(GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1)); // 1 by default at first init
|
||||
$listofuserid[$assignedtouser]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 1); // 1 by default at first init
|
||||
$_SESSION['assignedtouser'] = json_encode($listofuserid);
|
||||
} else {
|
||||
if (!empty($_SESSION['assignedtouser']))
|
||||
{
|
||||
$listofuserid = json_decode($_SESSION['assignedtouser'], true);
|
||||
}
|
||||
$listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 0; // 0 by default when refreshing
|
||||
$firstelem = reset($listofuserid);
|
||||
if (isset($listofuserid[$firstelem['id']])) $listofuserid[$firstelem['id']]['transparency'] = (GETPOSTISSET('transparency') ? GETPOST('transparency', 'alpha') : 0); // 0 by default when refreshing
|
||||
}
|
||||
print '<div class="assignedtouser">';
|
||||
print $form->select_dolusers_forevent(($action == 'create' ? 'add' : 'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0', 1, $listofuserid, $listofcontactid, $listofotherid);
|
||||
print '</div>';
|
||||
/*if (in_array($user->id,array_keys($listofuserid)))
|
||||
{
|
||||
print '<div class="myavailability">';
|
||||
print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.(((! isset($_GET['transparency']) && ! isset($_POST['transparency'])) || GETPOST('transparency'))?' checked':'').'> '.$langs->trans("Busy");
|
||||
print '</div>';
|
||||
}*/
|
||||
print '</td></tr>';
|
||||
|
||||
// Done by
|
||||
if (!empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||
{
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST("doneby") ?GETPOST("doneby") : (!empty($object->userdoneid) && $percent == 100 ? $object->userdoneid : 0), 'doneby', 1);
|
||||
print $form->select_dolusers(GETPOSTISSET("doneby") ? GETPOST("doneby", 'int') : (!empty($object->userdoneid) && $percent == 100 ? $object->userdoneid : 0), 'doneby', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%');
|
||||
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@ -1126,8 +1121,7 @@ if ($action == 'create')
|
||||
{
|
||||
// Related company
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
if (GETPOST('socid', 'int') > 0)
|
||||
{
|
||||
if (GETPOST('socid', 'int') > 0) {
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch(GETPOST('socid', 'int'));
|
||||
print $societe->getNomUrl(1);
|
||||
@ -1148,7 +1142,8 @@ if ($action == 'create')
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
|
||||
$preselectedids = GETPOST('socpeopleassigned', 'array');
|
||||
if (GETPOST('contactid', 'int')) $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print img_picto('', 'contact', 'class="paddingrightonly"');
|
||||
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1161,7 +1156,7 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td id="project-input-container" >';
|
||||
print img_picto('', 'project', 'class="paddingrightonly"');
|
||||
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
|
||||
print $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
$urloption = '?action=create&donotclearsession=1';
|
||||
@ -1171,10 +1166,11 @@ if ($action == 'create')
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#projectid").change(function () {
|
||||
var url = "'.$url.'&projectid="+$("#projectid").val();
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#projectid").val()+"&projectid="+$("#projectid").val();
|
||||
console.log("Call url to get new list of tasks: "+url);
|
||||
$.get(url, function(data) {
|
||||
console.log($( data ).find("#taskid").html());
|
||||
if (data) $("#taskid").html( $( data ).find("#taskid").html() ).select2();
|
||||
console.log(data);
|
||||
if (data) $("#taskid").html(data).select2();
|
||||
})
|
||||
});
|
||||
})';
|
||||
@ -1186,7 +1182,7 @@ if ($action == 'create')
|
||||
print img_picto('', 'projecttask', 'class="paddingrightonly"');
|
||||
$projectsListId = false;
|
||||
if (!empty($projectid)) { $projectsListId = $projectid; }
|
||||
$tid = GETPOST("projecttaskid") ?GETPOST("projecttaskid") : '';
|
||||
$tid = GETPOST("projecttaskid") ? GETPOST("projecttaskid") : '';
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1197,10 +1193,10 @@ if ($action == 'create')
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
|
||||
print '<td colspan="3">'.dolGetElementUrl($originid, $origin, 1).'</td></tr>';
|
||||
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
|
||||
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" size="10" value="'.GETPOST('originid').'">';
|
||||
print '<input type="hidden" name="origin" size="10" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="fk_element" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="elementtype" value="'.GETPOST('origin').'">';
|
||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid', 'int').'">';
|
||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||
}
|
||||
|
||||
$reg = array();
|
||||
@ -1350,7 +1346,7 @@ if ($id > 0)
|
||||
$object->contact_id = GETPOST("contactid", 'int');
|
||||
$object->fk_project = GETPOST("projectid", 'int');
|
||||
|
||||
$object_private = GETPOST("note", 'restricthtml');
|
||||
$object->note_private = GETPOST("note", 'restricthtml');
|
||||
}
|
||||
|
||||
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
|
||||
@ -1954,8 +1950,6 @@ if ($id > 0)
|
||||
/*
|
||||
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
|
||||
{
|
||||
//var_dump($object->userassigned);
|
||||
//var_dump($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
|
||||
print '</div>';
|
||||
|
||||
@ -360,7 +360,9 @@ if (empty($action) || $action == 'show_month')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendar';
|
||||
}
|
||||
if ($action == 'show_week')
|
||||
@ -369,7 +371,9 @@ if ($action == 'show_week')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendarweek';
|
||||
}
|
||||
if ($action == 'show_day')
|
||||
@ -378,7 +382,9 @@ if ($action == 'show_day')
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$picto = 'calendarday';
|
||||
}
|
||||
|
||||
|
||||
@ -274,34 +274,17 @@ $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
|
||||
|
||||
$tmpday = $first_day;
|
||||
$picto = 'calendartype';
|
||||
$picto = 'calendarweek';
|
||||
|
||||
$nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y")."</span> \n";
|
||||
$nav .= "<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto = 'calendarweek';
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
}
|
||||
|
||||
/*$nav .= ' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nav .= '<input type="hidden" name="action" value="'.$action.'">';
|
||||
$nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
$nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">';
|
||||
$nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
$nav .= '<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
$nav .= '<input type="hidden" name="status" value="'.$status.'">';
|
||||
$nav .= '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
$nav .= '<input type="hidden" name="projectid" value="'.$projectid.'">';
|
||||
$nav .= '<input type="hidden" name="begin_h" value="'.$begin_h.'">';
|
||||
$nav .= '<input type="hidden" name="end_h" value="'.$end_h.'">';
|
||||
$nav .= '<input type="hidden" name="begin_d" value="'.$begin_d.'">';
|
||||
$nav .= '<input type="hidden" name="end_d" value="'.$end_d.'">';
|
||||
$nav .= '<input type="hidden" name="showbirthday" value="'.$showbirthday.'">';
|
||||
*/
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
//$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
//$nav .= '</form>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : '');
|
||||
|
||||
@ -285,28 +285,11 @@ $nav = "<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev
|
||||
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
|
||||
$nav .= " </span>\n";
|
||||
$nav .= " <a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
|
||||
/*$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.='<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
$nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
|
||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
$nav.='<input type="hidden" name="begin_h" value="' . $begin_h . '">';
|
||||
$nav.='<input type="hidden" name="end_h" value="' . $end_h . '">';
|
||||
$nav.='<input type="hidden" name="begin_d" value="' . $begin_d . '">';
|
||||
$nav.='<input type="hidden" name="end_d" value="' . $end_d . '">';
|
||||
$nav.='<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
|
||||
*/
|
||||
if (empty($conf->dol_optimize_smallscreen)) {
|
||||
$nav .= " <a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
|
||||
}
|
||||
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
|
||||
//$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav .= ' <button type="submit" class="liste_titre button_search" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||
//$nav.='</form>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$param .= '&year='.urlencode($year).'&month='.urlencode($month).($day ? '&day='.urlencode($day) : '');
|
||||
|
||||
@ -138,12 +138,12 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
@ -191,31 +191,31 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Set sales representatives
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
||||
}
|
||||
|
||||
if ($action == 'update_extras') {
|
||||
$object->fetch($id);
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) $error++;
|
||||
if (!$error)
|
||||
{
|
||||
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) $error++;
|
||||
if (!$error)
|
||||
{
|
||||
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -249,11 +249,11 @@ if ($object->id > 0)
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Prospect/Customer
|
||||
@ -262,16 +262,16 @@ if ($object->id > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
|
||||
print ($object->prefix_comm ? $object->prefix_comm : ' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
|
||||
print ($object->prefix_comm ? $object->prefix_comm : ' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
$langs->load("compta");
|
||||
$langs->load("compta");
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td>';
|
||||
@ -386,64 +386,64 @@ if ($object->id > 0)
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
if ($isCustomer)
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount = $object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db, $object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount = $object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db, $object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Max outstanding bill
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||
{
|
||||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,20 +468,41 @@ if ($object->id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Preferred shipping Method
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
// Preferred shipping Method
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->intracommreport->enabled))
|
||||
{
|
||||
// Transport mode by default
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('IntracommReportTransportMode');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
if (($action != 'edittransportmode') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edittransportmode&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshipping')
|
||||
if ($action == 'edittransportmode')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none');
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1);
|
||||
}
|
||||
else {
|
||||
$form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
@ -500,70 +521,70 @@ if ($object->id > 0)
|
||||
$parameters = array('socid'=>$object->id);
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Sales representative
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
// Module Adherent
|
||||
if (!empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
// Module Adherent
|
||||
if (!empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td>';
|
||||
$adh = new Adherent($db);
|
||||
$result = $adh->fetch('', '', $object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td>';
|
||||
$adh = new Adherent($db);
|
||||
$result = $adh->fetch('', '', $object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
// Prospection level and status
|
||||
if ($object->client == 2 || $object->client == 3)
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Level of prospection
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editlevel')
|
||||
{
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
|
||||
} else {
|
||||
print $object->getLibProspLevel();
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
// Level of prospection
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editlevel')
|
||||
{
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
|
||||
} else {
|
||||
print $object->getLibProspLevel();
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Status of prospection
|
||||
$object->loadCacheOfProspStatus();
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||
print ' ';
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
// Status of prospection
|
||||
$object->loadCacheOfProspStatus();
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||
print ' ';
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm&token='.newToken().'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
|
||||
}
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
@ -618,10 +639,11 @@ if ($object->id > 0)
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
// Box factures
|
||||
$tmp = $object->getOutstandingBills();
|
||||
$tmp = $object->getOutstandingBills('customer', 0);
|
||||
$outstandingOpened = $tmp['opened'];
|
||||
$outstandingTotal = $tmp['total_ht'];
|
||||
$outstandingTotalIncTax = $tmp['total_ttc'];
|
||||
|
||||
$text = $langs->trans("OverAllInvoices");
|
||||
$link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
|
||||
$icon = 'bill';
|
||||
@ -647,6 +669,24 @@ if ($object->id > 0)
|
||||
$boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
|
||||
$boxstat .= '</div>';
|
||||
if ($link) $boxstat .= '</a>';
|
||||
|
||||
$tmp = $object->getOutstandingBills('customer', 1);
|
||||
$outstandingOpenedLate = $tmp['opened'];
|
||||
if ($outstandingOpened != $outstandingOpenedLate && !empty($outstandingOpenedLate)) {
|
||||
$warn = '';
|
||||
if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpenedLate) {
|
||||
$warn = ' ' . img_warning($langs->trans("OutstandingBillReached"));
|
||||
}
|
||||
$text = $langs->trans("CurrentOutstandingBillLate");
|
||||
$link = DOL_URL_ROOT . '/compta/recap-compta.php?socid=' . $object->id;
|
||||
$icon = 'bill';
|
||||
if ($link) $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
|
||||
$boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
|
||||
$boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' <span>' . $text . '</span></span><br>';
|
||||
$boxstat .= '<span class="boxstatsindicator' . ($outstandingOpenedLate > 0 ? ' amountremaintopay' : '') . '">'.price($outstandingOpenedLate, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
|
||||
$boxstat .= '</div>';
|
||||
if ($link) $boxstat .= '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
@ -670,9 +710,9 @@ if ($object->id > 0)
|
||||
$langs->load("propal");
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
|
||||
$sql .= ", p.tva as total_tva";
|
||||
$sql .= ", p.total as total_ttc";
|
||||
$sql .= ", p.ref, p.ref_client, p.remise";
|
||||
$sql .= ", p.tva as total_tva";
|
||||
$sql .= ", p.total as total_ttc";
|
||||
$sql .= ", p.ref, p.ref_client, p.remise";
|
||||
$sql .= ", p.datep as dp, p.fin_validite as date_limit";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
||||
@ -686,17 +726,17 @@ if ($object->id > 0)
|
||||
$propal_static = new Propal($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
@ -704,17 +744,17 @@ if ($object->id > 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
$propal_static->id = $objp->propalid;
|
||||
$propal_static->ref = $objp->ref;
|
||||
$propal_static->ref_client = $objp->ref_client;
|
||||
$propal_static->total_ht = $objp->total_ht;
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '<td class="nowrap">';
|
||||
$propal_static->id = $objp->propalid;
|
||||
$propal_static->ref = $objp->ref;
|
||||
$propal_static->ref_client = $objp->ref_client;
|
||||
$propal_static->total_ht = $objp->total_ht;
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
print '<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).'</td></tr>';
|
||||
@ -737,12 +777,12 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
$sql .= ", c.rowid as cid, c.total_ht";
|
||||
$sql .= ", c.tva as total_tva";
|
||||
$sql .= ", c.total_ttc";
|
||||
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
|
||||
$sql .= ", c.date_commande as dc";
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
$sql .= ", c.rowid as cid, c.total_ht";
|
||||
$sql .= ", c.tva as total_tva";
|
||||
$sql .= ", c.total_ttc";
|
||||
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
|
||||
$sql .= ", c.date_commande as dc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
@ -795,8 +835,8 @@ if ($object->id > 0)
|
||||
$commande_static->billed = $objp->billed;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '<td class="nowrap">';
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
print '<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
|
||||
@ -814,78 +854,78 @@ if ($object->id > 0)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Latest shipments
|
||||
*/
|
||||
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut as statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid as socid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND e.entity IN (".getEntity('expedition').")";
|
||||
$sql .= ' GROUP BY e.rowid';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid';
|
||||
$sql .= " ORDER BY e.date_creation DESC";
|
||||
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut as statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid as socid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND e.entity IN (".getEntity('expedition').")";
|
||||
$sql .= ' GROUP BY e.rowid';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid';
|
||||
$sql .= " ORDER BY e.date_creation DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sendingstatic = new Expedition($db);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sendingstatic = new Expedition($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$sendingstatic->id = $objp->id;
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
$sendingstatic->id = $objp->id;
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
|
||||
print '<td class="nowrap right" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print '<td class="nowrap right" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Latest contracts
|
||||
@ -910,7 +950,7 @@ if ($object->id > 0)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
|
||||
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
//print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
@ -987,7 +1027,7 @@ if ($object->id > 0)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
@ -1000,11 +1040,11 @@ if ($object->id > 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$fichinter_static->id = $objp->id;
|
||||
$fichinter_static->statut = $objp->fk_statut;
|
||||
$fichinter_static->statut = $objp->fk_statut;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.'</a></td>'."\n";
|
||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||
print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
|
||||
print '</tr>';
|
||||
@ -1130,10 +1170,10 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
|
||||
$sql .= ', s.nom, s.rowid as socid';
|
||||
$sql .= ', SUM(pf.amount) as am';
|
||||
@ -1159,7 +1199,7 @@ if ($object->id > 0)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1192,9 +1232,9 @@ if ($object->id > 0)
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
|
||||
{
|
||||
print '<td class="right" style="min-width: 60px">';
|
||||
print price($objp->total_ttc);
|
||||
print '</td>';
|
||||
print '<td class="right" style="min-width: 60px">';
|
||||
print price($objp->total_ttc);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).'</td>';
|
||||
@ -1228,79 +1268,79 @@ if ($object->id > 0)
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->status != 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->status != 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
if ($user->rights->contrat->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
// Add invoice
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if (!empty($conf->deplacement->enabled) && $object->status == 1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
// Add invoice
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if (!empty($conf->deplacement->enabled) && $object->status == 1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->facture->enabled) && $object->status == 1)
|
||||
{
|
||||
if (empty($user->rights->facture->creer))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
$langs->loadLangs(array("orders", "bills"));
|
||||
if (!empty($conf->facture->enabled) && $object->status == 1)
|
||||
{
|
||||
if (empty($user->rights->facture->creer))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
$langs->loadLangs(array("orders", "bills"));
|
||||
|
||||
if (!empty($conf->commande->enabled))
|
||||
{
|
||||
if ($object->client != 0 && $object->client != 2) {
|
||||
if (!empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->commande->enabled))
|
||||
{
|
||||
if ($object->client != 0 && $object->client != 2) {
|
||||
if (!empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add action
|
||||
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -1310,14 +1350,14 @@ if ($object->id > 0)
|
||||
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
|
||||
// List of todo actions
|
||||
// List of todo actions
|
||||
show_actions_todo($conf, $langs, $db, $object);
|
||||
|
||||
// List of done actions
|
||||
// List of done actions
|
||||
show_actions_done($conf, $langs, $db, $object);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -179,9 +179,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
$companystatic->code_compta = $obj->code_compta;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
|
||||
print '<td class="nowrap right">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$propalstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
print '<td class="nowrap right tdamount">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -243,9 +243,9 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
||||
$companystatic->email = $obj->email;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$supplierproposalstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
|
||||
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
|
||||
print '<td class="nowrap right tdamount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -308,9 +308,9 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
$companystatic->entity = $obj->entity;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$orderstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 16).'</td>';
|
||||
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$orderstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
print '<td class="nowrap right tdamount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -373,9 +373,9 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$companystatic->email = $obj->email;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$supplierorderstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 16).'</td>';
|
||||
print '<td class="nowrap right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
|
||||
print '<td class="nowrap right tdamount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -441,9 +441,29 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
||||
$companystatic->email = $objp->email;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
|
||||
print '<td class="right" nowrap>'.$companystatic->getLibCustProspStatut().'</td>';
|
||||
print '<td class="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
print '<td class="nowrap">';
|
||||
//print $companystatic->getLibCustProspStatut();
|
||||
|
||||
$obj = $companystatic;
|
||||
$s = '';
|
||||
if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$s .= '<a class="customer-back opacitymedium" title="'.$langs->trans("Prospect").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Prospect"), 0, 1).'</a>';
|
||||
}
|
||||
if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
{
|
||||
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>';
|
||||
}
|
||||
/*
|
||||
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur)
|
||||
{
|
||||
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>';
|
||||
}*/
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right nowrap tddate">'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
@ -464,7 +484,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
||||
* Last suppliers
|
||||
*/
|
||||
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) {
|
||||
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm, s.code_fournisseur, s.entity, s.email";
|
||||
$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm, s.code_fournisseur, s.entity, s.email, s.fournisseur";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
|
||||
@ -477,7 +497,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
startSimpleTable($langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)), "societe/list.php", "type=f");
|
||||
startSimpleTable($langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)), "societe/list.php", "type=f", 1);
|
||||
|
||||
if ($num) {
|
||||
$i = 0;
|
||||
@ -491,17 +511,37 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
$companystatic->canvas = $objp->canvas;
|
||||
$companystatic->entity = $objp->entity;
|
||||
$companystatic->email = $objp->email;
|
||||
$companystatic->fournisseur = $objp->fournisseur;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
|
||||
print '<td>';
|
||||
|
||||
$obj = $companystatic;
|
||||
$s = '';
|
||||
/*if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
|
||||
{
|
||||
$s .= '<a class="customer-back opacitymedium" title="'.$langs->trans("Prospect").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Prospect"), 0, 1).'</a>';
|
||||
}
|
||||
if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
|
||||
{
|
||||
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>';
|
||||
}*/
|
||||
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur)
|
||||
{
|
||||
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>';
|
||||
}
|
||||
print $s;
|
||||
|
||||
print '</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
addSummaryTableLine(2, $num);
|
||||
addSummaryTableLine(3, $num);
|
||||
finishSimpleTable(true);
|
||||
|
||||
$db->free($resql);
|
||||
@ -566,8 +606,11 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
|
||||
$companystatic->entity = $objp->entity;
|
||||
$companystatic->email = $objp->email;
|
||||
|
||||
$staticcontrat->id = $obj->contratid;
|
||||
$staticcontrat->ref = $obj->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."</a></td>';
|
||||
print '<td>'.$staticcontrat->getNomUrl(1).'</td>';
|
||||
print '<td>'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
@ -657,8 +700,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
print '<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
print '<td class="right tdamount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -758,8 +801,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
print '<td class="right">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td class="right tddate">'.dol_print_date($db->jdate($obj->dp), 'day').'</td>';
|
||||
print '<td class="right tdamount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
|
||||
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -426,7 +426,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print $form->showrefnav($object, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ if (empty($reshook))
|
||||
$from = $object->email_from;
|
||||
$replyto = $object->email_replyto;
|
||||
$errorsto = $object->email_errorsto;
|
||||
// Le message est-il en html
|
||||
// Is the message in html
|
||||
$msgishtml = -1; // Unknown by default
|
||||
if (preg_match('/[\s\t]*<html>/i', $message)) $msgishtml = 1;
|
||||
|
||||
@ -144,8 +144,8 @@ if (empty($reshook))
|
||||
|
||||
$nbok = 0; $nbko = 0;
|
||||
|
||||
// On choisit les mails non deja envoyes pour ce mailing (statut=0)
|
||||
// ou envoyes en erreur (statut=-1)
|
||||
// We choose mails not already sent for this mailing (statut=0)
|
||||
// or sent in error (statut=-1)
|
||||
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql); // nb of possible recipients
|
||||
$num = $db->num_rows($resql); // Number of possible recipients
|
||||
|
||||
if ($num)
|
||||
{
|
||||
@ -163,7 +163,7 @@ if (empty($reshook))
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
// Positionne date debut envoi
|
||||
// Positioning date of start sending
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".$object->id;
|
||||
$resql2 = $db->query($sql);
|
||||
if (!$resql2)
|
||||
@ -273,7 +273,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Fabrication du mail
|
||||
// Mail making
|
||||
$trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing');
|
||||
|
||||
@ -408,15 +408,15 @@ if (empty($reshook))
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
// Le message est-il en html
|
||||
$msgishtml = -1; // Inconnu par defaut
|
||||
// Is the message in html
|
||||
$msgishtml = -1; // Unknow by default
|
||||
if (preg_match('/[\s\t]*<html>/i', $object->body)) $msgishtml = 1;
|
||||
|
||||
// other are set at begin of page
|
||||
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto;
|
||||
$object->substitutionarrayfortest['__MAILTOEMAIL__'] = '<a href="mailto:'.$object->sendto.'">'.$object->sendto.'</a>';
|
||||
|
||||
// Pratique les substitutions sur le sujet et message
|
||||
// Subject and message substitutions
|
||||
complete_substitutions_array($object->substitutionarrayfortest, $langs);
|
||||
$tmpsujet = make_substitutions($object->sujet, $object->substitutionarrayfortest);
|
||||
$tmpbody = make_substitutions($object->body, $object->substitutionarrayfortest);
|
||||
@ -426,7 +426,7 @@ if (empty($reshook))
|
||||
$arr_name = array();
|
||||
$arr_css = array();
|
||||
|
||||
// Ajout CSS
|
||||
// Add CSS
|
||||
if (!empty($object->bgcolor)) $arr_css['bgcolor'] = (preg_match('/^#/', $object->bgcolor) ? '' : '#').$object->bgcolor;
|
||||
if (!empty($object->bgimage)) $arr_css['bgimage'] = $object->bgimage;
|
||||
|
||||
@ -465,13 +465,13 @@ if (empty($reshook))
|
||||
$object->email_from = GETPOST("from");
|
||||
$object->email_replyto = GETPOST("replyto");
|
||||
$object->email_errorsto = GETPOST("errorsto");
|
||||
$object->titre = GETPOST("titre");
|
||||
$object->title = GETPOST("title");
|
||||
$object->sujet = GETPOST("sujet");
|
||||
$object->body = GETPOST("bodyemail", 'restricthtml');
|
||||
$object->bgcolor = GETPOST("bgcolor");
|
||||
$object->bgimage = GETPOST("bgimage");
|
||||
|
||||
if (!$object->titre) {
|
||||
if (!$object->title) {
|
||||
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
|
||||
}
|
||||
if (!$object->sujet) {
|
||||
@ -496,16 +496,16 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
|
||||
|
||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre', 'alpha'));
|
||||
if ($action == 'settitle') $object->title = trim(GETPOST('title', 'alpha'));
|
||||
elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from', 'alpha'));
|
||||
elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha'));
|
||||
elseif ($action == 'setemail_errorsto') {
|
||||
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alpha'));
|
||||
} elseif ($action == 'settitre' && empty($object->titre)) {
|
||||
} elseif ($action == 'settitle' && empty($object->title)) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
|
||||
} elseif ($action == 'setfrom' && empty($object->email_from)) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
|
||||
@ -540,7 +540,7 @@ if (empty($reshook))
|
||||
$action = "edit";
|
||||
}
|
||||
|
||||
// Action remove file
|
||||
// Action of file remove
|
||||
if (!empty($_POST["removedfile"]))
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
|
||||
@ -552,7 +552,7 @@ if (empty($reshook))
|
||||
$action = "edit";
|
||||
}
|
||||
|
||||
// Action update emailing
|
||||
// Action of emailing update
|
||||
if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"]))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -592,7 +592,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation validation
|
||||
// Action of validation confirmation
|
||||
if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
@ -606,7 +606,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation validation
|
||||
// Action of validation confirmation
|
||||
if ($action == 'confirm_settodraft' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
@ -652,7 +652,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation suppression
|
||||
// Action of delete confirmation
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->delete($object->id))
|
||||
@ -736,7 +736,7 @@ if ($action == 'create')
|
||||
print '</table>';
|
||||
|
||||
print '<div style="padding-top: 10px">';
|
||||
// Editeur wysiwyg
|
||||
// wysiwyg editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('bodyemail', GETPOST('bodyemail', 'restricthtml'), '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
|
||||
$doleditor->Create();
|
||||
@ -759,7 +759,7 @@ if ($action == 'create')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("SetToDraft"), $langs->trans("ConfirmUnvalidateEmailing"), "confirm_settodraft", '', '', 1);
|
||||
}
|
||||
// Confirmation validation of mailing
|
||||
// Confirmation of mailing validation
|
||||
if ($action == 'valid')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ValidMailing"), $langs->trans("ConfirmValidMailing"), "confirm_valid", '', '', 1);
|
||||
@ -779,7 +779,7 @@ if ($action == 'create')
|
||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
||||
|
||||
/*
|
||||
* Mailing en mode visu
|
||||
* View mode mailing
|
||||
*/
|
||||
if ($action == 'sendall')
|
||||
{
|
||||
@ -854,9 +854,9 @@ if ($action == 'create')
|
||||
|
||||
// Description
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("MailTitle", 'titre', $object->titre, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("MailTitle", 'titre', $object->titre, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print '</td></tr>';
|
||||
|
||||
// From
|
||||
@ -883,7 +883,7 @@ if ($action == 'create')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
// Number of distinct emails
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
@ -929,12 +929,12 @@ if ($action == 'create')
|
||||
array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1),
|
||||
array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers"), 'value' => 0)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
// Incomplete payment. On demande si motif = escompte ou autre
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240);
|
||||
}
|
||||
|
||||
/*
|
||||
* Boutons d'action
|
||||
* Actions Buttons
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test')))
|
||||
@ -1021,7 +1021,7 @@ if ($action == 'create')
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Affichage formulaire de TEST
|
||||
// Display of the TEST form
|
||||
if ($action == 'test')
|
||||
{
|
||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
||||
@ -1029,7 +1029,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_head(null, '', '', -1);
|
||||
|
||||
// Create l'objet formulaire mail
|
||||
// Create mail form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = $object->email_from;
|
||||
@ -1046,9 +1046,9 @@ if ($action == 'create')
|
||||
$formmail->withbodyreadonly = 1;
|
||||
$formmail->withcancel = 1;
|
||||
$formmail->withdeliveryreceipt = 0;
|
||||
// Tableau des substitutions
|
||||
// Table of substitutions
|
||||
$formmail->substit = $object->substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
// Table of post's complementary params
|
||||
$formmail->param["action"] = "send";
|
||||
$formmail->param["models"] = 'none';
|
||||
$formmail->param["mailid"] = $object->id;
|
||||
@ -1109,7 +1109,7 @@ if ($action == 'create')
|
||||
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') // CKEditor does not apply the color of the div into its content area
|
||||
{
|
||||
$readonly = 1;
|
||||
// Editeur wysiwyg
|
||||
// wysiwyg editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly);
|
||||
$doleditor->Create();
|
||||
@ -1119,7 +1119,7 @@ if ($action == 'create')
|
||||
dol_fiche_end();
|
||||
} else {
|
||||
/*
|
||||
* Mailing en mode edition (CKeditor or HTML source)
|
||||
* Edition mode mailing (CKeditor or HTML source)
|
||||
*/
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
|
||||
@ -1144,13 +1144,13 @@ if ($action == 'create')
|
||||
*/
|
||||
|
||||
// Topic
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
// From
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
|
||||
// To
|
||||
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
|
||||
|
||||
// Nb of distinct emails
|
||||
// Number of distinct emails
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
@ -1267,14 +1267,14 @@ if ($action == 'create')
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
// Editeur wysiwyg
|
||||
// wysiwyg editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, $conf->global->FCKEDITOR_ENABLE_MAILING, 20, '90%');
|
||||
$doleditor->Create();
|
||||
}
|
||||
if ($action == 'edithtml')
|
||||
{
|
||||
// Editor HTML source
|
||||
// HTML source editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', true, true, 'ace', 20, '90%');
|
||||
$doleditor->Create(0, '', false, 'HTML Source', 'php');
|
||||
|
||||
@ -237,7 +237,7 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
|
||||
@ -46,7 +46,7 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $picto = 'email';
|
||||
|
||||
public $titre;
|
||||
public $title;
|
||||
public $sujet;
|
||||
public $body;
|
||||
public $nbemail;
|
||||
@ -115,7 +115,7 @@ class Mailing extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->titre = trim($this->titre);
|
||||
$this->title = trim($this->title);
|
||||
$this->email_from = trim($this->email_from);
|
||||
|
||||
if (!$this->email_from)
|
||||
@ -130,9 +130,9 @@ class Mailing extends CommonObject
|
||||
$sql .= " (date_creat, fk_user_creat, entity)";
|
||||
$sql .= " VALUES ('".$this->db->idate($now)."', ".$user->id.", ".$conf->entity.")";
|
||||
|
||||
if (!$this->titre)
|
||||
if (!$this->title)
|
||||
{
|
||||
$this->titre = $langs->trans("NoTitle");
|
||||
$this->title = $langs->trans("NoTitle");
|
||||
}
|
||||
|
||||
dol_syslog("Mailing::Create", LOG_DEBUG);
|
||||
@ -167,7 +167,7 @@ class Mailing extends CommonObject
|
||||
public function update($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
|
||||
$sql .= " SET titre = '".$this->db->escape($this->titre)."'";
|
||||
$sql .= " SET titre = '".$this->db->escape($this->title)."'";
|
||||
$sql .= ", sujet = '".$this->db->escape($this->sujet)."'";
|
||||
$sql .= ", body = '".$this->db->escape($this->body)."'";
|
||||
$sql .= ", email_from = '".$this->db->escape($this->email_from)."'";
|
||||
@ -198,7 +198,7 @@ class Mailing extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage";
|
||||
$sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage";
|
||||
$sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
|
||||
$sql .= ", m.statut, m.nbemail";
|
||||
$sql .= ", m.fk_user_creat, m.fk_user_valid";
|
||||
@ -221,11 +221,11 @@ class Mailing extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->statut = $obj->statut;
|
||||
$this->nbemail = $obj->nbemail;
|
||||
$this->titre = $obj->titre;
|
||||
$this->title = $obj->title;
|
||||
|
||||
$this->sujet = $obj->sujet;
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) {
|
||||
$this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401);
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT|ENT_HTML5))) {
|
||||
$this->body = dol_html_entity_decode($obj->body, ENT_COMPAT|ENT_HTML5);
|
||||
} else {
|
||||
$this->body = $obj->body;
|
||||
}
|
||||
@ -283,7 +283,7 @@ class Mailing extends CommonObject
|
||||
$object->statut = 0;
|
||||
|
||||
// Clear fields
|
||||
$object->titre = $langs->trans("CopyOf").' '.$object->titre.' '.dol_print_date(dol_now());
|
||||
$object->title = $langs->trans("CopyOf").' '.$object->title.' '.dol_print_date(dol_now());
|
||||
|
||||
// If no option copy content
|
||||
if (empty($option1))
|
||||
|
||||
@ -182,7 +182,7 @@ if ($result) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$mailstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_trunc($obj->titre, 38).'</td>';
|
||||
print '<td>'.dol_trunc($obj->title, 38).'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
|
||||
print '<td class="center">'.($obj->nbemail ? $obj->nbemail : "0").'</td>';
|
||||
print '<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).'</td>';
|
||||
|
||||
@ -238,7 +238,7 @@ if ($resql)
|
||||
print $email->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date creation
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -372,13 +372,13 @@ if (empty($reshook))
|
||||
$object->ref_client = GETPOST('ref_client');
|
||||
$object->datep = $datep;
|
||||
$object->date_livraison = $date_delivery;
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->availability_id = GETPOST('availability_id', 'int');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id', 'int');
|
||||
$object->fk_delivery_address = GETPOST('fk_address', 'int');
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->duree_validite = GETPOST('duree_validite');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->duree_validite = price2num(GETPOST('duree_validite', 'alpha'));
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->contact_id = GETPOST('contactid', 'int');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
@ -1504,9 +1504,6 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
||||
print '</td>';
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
} else {
|
||||
print '<td>';
|
||||
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 maxwidth500');
|
||||
@ -1553,7 +1550,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Validaty duration
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td><input name="duree_validite" class="width50" value="'.(GETPOST('duree_validite', 'int') ? GETPOST('duree_validite', 'int') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td><input name="duree_validite" class="width50" value="'.(GETPOSTISSET('duree_validite') ? GETPOST('duree_validite', 'alphanohtml') : $conf->global->PROPALE_VALIDITY_DURATION).'"> '.$langs->trans("days").'</td></tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
@ -1587,6 +1584,9 @@ if ($action == 'create')
|
||||
|
||||
// Shipping Method
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
*/
|
||||
class Proposals extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
@ -65,60 +65,60 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
/**
|
||||
* Get properties of an proposal object by ref
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref_ext
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
/**
|
||||
* Get properties of an proposal object by ref_ext
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
/**
|
||||
* Get properties of an proposal object
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -151,8 +151,8 @@ class Proposals extends DolibarrApi
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
{
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
@ -201,8 +201,8 @@ class Proposals extends DolibarrApi
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
@ -235,13 +235,13 @@ class Proposals extends DolibarrApi
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of proposal
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
@ -258,7 +258,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
return $this->propal->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lines of a commercial proposal
|
||||
@ -269,26 +269,26 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
public function getLines($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,50 +309,50 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$request_data->fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$request_data->origin,
|
||||
$request_data->origin_id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$request_data->fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$request_data->origin,
|
||||
$request_data->origin_id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
return $updateRes;
|
||||
} else {
|
||||
throw new RestException(400, $this->propal->error);
|
||||
}
|
||||
}
|
||||
if ($updateRes > 0) {
|
||||
return $updateRes;
|
||||
} else {
|
||||
throw new RestException(400, $this->propal->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line of given commercial proposal
|
||||
@ -388,37 +388,37 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(404, 'Proposal line not found');
|
||||
}
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,13 +432,13 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
@ -460,7 +460,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
@ -471,66 +471,66 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->add_contact($contactid, $type, 'external');
|
||||
$result = $this->propal->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
return $this->propal;
|
||||
}
|
||||
return $this->propal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
/**
|
||||
* Delete a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||
@ -556,12 +556,12 @@ class Proposals extends DolibarrApi
|
||||
* @param array $request_data Datas
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
@ -631,14 +631,14 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a proposal to draft
|
||||
*
|
||||
* @param int $id Order ID
|
||||
*
|
||||
* @url POST {id}/settodraft
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Set a proposal to draft
|
||||
*
|
||||
* @param int $id Order ID
|
||||
*
|
||||
* @url POST {id}/settodraft
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settodraft($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
@ -690,14 +690,14 @@ class Proposals extends DolibarrApi
|
||||
* @url POST {id}/validate
|
||||
*
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -718,19 +718,19 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
$this->propal->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close (Accept or refuse) a quote / commercial proposal
|
||||
@ -780,47 +780,47 @@ class Proposals extends DolibarrApi
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a commercial proposal billed. Could be also called setbilled
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @url POST {id}/setinvoiced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
/**
|
||||
* Set a commercial proposal billed. Could be also called setbilled
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @url POST {id}/setinvoiced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error : '.$this->propal->error);
|
||||
}
|
||||
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error : '.$this->propal->error);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
$this->propal->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -842,25 +842,25 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->note);
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
unset($object->note);
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
|
||||
return $object;
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,8 +193,12 @@ class Propal extends CommonObject
|
||||
|
||||
public $address_type;
|
||||
public $address;
|
||||
|
||||
public $availability_id;
|
||||
public $availability_code;
|
||||
|
||||
public $duree_validite;
|
||||
|
||||
public $demand_reason_id;
|
||||
public $demand_reason_code;
|
||||
|
||||
@ -3153,7 +3157,7 @@ class Propal extends CommonObject
|
||||
$sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
|
||||
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||
$sql .= " WHERE c.rowid = ".$id;
|
||||
$sql .= " WHERE c.rowid = ".((int) $id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ class PropaleStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where .= " p.fk_statut > 0";
|
||||
//$this->where .= " p.fk_statut > 0";
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
@ -91,10 +91,10 @@ class PropaleStats extends Stats
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
//$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where .= " AND p.entity IN (".getEntity('propal').")";
|
||||
$this->where .= ($this->where ? ' AND ' : '')."p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
|
||||
@ -542,7 +542,7 @@ if ($resql)
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view products
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
@ -551,7 +551,7 @@ if ($resql)
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->categorie->enabled))
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
|
||||
@ -86,7 +86,7 @@ if ($mode == 'customer')
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$picto = 'supplier_proposal';
|
||||
$title = $langs->trans("ProposalsStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
|
||||
$title = $langs->trans("ProposalsStatisticsSuppliers");
|
||||
$dir = $conf->supplier_proposal->dir_temp;
|
||||
$cat_type = Categorie::TYPE_SUPPLIER;
|
||||
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
|
||||
|
||||
@ -1863,6 +1863,7 @@ if ($action == 'create' && $usercancreate)
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author_id);
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
$res = $object->fetch_optionals();
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
|
||||
@ -573,13 +573,13 @@ class Orders extends DolibarrApi
|
||||
$contacts = $this->commande->liste_contact();
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
$result = $this->commande->delete_contact($contact['rowid']);
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
$result = $this->commande->delete_contact($contact['rowid']);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
}
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
@ -3531,6 +3531,8 @@ class Commande extends CommonOrder
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed ? ' - '.$langs->trans("Billed") : '');
|
||||
|
||||
$labelTooltip = '';
|
||||
|
||||
if ($status == self::STATUS_CANCELED) {
|
||||
$labelStatus = $langs->trans('StatusOrderCanceled');
|
||||
$labelStatusShort = $langs->trans('StatusOrderCanceledShort');
|
||||
@ -3544,8 +3546,9 @@ class Commande extends CommonOrder
|
||||
$labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
$statusType = 'status1';
|
||||
} elseif ($status == self::STATUS_SHIPMENTONPROCESS) {
|
||||
$labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelStatus = $langs->trans('StatusOrderSent').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelTooltip = $langs->trans("StatusOrderSent").' - '.$langs->trans("DateDeliveryPlanned").dol_print_date($this->date_livraison).$billedtext;
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderToBill');
|
||||
@ -3553,11 +3556,11 @@ class Commande extends CommonOrder
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessedShort').$billedtext;
|
||||
$statusType = 'status6';
|
||||
} elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDeliveredShort');
|
||||
$statusType = 'status6';
|
||||
} else {
|
||||
$labelStatus = $langs->trans('Unknown');
|
||||
@ -3566,7 +3569,7 @@ class Commande extends CommonOrder
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip));
|
||||
}
|
||||
|
||||
|
||||
@ -3991,11 +3994,6 @@ class OrderLine extends CommonOrderLine
|
||||
public $fk_parent_line;
|
||||
public $fk_facture;
|
||||
|
||||
/**
|
||||
* @var string Order lines label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
public $ref_ext;
|
||||
|
||||
public $fk_remise_except;
|
||||
@ -4046,7 +4044,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,';
|
||||
$sql .= ' cd.fk_unit,';
|
||||
$sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
$sql .= ' cd.date_start, cd.date_end';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
@ -4090,9 +4088,9 @@ class OrderLine extends CommonOrderLine
|
||||
$this->rang = $objp->rang;
|
||||
|
||||
$this->ref = $objp->product_ref; // deprecated
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->libelle = $objp->product_libelle; // deprecated
|
||||
$this->product_label = $objp->product_libelle;
|
||||
|
||||
$this->product_ref = $objp->product_ref;
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->product_tobatch = $objp->product_tobatch;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
@ -77,7 +77,7 @@ class CommandeStats extends Stats
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
//$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
} elseif ($mode == 'supplier')
|
||||
{
|
||||
$object = new CommandeFournisseur($this->db);
|
||||
@ -85,10 +85,10 @@ class CommandeStats extends Stats
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
//$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
}
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
$this->where .= ($this->where ? ' AND ' : ''). 'c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
|
||||
@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills'));
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
@ -593,7 +593,7 @@ if ($resql)
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
@ -602,7 +602,7 @@ if ($resql)
|
||||
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
if (!empty($conf->categorie->enabled))
|
||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
@ -680,9 +680,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
@ -844,14 +844,14 @@ if ($resql)
|
||||
-3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort")
|
||||
);
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
|
||||
print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Status billed
|
||||
if (!empty($arrayfields['c.facture']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
|
||||
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
@ -905,6 +905,7 @@ if ($resql)
|
||||
$total = 0;
|
||||
$subtotal = 0;
|
||||
$productstat_cache = array();
|
||||
$productstat_cachevirtual = array();
|
||||
$getNomUrl_cache = array();
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
@ -962,7 +963,6 @@ if ($resql)
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
||||
{
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
@ -986,16 +986,16 @@ if ($resql)
|
||||
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
|
||||
{
|
||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique;
|
||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
|
||||
$text_info .= '<br>';
|
||||
|
||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
|
||||
{
|
||||
$notshippable++;
|
||||
}
|
||||
} else { // Detailed code, looks bugged
|
||||
} else { // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
||||
// stock order and stock order_supplier
|
||||
$stock_order = 0;
|
||||
$stock_order_supplier = 0;
|
||||
|
||||
@ -81,7 +81,7 @@ $dir = $conf->commande->dir_temp;
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$picto = 'supplier_order';
|
||||
$title = $langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
|
||||
$title = $langs->trans("OrdersStatisticsSuppliers");
|
||||
$dir = $conf->fournisseur->commande->dir_temp;
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Customer invoices
|
||||
if (GETPOST('selectinvoices')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -158,7 +158,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Vendor invoices
|
||||
if (GETPOST('selectsupplierinvoices')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -167,7 +167,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Expense reports
|
||||
if (GETPOST('selectexpensereports')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE date_fin between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -176,16 +176,16 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Donations
|
||||
if (GETPOST('selectdonations')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
|
||||
$sql .= " WHERE datedon between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
|
||||
}
|
||||
// Paiements of salaries
|
||||
// Payments of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -194,7 +194,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Social contributions
|
||||
if (GETPOST('selectsocialcontributions')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
|
||||
$sql .= " WHERE t.date_ech between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -203,7 +203,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Various payments
|
||||
if (GETPOST('selectvariouspayment')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -211,7 +211,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Loan payments
|
||||
if (GETPOST('selectloanspayment')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_loan as t LEFT JOIN ".MAIN_DB_PREFIX."loan as l ON l.rowid = t.fk_loan";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND l.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -525,6 +525,9 @@ dol_fiche_head($head, 'AccountancyFiles');
|
||||
print '<form name="searchfiles" action="?action=searchfiles" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ExportAccountingSourceDocHelp", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals")).'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
|
||||
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";
|
||||
|
||||
@ -578,7 +581,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
||||
}
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n";
|
||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||
|
||||
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
|
||||
@ -589,7 +592,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
|
||||
print '<input class="butAction" type="submit" value="'.$langs->trans("Download").'" />';
|
||||
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />';
|
||||
print '</form>'."\n";
|
||||
|
||||
print '<br>';
|
||||
@ -603,13 +606,14 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'nowraponall ');
|
||||
print '<td>'.$langs->trans("Document").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Code").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Country").'</td>';
|
||||
print '<td class="center">'.$langs->trans("VATIntra").'</td>';
|
||||
if ($conf->multicurrency->enabled) print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||
print '</tr>';
|
||||
if ($result)
|
||||
{
|
||||
@ -617,7 +621,11 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
|
||||
if (empty($TData))
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calculate balance
|
||||
|
||||
@ -644,7 +652,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date
|
||||
// Date due
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date_due'], 'day');
|
||||
print "</td>\n";
|
||||
@ -655,10 +663,18 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
if ($data['item'] == 'Invoice') {
|
||||
$invoice->id = $data['id'];
|
||||
$invoice->ref = $data['ref'];
|
||||
$invoice->total_ht = $data['amount_ht'];
|
||||
$invoice->total_ttc = $data['amount_ttc'];
|
||||
$invoice->total_tva = $data['amount_vat'];
|
||||
$invoice->multicurrency_code = $data['currency'];
|
||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||
$supplier_invoice->id = $data['id'];
|
||||
$supplier_invoice->ref = $data['ref'];
|
||||
$supplier_invoice->total_ht = $data['amount_ht'];
|
||||
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
||||
$supplier_invoice->total_tva = $data['amount_vat'];
|
||||
$supplier_invoice->multicurrency_code = $data['currency'];
|
||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'ExpenseReport') {
|
||||
$expensereport->id = $data['id'];
|
||||
@ -709,7 +725,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
|
||||
|
||||
print '<td>'.$data['thirdparty_name']."</td>\n";
|
||||
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
|
||||
@ -727,6 +743,10 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -737,6 +757,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Total debits
|
||||
print '<tr class="liste_total">';
|
||||
@ -745,6 +768,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Balance
|
||||
print '<tr class="liste_total">';
|
||||
@ -753,6 +779,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -43,9 +43,12 @@ $bankcateg = new BankCateg($db);
|
||||
$categid = GETPOST('categid');
|
||||
$label = GETPOST("label");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Add category
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('add'))
|
||||
{
|
||||
if ($label) {
|
||||
@ -95,14 +98,17 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td><td colspan="2">'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td><td>'.$langs->trans("Label").'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Line to add category
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td><td><input name="label" type="text" size="45"></td>';
|
||||
print '<td> </td><td><input name="label" type="text" class="maxwidth100"></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="center"><input type="submit" name="add" class="button" value="'.$langs->trans("Add").'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -111,7 +117,7 @@ if ($action != 'edit')
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY label";
|
||||
$sql .= " ORDER BY rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -124,16 +130,19 @@ if ($result)
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$objp->rowid.'</a></td>';
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
if (GETPOST('action', 'aZ09') == 'edit' && GETPOST("categid") == $objp->rowid)
|
||||
{
|
||||
print "<td colspan=2>";
|
||||
print '<td colspan="3">';
|
||||
print '<input type="hidden" name="categid" value="'.$objp->rowid.'">';
|
||||
print '<input name="label" type="text" size=45 value="'.$objp->label.'">';
|
||||
print '<input type="submit" name="update" class="button" value="'.$langs->trans("Edit").'">';
|
||||
print "</td>";
|
||||
} else {
|
||||
print "<td >".$objp->label."</td>";
|
||||
print "<td>".$objp->label."</td>";
|
||||
print '<td>';
|
||||
//print '<a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$langs->trans("List").'</a>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
|
||||
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
|
||||
@ -338,6 +338,24 @@ class PaymentVarious extends CommonObject
|
||||
$this->fk_user_modif = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a miscellaneous payment can be created into database
|
||||
*
|
||||
* @return boolean True or false
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$newamount = price2num($this->amount, 'MT');
|
||||
|
||||
// Validation of parameters
|
||||
if (!($newamount) > 0 || empty($this->datep))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create in database
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user