Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
fappels 2017-09-08 11:37:46 +02:00
commit 5a7a4964fe
541 changed files with 25641 additions and 10124 deletions

View File

@ -5,6 +5,11 @@ English Dolibarr ChangeLog
***** ChangeLog for 7.0.0 compared to 6.0.* *****
WARNING:
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
* The methode "cloture" on contact were renamed into "closeAll".
***** ChangeLog for 6.0.0 compared to 5.0.* *****
@ -14,7 +19,7 @@ NEW: Add a payment module for Stripe.
NEW: Add module "Product variant" (like red, blue for the product shoes)
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
NEW: Add a tracking id into mass emailing.
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
NEW: Tax system more compatible with the new tax rollout in India (IGST / CGST / SGST).
NEW: Add calculation function for Loan schedule
NEW: Add "depends on" and "required by" into module informations
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
@ -158,6 +163,37 @@ content by doing a print into function, sometimes by returning content into "res
hook specifications so you must return output into "resprint".
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
FIX: #7075 : bad path for document
FIX: #7156
FIX: #7173
FIX: #7224
FIX: #7226
FIX: #7239
FIX: add supplierproposaldet without price (new product)
FIX: amount overlap other amount when a pagebreak is done due to an image at the bottom of page.
FIX: Bad tax calculation with expense report
FIX: Best buy price calculation
FIX: Buying prices must always be in positive value.
FIX: calculate correct remain to pay for planned bank transactions
FIX: delete linked element on facture rec
FIX: edit sociale was emptying label
FIX: Error when updating thirdparty not returned
FIX: holidays with postgresql like on rowid integer
FIX: id of user not saved when making a payment of expense report
FIX: invoice page list
FIX: invoice situation VAT total rounding into PDF crabe
FIX: PgSQL compatibility.
FIX: remove order rights on invoice page
FIX: status were wrong on product referent list
FIX: supplier id was not passed to hooks
FIX: Support of vat code when using price per customer
FIX: User id correction on holiday request
FIX: value of user id filled to 0 in llx_bank_url when recording an expense report.
FIX: we have to check if contact doesn't already exist on add_contact() function
FIX: We should be able to insert data with value '0' into const
FIX: install process with DoliWamp
***** ChangeLog for 5.0.4 compared to 5.0.3 *****
FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
@ -662,7 +698,7 @@ NEW: Disabled users are striked.
NEW: Enhance navigation of project module
NEW: fichinter lines ordered by rang AND DATE
NEW: hidden conf to use input file multiple from mail form
NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
NEW: hidden feature: SUPPLIER_ORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined
NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param).
NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy.
NEW: If error is reported during migration process, you can ignore it to avoid to be locked.

View File

@ -2,9 +2,9 @@
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda).
It's an Open Source software (wrote in PHP language) designed for small, medium or large companies, foundations and freelances.
It's an Open Source Software (written in PHP language) designed for small, medium or large companies, foundations and freelances.
You can freely use, study, modify or distribute it according to its Free Software licence.
@ -29,18 +29,25 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
Releases can be downloaded from [official website](https://www.dolibarr.org/).
### Install from composer
If you do not already have Composer installed, you may do so by following the instructions at getcomposer.org. On Linux and Mac OS X, you'll run the following commands:
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
```bash
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
```
On Windows, you'll download and run https://getcomposer.org/Composer-Setup.exe
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
You can then create a new project
```bash
composer create-project dolibarr/dolibarr erp
```
### Simple setup
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
- DoliWamp for Windows
- DoliDeb for Debian or Ubuntu
@ -48,11 +55,11 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
### Advanced setup
You can use a Web server and a supported database (MariaDb, MySql or Postgresql) to install the standard version.
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
- Uncompress the downloaded archive
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
- From your browser, go to the dolibarr "install/" page
The URL will depends on choices made in the first step:
@ -73,10 +80,10 @@ You can use a Web server and a supported database (MariaDb, MySql or Postgresql)
## UPGRADING
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect your to the "install/" page to make the upgrade process.
If a file install.lock exists to lock any run of upgrade process, the application will ask you to remove the file manually (you should find the install.lock file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "documents").
- At first next access, Dolibarr will redirect your to the "install/" page to follow the upgrade process.
 If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file into the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
*Note: migration process can safely be done multiple times by calling the page /install/index.php*
*Note: migration process can be safely done multiple times by calling the `/install/index.php` page*
## WHAT'S NEW
@ -172,7 +179,7 @@ Administrator, user, developer and translator's documentations are available alo
## CONTRIBUTING
See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)
See [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) file
## CREDITS

View File

@ -49,6 +49,8 @@ if (empty($argv[1]))
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
}
parse_str($argv[1]);
$i=0;
while ($i < $argc)
{
@ -98,9 +100,9 @@ foreach ($includeconstants as $countrycode => $tmp)
print "\n";
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
$outputdir=dirname(__FILE__).'/../htdocs/install';
print 'Delete current files '.$outputdir.'/filelist-'.$release.'.xml'."\n";
dol_delete_file($outputdir.'/filelist-'.$release.'.xml',0,1,1);
$outputdir=dirname(dirname(__FILE__)).'/htdocs/install';
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
$checksumconcat=array();

View File

@ -334,7 +334,7 @@ foreach my $target (sort keys %CHOOSEDTARGET) {
}
foreach my $target (sort keys %CHOOSEDPUBLISH) {
if ($CHOOSEDPUBLISH{$target} < 0) { next; }
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
if ($target eq 'ASSO') { $nbofpublishneedchangelog++; }
if ($target eq 'SF') { $nbofpublishneedchangelog++; $nbofpublishneedtag++; }
$nboftargetok++;
}

View File

@ -1,8 +1,10 @@
README (English)
##################################################
Install script for Virtualmin Pro
Install script for Virtualmin Professional / GPL
##################################################
This script will install automatically Dolibarr from Virtualmin Pro
http://www.virtualmin.com
This script will install automatically Dolibarr from Virtualmin.
(Included in the professional version and can be added in the GPL version)
https://www.virtualmin.com
http://www.webmin.com/virtualmin.html

View File

@ -1,7 +1,7 @@
#----------------------------------------------------------------------------
# \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2015 Regis Houssin <regis.houssin@capnetworks.com>
# \author (c)2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
#----------------------------------------------------------------------------
@ -30,7 +30,12 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" );
return ( "5.0.4", "4.0.6", "3.9.4" );
}
sub script_dolibarr_release
{
return 2; # for mysqli fix
}
sub script_dolibarr_category
@ -177,9 +182,9 @@ if ($opts->{'newdb'} && !$upgrade) {
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" :
local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" :
$dbtype eq "mysql" ? "mysqli" : "pgsql";
local $dbhost = &get_database_host($dbtype);
local $dbhost = &get_database_host($dbtype, $d);
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr);
@ -206,9 +211,6 @@ $pgcharset = $tmpl->{'postgres_encoding'};
$charset = $dbtype eq "mysql" ? $mycharset : $pgcharset;
$collate = $dbtype eq "mysql" ? $mycollate : "C";
# Install filename
local $step = $version >= 3.8 ? "step" : "etape";
$path = &script_path_url($d, $opts);
if ($path =~ /^https:/ || $d->{'ssl'}) {
$url = "https://$d->{'dom'}";
@ -222,15 +224,11 @@ if ($opts->{'path'} =~ /\w/) {
if (!$upgrade) {
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
&copy_source_dest_as_domain_user($d, $cdef, $cfile);
&set_permissions_as_domain_user($d, 0777, $cfiledir);
&set_permissions_as_domain_user($d, 0666, $cfile);
&copy_source_dest_as_domain_user($d, $cfile);
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
&set_permissions_as_domain_user($d, 0777, $docdir);
if (!$version >= 3.7.2) {
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
&set_permissions_as_domain_user($d, 0777, $altdir);
}
}
else {
# Preserve old config file, documents and custom directory
@ -266,7 +264,8 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
@ -289,15 +288,17 @@ else {
[ "main_force_https", $opts->{'forcehttps'} ],
[ "dolibarr_main_db_character_set", $charset ],
[ "dolibarr_main_db_collation", $collate ],
[ "main_use_alt_dir", "1" ],
[ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts);
local $p = $ver >= 3.8 ? "step1" : "etape1";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts);
local $p = $ver >= 3.8 ? "step2" : "etape2";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
@ -306,7 +307,8 @@ else {
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.
@ -384,7 +386,10 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :

View File

@ -163,6 +163,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/collab
%_datadir/dolibarr/htdocs/comm
%_datadir/dolibarr/htdocs/commande
%_datadir/dolibarr/htdocs/compta

File diff suppressed because one or more lines are too long

View File

@ -192,6 +192,7 @@ export list="
--ignore-table=$base.llx_cabinetmed_c_ccam
--ignore-table=$base.llx_cabinetmed_c_examconclusion
--ignore-table=$base.llx_cabinetmed_cons
--ignore-table=$base.llx_cabinetmed_cons_extrafields
--ignore-table=$base.llx_cabinetmed_diaglec
--ignore-table=$base.llx_cabinetmed_examaut
--ignore-table=$base.llx_cabinetmed_exambio
@ -207,7 +208,18 @@ export list="
--ignore-table=$base.llx_dolicloud_customers
--ignore-table=$base.llx_dolicloud_stats
--ignore-table=$base.llx_dolicloud_emailstemplates
--ignore-table=$base.llx_dolireport_column
--ignore-table=$base.llx_dolireport_criteria
--ignore-table=$base.llx_dolireport_graph
--ignore-table=$base.llx_dolireport_plot
--ignore-table=$base.llx_dolireport_report
--ignore-table=$base.llx_domain
--ignore-table=$base.llx_ecommerce_commande
--ignore-table=$base.llx_ecommerce_facture
--ignore-table=$base.llx_ecommerce_product
--ignore-table=$base.llx_ecommerce_site
--ignore-table=$base.llx_ecommerce_societe
--ignore-table=$base.llx_ecommerce_socpeople
--ignore-table=$base.llx_element_rang
--ignore-table=$base.llx_entity
--ignore-table=$base.llx_filemanager_roots
@ -215,6 +227,8 @@ export list="
--ignore-table=$base.llx_google_maps
--ignore-table=$base.llx_milestone
--ignore-table=$base.llx_monitoring_probes
--ignore-table=$base.llx_m
--ignore-table=$base.llx_m_extrafields
--ignore-table=$base.llx_notes
--ignore-table=$base.llx_pos_cash
--ignore-table=$base.llx_pos_control_cash

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -69,8 +69,8 @@ $arrayfields=array(
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0),
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
);
@ -94,9 +94,9 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if (! empty($cancel)) $action = '';
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
$search_account = "";
@ -106,13 +106,13 @@ if (empty($reshook))
$search_pcgsubtype = "";
$search_array_options=array();
}
if (GETPOST('change_chart'))
{
$chartofaccounts = GETPOST('chartofaccounts', 'int');
if (! empty($chartofaccounts)) {
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
@ -120,12 +120,12 @@ if (empty($reshook))
$error ++;
}
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
}
$action = 'update';
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
@ -179,7 +179,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -190,13 +190,14 @@ if ($resql)
{
$num = $db->num_rows($resql);
$params='';
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($search_account) $params.= '&search_account='.urlencode($search_account);
if ($search_label) $params.= '&search_label='.urlencode($search_label);
if ($search_accountparent) $params.= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $params.= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $params.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_account) $param.= '&search_account='.urlencode($search_account);
if ($search_label) $param.= '&search_label='.urlencode($search_label);
if ($search_accountparent) $param.= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $param.= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
@ -209,11 +210,11 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$htmlbuttonadd = '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd);
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $htmlbuttonadd, '', $limit);
// Box to select active chart of account
print $langs->trans("Selectchartofaccounts") . " : ";
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
@ -227,22 +228,22 @@ if ($resql)
$i = 0;
while ( $i < $numbis ) {
$row = $db->fetch_row($resqlchart);
print '<option value="' . $row[0] . '"';
print $pcgver == $row[0] ? ' selected' : '';
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
$i ++;
}
}
print "</select>";
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>';
print '<br>';
print '<br>';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@ -259,13 +260,13 @@ if ($resql)
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"],"aa.account_number","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"],"aa.label","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"],"aa.account_parent", "", $param,'align="left"',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_type']['help']);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'],$_SERVER["PHP_SELF"],'aa.pcg_subtype','',$param,'',$sortfield,$sortorder,'',$arrayfields['aa.pcg_subtype']['help']);
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'],$_SERVER["PHP_SELF"],'aa.active','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
@ -274,14 +275,14 @@ if ($resql)
$accountparent = new AccountingAccount($db);
$i=0;
while ($i < min($num, $limit))
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
$accountstatic->id = $obj->rowid;
$accountstatic->label = $obj->label;
$accountstatic->account_number = $obj->account_number;
print '<tr class="oddeven">';
// Account number
@ -310,7 +311,7 @@ if ($resql)
$accountparent->id = $obj->rowid2;
$accountparent->label = $obj->label2;
$accountparent->account_number = $obj->account_number2;
print "<td>";
print $accountparent->getNomUrl(1);
print "</td>\n";
@ -371,11 +372,11 @@ if ($resql)
}
print '</td>' . "\n";
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
print "</table>";
print "</div>";
print '</form>';

View File

@ -602,6 +602,7 @@ if ($id)
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
// Form to add a new line
@ -1139,6 +1140,7 @@ if ($id)
}
print '</table>';
print '</div>';
print '</form>';
}

View File

@ -63,7 +63,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
{
if (! $cancel) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
$result = $db->query($sql);
$obj = $db->fetch_object($result);
@ -172,16 +172,16 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
}
} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) {
$result = $object->fetch($id);
if (! empty($object->id)) {
$result = $object->delete($user);
if ($result > 0) {
header("Location: account.php");
exit;
}
}
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@ -270,7 +270,7 @@ if ($action == 'create') {
$head = accounting_prepare_head($object);
// Edit mode
if ($action == 'update')
if ($action == 'update')
{
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
@ -327,7 +327,7 @@ if ($action == 'create') {
print '</form>';
} else {
// View mode
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">' . $langs->trans("BackToList") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');

View File

@ -98,7 +98,7 @@ dol_fiche_head();
print '<table class="border" width="100%">';
// Category
print '<tr><td>' . $langs->trans("AccountingCategory") . '</td>';
print '<tr><td class="titlefield">' . $langs->trans("AccountingCategory") . '</td>';
print '<td>';
$formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 1);
print '<input class="button" type="submit" value="' . $langs->trans("Select") . '">';
@ -110,14 +110,26 @@ if (! empty($cat_id))
if ($return < 0) {
setEventMessages(null, $accountingcategory->errors, 'errors');
}
print '<tr><td>' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
print '<tr><td class="tdtop">' . $langs->trans("AddAccountFromBookKeepingWithNoCategories") . '</td>';
print '<td>';
$arraykeyvalue=array();
foreach($accountingcategory->lines_cptbk as $key => $val)
{
$arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' (' . $val->label_compte . ($val->doc_ref?' '.$val->doc_ref:'').')';
}
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print '<select class="flat minwidth200" size="' . count($obj) . '" name="cpt_bk[]" multiple>';
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
print '<br>';
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
foreach ( $accountingcategory->lines_cptbk as $cpt ) {
print '<option value="' . length_accountg($cpt->numero_compte) . '">' . length_accountg($cpt->numero_compte) . ' (' . $cpt->label_compte . ' ' . $cpt->doc_ref . ')</option>';
}
print '</select><br>';
print ajax_combobox('cpt_bk');
*/
print '<input class="button" type="submit" id="" class="action-delete" value="' . $langs->trans("Add") . '"> ';
}
print '</td></tr>';

View File

@ -1,16 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,7 +42,7 @@ $langs->load("hrm");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$id=32;
$rowid=GETPOST('rowid','alpha');
$code=GETPOST('code','alpha');
@ -100,7 +90,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
// Requests to extract data
$tabsql=array();
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -108,15 +98,15 @@ $tabsqlsort[32]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
$tabfield[32]= "code,label,range_account,category_type,formula,position,country";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
$tabfieldvalue[32]= "code,label,range_account,category_type,formula,position,country_id";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[32]= "code,label,range_account,category_type,formula,position,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -167,24 +157,17 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
if ($value == 'formula' && empty($_POST['formula'])) continue;
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
)
)
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
if ($value == 'country') continue; // country_id required but not country
if (! isset($_POST[$value]) || $_POST[$value]=='')
{
$ok=0;
$fieldnamekey=$listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'module') $fieldnamekey='Module';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
@ -192,11 +175,6 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
$ok=0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"]))
{
if ($_POST["code"]=='0')
@ -210,17 +188,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/
}
if (isset($_POST["country"]) && ($_POST["country"]=='0'))
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
{
if (in_array($tablib[$id],array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{
$_POST["country"]='';
}
else
{
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors');
}
// Clean some parameters
@ -262,14 +233,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0;
foreach ($listfieldinsert as $f => $value)
{
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
}
else if ($value == 'entity') {
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
@ -310,15 +278,15 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0;
foreach ($listfieldmodify as $field)
{
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
if ($field == 'fk_country' && $_POST['country'] > 0) {
$_POST[$listfieldvalue[$i]] = $_POST['country'];
}
else if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'range_account') $sql.="null"; // For range_account, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
@ -458,11 +426,15 @@ $titlepicto='title_setup';
print load_fiche_titre($titre,$linkback,$titlepicto);
if ($id == 32)
{
print $langs->trans("AccountingAccountGroupsDesc", $langs->transnoentitiesnoconv("ByPersonalizedAccountGroups")).'<br><br>';
}
// 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.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id.($search_country_id>0?'&search_country_id='.$search_country_id:''), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
}
//var_dump($elementList);
@ -508,6 +480,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
// Form to add a new line
@ -536,18 +509,15 @@ if ($id)
{
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field]=='country') {
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
if ($valuetoshow != '')
@ -617,8 +587,7 @@ if ($id)
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
if (GETPOST('from','alpha')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
// There is several pages
if ($num > $listlimit)
{
@ -700,8 +669,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Direction"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
// Affiche nom du champ
if ($showfield)
@ -742,6 +710,7 @@ if ($id)
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td>';
}
else
{
@ -759,17 +728,9 @@ if ($id)
$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
if ($value == 'type_template')
if ($value == 'category_type')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
else if ($value == 'source')
{
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
$valuetoshow = yn($valuetoshow);
}
else if ($valuetoshow=='all') {
$valuetoshow=$langs->trans('All');
@ -785,12 +746,6 @@ if ($id)
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
}
}
else if ($fieldlist[$field]=='libelle_facture') {
$langs->load("bills");
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
$valuetoshow=nl2br($valuetoshow);
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
$key=$langs->trans("Country".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
@ -804,83 +759,11 @@ if ($id)
$key=$langs->trans("Action".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
$key=$langs->trans(strtoupper($obj->code));
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
$key=$langs->trans("Civility".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
$langs->load('agenda');
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
$langs->load("bills");
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
$langs->load("bills");
$key=$langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
$langs->load("orders");
$key=$langs->trans($obj->code);
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]};
}
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
$langs->load("sendings");
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
{
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
{
$langs->load('trips');
$key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
$showfield=0;
}
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow=$langs->trans($obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
$langs->load("products");
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
}
else if (in_array($fieldlist[$field],array('recuperableonly')))
{
$align="center";
}
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
}
$class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
@ -891,14 +774,9 @@ if ($id)
if (isset($obj->code))
{
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
$canbemodified=$iserasable;
if ($obj->code == 'RECEP') $canbemodified=1;
$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):'');
if ($param) $url .= '&'.$param;
@ -909,10 +787,7 @@ if ($id)
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
print $langs->trans("AlwaysActive");
}
print "</td>";
@ -937,8 +812,8 @@ if ($id)
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">'.$langs->trans("Setup").'</a>';
}
print '</td>';
print "</tr>\n";
}
print "</tr>\n";
$i++;
}
}
@ -948,6 +823,7 @@ if ($id)
}
print '</table>';
print '</div>';
print '</form>';
}
@ -984,16 +860,17 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
{
if ($fieldlist[$field] == 'country')
{
if (in_array('region_id',$fieldlist))
{
print '<td>';
//print join(',',$fieldlist);
print '</td>';
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '<td>';
$fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
if ($context == 'add')
{
$fieldname='country_id';
print $form->select_country(GETPOST('country_id','int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
else
{
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
}
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id')
@ -1006,130 +883,14 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
print '</td>';
}
}
elseif ($fieldlist[$field] == 'region')
{
print '<td>';
$formcompany->select_region($region_id,'region');
elseif ($fieldlist[$field] == 'category_type') {
print '<td>';
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
print '</td>';
}
elseif ($fieldlist[$field] == 'region_id')
{
$region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>';
}
elseif ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element')
{
print '<td>';
print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// La source de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'source')
{
print '<td>';
print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
{
print '<td>';
print 'user<input type="hidden" name="type" value="user">';
print '</td>';
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">';
else print '<td>';
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
} else {
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
}
print '</td>';
}
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
$align="left";
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="center"; // Fields aligned on right
print '<td align="'.$align.'">';
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>';
}
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
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 ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field]=='unit') {
print '<td>';
$units = array(
'mm' => $langs->trans('SizeUnitmm'),
'cm' => $langs->trans('SizeUnitcm'),
'point' => $langs->trans('SizeUnitpoint'),
'inch' => $langs->trans('SizeUnitinch')
);
print $form->selectarray('unit', $units, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 0, 0, 0);
print '</td>';
}
// Le type de taxe locale
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
{
print '<td align="center">';
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
{
print '<td>';
if (! empty($conf->accounting->enabled))
{
$fieldname = $fieldlist[$field];
$accountancy_account = (! empty($obj->$fieldname) ? $obj->$fieldname : 0);
print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
}
else
{
$fieldname = $fieldlist[$field];
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
}
print '</td>';
}
else
{
print '<td>';
@ -1137,8 +898,7 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex
if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='position') $class='maxwidth50';
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}

View File

@ -145,12 +145,12 @@ else if ($action == 'update') {
* View
*/
$form = new Form($db);
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card");
$helpurl = "";
llxHeader("",$title,$helpurl);
$form = new Form($db);
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewFiscalYear"));

View File

@ -423,6 +423,7 @@ if ($id)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
// Form to add a new line
@ -691,6 +692,7 @@ if ($id)
}
print '</table>';
print '</div>';
print '</form>';
}

View File

@ -312,6 +312,7 @@ if ($result)
$texte=$langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre_filter">';
@ -448,6 +449,7 @@ if ($result)
$i ++;
}
print '</table>';
print '</div>';
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">

View File

@ -370,6 +370,7 @@ print '<div class="inline-block divButAction"><a class="butActionDelete" name="b
print '</div>';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">';
@ -501,6 +502,7 @@ print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</div>';
print '</form>';

View File

@ -286,7 +286,7 @@ class AccountancyCategory
}
if (! empty($mysoc->country_id)) {
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql = "SELECT t.rowid, t.account_number, t.label as account_label, cat.code, cat.position, cat.label as name_cat, cat.sens ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, " . MAIN_DB_PREFIX . "c_accounting_category as cat";
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
@ -316,7 +316,7 @@ class AccountancyCategory
'code' => $obj->code,
'position' => $obj->position,
'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt,
'account_label' => $obj->account_label,
'sens' => $obj->sens
);
$i ++;
@ -334,22 +334,28 @@ class AccountancyCategory
/**
* Function to show result of an accounting account from the ledger with a direction and a period
*
* @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty
* @param string $year Specific year
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
*
* @return integer Result in table
* @param int $cpt Id accounting account
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start
* @param string $date_end Date end
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @param string $thirdparty_code Thirdparty code
* @return integer Result in table
*/
public function getResult($cpt, $month, $year, $sens) {
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter')
{
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'";
$sql .= " AND YEAR(t.doc_date) = " . $year;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'";
if (! empty($month)) {
$sql .= " AND MONTH(t.doc_date) = " . $month;
}
if ($thirdparty_code != 'nofilter')
{
$sql .= " AND thirdparty_code = '".$ths->db->escape($thirdparty_code)."'";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -375,62 +381,13 @@ class AccountancyCategory
}
/**
* Function to call category from a specific country
* Return list of personalized groups
*
* @return array Result in table
* @return int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @return array|int Array of personalized groups or < 0 if KO
*/
public function getCatsCal() {
global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
if (! empty($mysoc->country_id)) {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 AND c.category_type = 1 ";
$sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql .= " ORDER BY c.position ASC";
} else {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.category_type = 1 AND c.fk_country = co.rowid";
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.position ASC";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$position = $obj->position;
$data[$position] = array (
'code' => $obj->code,
'label' => $obj->label,
'formula' => $obj->formula
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
return - 1;
}
}
public function getCats() {
public function getCats($categorytype=-1)
{
global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
@ -442,17 +399,18 @@ class AccountancyCategory
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 ";
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql .= " ORDER BY c.position ASC";
} else {
} else { // Note: this should not happen
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.position ASC";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
@ -466,9 +424,9 @@ class AccountancyCategory
$data[] = array (
'rowid' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
'label' => $obj->label,
'formula' => $obj->formula,
'position' => $obj->position,
'category_type' => $obj->category_type
);
$i ++;
@ -487,13 +445,19 @@ class AccountancyCategory
// calcule
/* I try to replace this with dol_eval()
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10;
public function calculate($input){
public function calculate($input)
{
global $langs;
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars
$input = str_replace($langs->trans("ThousandSeparator"), '', $input);
$input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
@ -535,28 +499,41 @@ class AccountancyCategory
return 0;
}
*/
/**
* get cpts of category
* Get all accounting account of a group.
* You must choose between first parameter (personalized group) or the second (free criteria filter)
*
* @param int $cat_id Id accounting account category
*
* @return array Result in table
* @param int $cat_id Id if personalized accounting group/category
* @param string $predefinedgroup Sql criteria filter to select accounting accounts
* @return array Array of accounting accounts
*/
public function getCptsCat($cat_id) {
public function getCptsCat($cat_id, $predefinedgroupwhere='')
{
global $mysoc;
$sql = "";
$sql = '';
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " ORDER BY t.account_number ";
if (! empty($cat_id))
{
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " ORDER BY t.account_number ";
}
else
{
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " ORDER BY t.account_number ";
}
//echo $sql;
$resql = $this->db->query($sql);
@ -564,14 +541,15 @@ class AccountancyCategory
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
$data = array();
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
while ($obj = $this->db->fetch_object($resql))
{
$name_cat = $obj->name_cat;
$data[] = array (
'id' => $obj->rowid,
'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt,
'account_label' => $obj->account_label,
);
$i ++;
}

View File

@ -1224,18 +1224,17 @@ class BookKeeping extends CommonObject
/**
* Delete bookkepping by piece number
*
* @param int $piecenum peicenum to delete
* @param string $mode Mode
* @return int Result
* @param int $piecenum Piecenum to delete
* @return int Result
*/
function deleteMvtNum($piecenum, $mode) {
function deleteMvtNum($piecenum) {
global $conf;
$this->db->begin();
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element. $mode;
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum;
$sql .= " AND entity IN (" . getEntity('accountancy') . ")";

View File

@ -205,6 +205,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -254,13 +255,14 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -310,7 +312,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
@ -321,6 +323,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
for($i = 1; $i <= 12; $i ++) {
@ -362,10 +365,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
if (! empty($conf->margin->enabled)) {
print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
for($i = 1; $i <= 12; $i ++) {
@ -408,6 +412,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
}
}

View File

@ -130,6 +130,8 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
* View
*/
$form = new Form($db);
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript">

View File

@ -94,7 +94,7 @@ if ($action == 'validatehistory') {
}
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
@ -139,7 +139,7 @@ if ($action == 'validatehistory') {
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
$sql1.=")";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
@ -186,6 +186,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -231,7 +232,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
print '<br>';
@ -239,6 +240,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -284,7 +286,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
@ -292,17 +294,18 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
{
print '<br>';
print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
}
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
@ -314,12 +317,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND er.fk_statut > 0 ";
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
@ -328,12 +331,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
}
llxFooter();

View File

@ -87,7 +87,7 @@ print "<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
print "<br>\n";
$step++;
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
@ -138,6 +138,9 @@ print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step,
print "<br>\n";
print '<br>';
print "<br>\n";
print_fiche_titre($langs->trans("AccountancyAreaDescActionFreq"), '', 'object_calendarweek');
print '<hr>';

View File

@ -1,10 +1,8 @@
<?php
use Stripe\BankAccount;
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
@ -726,7 +724,7 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' - ' . $accountingjournalstatic->getNomUrl(1);
$builddate = time();
$builddate=dol_now();
//$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
@ -742,7 +740,7 @@ if (empty($action) || $action == 'view') {
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
@ -774,6 +772,7 @@ if (empty($action) || $action == 'view') {
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td></td>";
@ -924,6 +923,7 @@ if (empty($action) || $action == 'view') {
}
print "</table>";
print '</div>';
llxFooter();
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -498,7 +498,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
@ -511,7 +511,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
@ -543,6 +543,7 @@ if (empty($action) || $action == 'view') {
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td></td>";
@ -668,6 +669,7 @@ if (empty($action) || $action == 'view') {
}
print "</table>";
print '</div>';
// End of page
llxFooter();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -514,7 +514,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded");
@ -532,7 +532,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@ -564,6 +564,7 @@ if (empty($action) || $action == 'view') {
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td></td>";
@ -692,6 +693,7 @@ if (empty($action) || $action == 'view') {
}
print "</table>";
print '</div>';
// End of page
llxFooter();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
@ -535,7 +535,7 @@ if (empty($action) || $action == 'view') {
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$builddate=dol_now();
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$description .= $langs->trans("DepositsAreNotIncluded");
@ -552,7 +552,7 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
}
print '<div class="tabsAction tabsActionNoBottom">';
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
@ -584,6 +584,7 @@ if (empty($action) || $action == 'view') {
print '<br>';
$i = 0;
print '<div class="div-table-responsive">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td></td>";
@ -708,6 +709,7 @@ if (empty($action) || $action == 'view') {
}
print "</table>";
print '</div>';
// End of page
llxFooter();

View File

@ -1,302 +0,0 @@
<?php
/* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/report/result.php
* \ingroup Advanced accountancy
* \brief Page for accounting result
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$error = 0;
// Langs
$langs->load("accountancy");
$langs->load("compta");
$mesg = '';
$action = GETPOST('action','aZ09');
$cat_id = GETPOST('account_category');
$selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
// Filter
$year = GETPOST('year','int');
if ($year == 0) {
$year_current = strftime("%Y", time());
$year_start = $year_current;
} else {
$year_current = $year;
$year_start = $year;
}
if($cat_id == 0){
$cat_id = null;
}
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->comptarapport->lire)
accessforbidden();
$AccCat = new AccountancyCategory($db);
/*
* View
*/
llxheader('', $langs->trans('ReportInOut'));
$formaccounting = new FormAccounting($db);
$form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
$nom = $langs->trans("ReportInOut").', '.$langs->trans("ByAccounts");
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$description = '';
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
$months = array( $langs->trans("JanuaryMin"),
$langs->trans("FebruaryMin"),
$langs->trans("MarchMin"),
$langs->trans("AprilMin"),
$langs->trans("MayMin"),
$langs->trans("JuneMin"),
$langs->trans("JulyMin"),
$langs->trans("AugustMin"),
$langs->trans("SeptemberMin"),
$langs->trans("OctoberMin"),
$langs->trans("NovemberMin"),
$langs->trans("DecemberMin"),
);
print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("Account").'</th>';
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
print '<th class="liste_titre" align="center">N-1</th>';
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
foreach($months as $k => $v){
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
}
print '</tr>';
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1;
$sommes = array();
foreach($cats as $cat ){
if(!empty($cat['category_type'])){ // category calculed
$formula = $cat['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$code = $cat['code']; // code categorie de calcule
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n";
}else{ // normal category
$totCat = array();
$totCat['M'] = array();
// get cpts of category
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
}
}
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
print '<tr'. $bc[$var].'>';
if ($simple_report == 'yes') {
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td align="right">' . price($resultNP) . '</td>';
print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
print '<td align="right">' . price($resultM) . '</td>';
}
}
print "</tr>\n";
}
}
}
print "</table>";
print '</div>';
llxFooter();
$db->close();

View File

@ -182,6 +182,7 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -227,8 +228,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
print '<br>';
@ -236,6 +236,7 @@ print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
@ -281,7 +282,7 @@ if ($resql) {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
@ -293,6 +294,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) {
@ -333,6 +335,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
}

View File

@ -158,6 +158,7 @@ class Adherent extends CommonObject
$from=$conf->email_from;
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
// Send email (substitutionarray must be done just before this)
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml);
if ($mailfile->sendfile())

View File

@ -114,7 +114,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0)
{
$langs->load("errors");
$errmsg=$langs->trans($company->error);
setEventMessages($company->error, $company->errors, 'errors');
}
else
@ -124,7 +123,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
}
else
{
$errmsg=$object->error;
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -212,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
}
$subscription=$_POST["subscription"]; // Amount of subscription
$subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$label=$_POST["label"];
// Payment informations
@ -230,6 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++;
$langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
if (GETPOST('end') && ! $datesubend)
@ -237,6 +237,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++;
$langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
if (! $datesubend)
@ -247,16 +248,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$error++;
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
$amount = price2num(GETPOST("subscription",'alpha'));
// Check if a payment is mandatory or not
if (! $error && $adht->subscription) // Member type need subscriptions
{
if (! is_numeric($_POST["subscription"]))
if (! is_numeric($amount))
{
// If field is '' or not a numeric value
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
setEventMessages($errmsg, null, 'errors');
$error++;
$action='addsubscription';
}
@ -274,7 +279,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
}
if ($errmsg) $action='addsubscription';
if ($errmsg)
{
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
}
}
}
@ -320,6 +329,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$error++;
$errmsg=$db->lasterror();
setEventMessages($errmsg, null, 'errors');
}
}
else
@ -327,14 +337,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++;
$errmsg=$acct->error;
$errmsgs=$acct->errors;
}
setEventMessages($errmsg, $errmsgs, 'errors');
}
}
else
{
$error++;
$errmsg=$acct->error;
$errmsgs=$acct->errors;
}
setEventMessages($errmsg, $errmsgs, 'errors');
}
}
// If option choosed, we create invoice
@ -352,6 +364,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
@ -362,6 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$errmsg=$customer->error;
$errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
@ -379,6 +393,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$error++;
$errmsg='ErrorNoPaymentTermRECEPFound';
setEventMessages($errmsg, null, 'errors');
}
}
$invoice->socid=$object->fk_soc;
@ -396,6 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$errmsg=$invoice->error;
$errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
@ -416,6 +432,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result <= 0)
{
$errmsg=$invoice->error;
setEventMessages($errmsg, null, 'errors');
$error++;
}
}
@ -428,6 +445,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$errmsg=$invoice->error;
$errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
@ -455,6 +473,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{
$errmsg=$paiement->error;
$errmsgs=$paiement->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++;
}
}
@ -536,6 +555,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0)
{
$errmsg=$object->error;
setEventMessages($errmsg, null, 'errors');
}
}

View File

@ -131,12 +131,11 @@ if (preg_match('/del_(.*)/',$action,$reg))
* View
*/
llxHeader();
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -67,11 +67,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject=$langs->transnoentitiesnoconv("Agenda");
llxHeader('',$langs->trans("AgendaSetup"));
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
$head=agenda_prepare_head();

View File

@ -125,11 +125,11 @@ $formother=new FormOther($db);
$arrayofjs=array();
$arrayofcss=array();
llxHeader('',$langs->trans("AgendaSetup"),'','',0,0,$arrayofjs,$arrayofcss);
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('',$langs->trans("AgendaSetup"),$wikihelp,'',0,0,$arrayofjs,$arrayofcss);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print '<br>';
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -210,7 +210,7 @@ while ($i <= $MAXAGENDA)
$color='AGENDA_EXT_COLOR'.$key;
$enabled='AGENDA_EXT_ENABLED'.$key;
print '<tr class="oddeven">';
// Nb
print '<td width="180" class="nowrap">'.$langs->trans("AgendaExtNb",$key)."</td>";

View File

@ -42,7 +42,7 @@ $action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$param = GETPOST('param','alpha');
$cancel = GETPOST('cancel','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type = 'action';
@ -174,12 +174,12 @@ else if ($action == 'setdoc')
$formactions=new FormActions($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader();
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"),$wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
@ -273,7 +273,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<td align="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
@ -286,7 +286,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -298,7 +298,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -71,11 +71,11 @@ if ($actionsave)
if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100;
llxHeader();
$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print '<br>';
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';

View File

@ -43,7 +43,7 @@ if (!$user->admin)
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'bankaccount';
@ -334,7 +334,7 @@ foreach ($dirmodels as $reldir) {
}
else {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
'switch_off') . '</a>';
print "</td>";
}
@ -346,7 +346,7 @@ foreach ($dirmodels as $reldir) {
'on');
}
else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
'off') . '</a>';
}
print '</td>';

View File

@ -190,7 +190,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
print '</td>';

View File

@ -46,7 +46,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type = 'order';
@ -464,7 +464,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -476,7 +476,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -49,7 +49,7 @@ $error=0;
* Actions
*/
if ( ($action == 'update' && empty($_POST["cancel"]))
if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|| ($action == 'updateedit') )
{
$tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0);
@ -63,19 +63,19 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM",$_POST["nom"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS",$_POST["address"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN",$_POST["town"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP",$_POST["zipcode"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE",$_POST["state_id"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE",$_POST["currency"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL",$_POST["tel"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX",$_POST["fax"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL",$_POST["mail"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
if ($_FILES[$varforimage]["tmp_name"])
{
@ -100,8 +100,8 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
if ($isimage > 0)
{
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Create small thumb, Used on logon for example
$imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
@ -143,27 +143,27 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
}
}
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS",$_POST["MAIN_INFO_SOCIETE_MANAGERS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIREN",$_POST["siren"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID5",$_POST["MAIN_INFO_PROFID5"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT",$_POST["object"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIRET", GETPOST("siret",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_APE", GETPOST("ape",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_RCS", GETPOST("rcs",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID5", GETPOST("MAIN_INFO_PROFID5",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_PROFID6", GETPOST("MAIN_INFO_PROFID6",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START",$_POST["fiscalmonthstart"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_TVAOPTION",$_POST["optiontva"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
// Local taxes
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION", GETPOST("optionlocaltax1",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION", GETPOST("optionlocaltax2",'alpha'),'chaine',0,'',$conf->entity);
if($_POST["optionlocaltax1"]=="localtax1on")
{
@ -173,9 +173,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
}
else
{
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1','alpha'),'chaine',0,'',$conf->entity);
}
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", $_POST["clt1"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1",'alpha'),'chaine',0,'',$conf->entity);
}
if($_POST["optionlocaltax2"]=="localtax2on")
{
@ -185,9 +185,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
}
else
{
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2','alpha'),'chaine',0,'',$conf->entity);
}
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", $_POST["clt2"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db,"MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2",'alpha'),'chaine',0,'',$conf->entity);
}
if ($action != 'updateedit' && ! $error)
@ -207,7 +207,7 @@ if ($action == 'addthumb') // Regenerate thumbs
if ($isimage > 0)
{
// Create thumbs
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
// Create small thumb. Used on logon for example
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
@ -309,72 +309,72 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM:$_POST["nom"]) . '" autofocus="autofocus"></td></tr>'."\n";
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_SOCIETE_NOM?$conf->global->MAIN_INFO_SOCIETE_NOM: GETPOST("nom",'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n";
// Addresse
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS:$_POST["address"]) . '</textarea></td></tr>'."\n";
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP:$_POST["zipcode"]) . '"></td></tr>'."\n";
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN:$_POST["town"]) . '"></td></tr>'."\n";
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
// Country
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print $form->select_country($mysoc->country_id,'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id');
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
print $form->selectCurrency($conf->currency,"currency");
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_SOCIETE_TEL . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_SOCIETE_FAX . '"></td></tr>';
print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_SOCIETE_MAIL . '"></td></tr>';
print '</td></tr>'."\n";
// Web
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_SOCIETE_WEB . '"></td></tr>';
print '</td></tr>'."\n";
// Barcode
if (! empty($conf->barcode->enabled)) {
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<input name="barcode" id="barcode" class="minwidth150" value="'. $conf->global->MAIN_INFO_SOCIETE_GENCOD . '"></td></tr>';
print '</td></tr>';
}
// Logo
print '<tr'.dol_bc($var,'hideonsmartphone').'><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
@ -392,9 +392,9 @@ if ($action == 'edit' || $action == 'updateedit')
print '</td></tr>';
// Note
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '').'</textarea></td></tr>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note','none') ? GETPOST('note','none') : $conf->global->MAIN_INFO_SOCIETE_NOTE).'</textarea></td></tr>';
print '</td></tr>';
print '</table>';
@ -409,17 +409,17 @@ if ($action == 'edit' || $action == 'updateedit')
$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="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
// Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
print '<input name="capital" id="capital" class="minwidth100" value="' . $conf->global->MAIN_INFO_CAPITAL . '"></td></tr>';
// Juridical Status
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
if ($mysoc->country_code) {
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
@ -431,7 +431,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfID1
if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -447,7 +447,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfId2
if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -463,7 +463,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfId3
if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -479,7 +479,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfId4
if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -495,7 +495,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfId5
if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -511,7 +511,7 @@ if ($action == 'edit' || $action == 'updateedit')
// ProfId6
if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6",$mysoc->country_code).'</label></td><td>';
if (! empty($mysoc->country_code))
{
@ -525,13 +525,13 @@ if ($action == 'edit' || $action == 'updateedit')
}
// TVA Intra
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
print '<input name="tva" id="intra_vat" class="minwidth200" value="' . (! empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '') . '">';
print '</td></tr>';
// Object of the company
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
print '</td></tr>';
@ -546,7 +546,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
@ -561,7 +561,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"use_vat\" value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
@ -570,7 +570,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"140\"><label><input type=\"radio\" name=\"optiontva\" id=\"no_vat\" value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</label></td>";
print '<td colspan="2">';
print "<table>";
@ -593,7 +593,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td>'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).'</td><td>'.$langs->trans("Description").'</td>';
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
@ -616,7 +616,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";
@ -637,7 +637,7 @@ if ($action == 'edit' || $action == 'updateedit')
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
// Note: When option is not set, it must not appears as set on on, because there is no default value for this option
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
@ -657,7 +657,7 @@ if ($action == 'edit' || $action == 'updateedit')
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"140\"><input type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";
@ -693,22 +693,22 @@ else
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("CompanyName").'</td><td>';
if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM;
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).'</font>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyCountry").'</td><td>';
if ($mysoc->country_code)
{
@ -719,13 +719,13 @@ else
else print img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("State").'</td><td>';
if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE);
else print '&nbsp;';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CompanyCurrency").'</td><td>';
print currency_name($conf->currency,1);
print ' ('.$conf->currency;
@ -733,28 +733,28 @@ else
print ')';
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '</td></tr>';
// Web
print '<tr class="oddeven"><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '</td></tr>';
// Barcode
if (! empty($conf->barcode->enabled))
{
print '<tr class="oddeven"><td>'.$langs->trans("Gencod").'</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
}
// Logo
print '<tr class="oddeven"><td>'.$langs->trans("Logo").'</td><td>';
$tagtd='tagtd ';
@ -780,7 +780,7 @@ else
print '</td></tr>';
print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '</td></tr>';
print '</table>';
@ -796,17 +796,17 @@ else
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Managing Director(s)
print '<tr class="oddeven"><td>'.$langs->trans("ManagingDirectors").'</td><td>';
print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
// Capital
print '<tr class="oddeven"><td>'.$langs->trans("Capital").'</td><td>';
print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>';
// Juridical Status
print '<tr class="oddeven"><td>'.$langs->trans("JuridicalStatus").'</td><td>';
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
print '</td></tr>';
@ -814,7 +814,7 @@ else
// ProfId1
if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId1",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_SIREN))
{
@ -830,7 +830,7 @@ else
// ProfId2
if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId2",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_SIRET))
{
@ -846,7 +846,7 @@ else
// ProfId3
if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId3",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_APE))
{
@ -862,7 +862,7 @@ else
// ProfId4
if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId4",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_RCS))
{
@ -878,7 +878,7 @@ else
// ProfId5
if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId5",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_PROFID5))
{
@ -894,7 +894,7 @@ else
// ProfId6
if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-')
{
print '<tr class="oddeven"><td>'.$langs->transcountry("ProfId6",$mysoc->country_code).'</td><td>';
if (! empty($conf->global->MAIN_INFO_PROFID6))
{
@ -908,7 +908,7 @@ else
}
// VAT
print '<tr class="oddeven"><td>'.$langs->trans("VATIntra").'</td>';
print '<td>';
if (! empty($conf->global->MAIN_INFO_TVAINTRA))
@ -944,8 +944,8 @@ else
}
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td class="tdtop">'.$langs->trans("CompanyObject").'</td><td>' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '</td></tr>';
print '</table>';
@ -960,7 +960,7 @@ else
print '<td class="titlefield">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>'.$langs->trans("FiscalMonthStart").'</td><td>';
$monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '</td></tr>';
@ -977,7 +977,7 @@ else
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"use_vat\" disabled value=\"1\"".(empty($conf->global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed")."</td>";
print '<td colspan="2">';
print "<table>";
@ -986,7 +986,7 @@ else
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optiontva\" id=\"no_vat\" disabled value=\"0\"".(empty($conf->global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed")."</td>";
print '<td colspan="2">';
print "<table>";
@ -1011,7 +1011,7 @@ else
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"lt1\" disabled value=\"localtax1on\"".(($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";
@ -1039,7 +1039,7 @@ else
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax1\" id=\"nolt1\" disabled value=\"localtax1off\"".((empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";
@ -1061,7 +1061,7 @@ else
print '<td align="right">&nbsp;</td>';
print "</tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" disabled value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";
@ -1090,7 +1090,7 @@ else
print "</table>";
print "</td></tr>\n";
print "<tr class=\"oddeven\"><td width=\"160\"><input class=\"oddeven\" type=\"radio\" name=\"optionlocaltax2\" id=\"nolt2\" disabled value=\"localtax2off\"".((empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."</td>";
print '<td colspan="2">';
print "<table>";

View File

@ -37,7 +37,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='contract';
if (empty($conf->global->CONTRACT_ADDON))
@ -397,7 +397,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -409,7 +409,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -1010,6 +1010,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
// Line for title
@ -1153,6 +1154,7 @@ if ($id)
if ($id == 4) $colspan++;
print '</table>';
print '</div>';
/*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
{
@ -1182,6 +1184,7 @@ if ($id)
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
}
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
// Title line with search boxes
@ -1626,6 +1629,7 @@ if ($id)
}
print '</table>';
print '</div>';
}
else {
dol_print_error($db);

View File

@ -0,0 +1,67 @@
<?php
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
* it under the terms of the GNU General Public License as published bypliance with the License.
* the Free Software Foundation; either version 3 of the License, or
*
* 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 <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1);
/**
* \file htdocs/commande/info.php
* \ingroup commande
* \brief Page des informations d'une commande
*/
$res = 0;
if (!$res && file_exists("../main.inc.php")) $res = @include("../main.inc.php");
if (!$res && file_exists("../../main.inc.php")) $res = @include("../../main.inc.php");
if (!$res && file_exists("../../../main.inc.php")) $res = @include("../../../main.inc.php");
if (!$res && file_exists("../../../../main.inc.php")) $res = @include("../../../../main.inc.php");
if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php"))
$res = @include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php"))
$res = @include("../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
if (!$res && file_exists("../../../../../dolibarr/htdocs/main.inc.php"))
$res = @include("../../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only
if (!$res) die("Include of main fails");
// CORE
global $lang, $user, $conf;
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
$dolistore = new Dolistore();
$id_product = GETPOST('id_product', 'int');
$id_image = GETPOST('id_image', 'int');
// quality : image resize with this in the URL : "cart_default", "home_default", "large_default", "medium_default", "small_default", "thickbox_default"
$quality = GETPOST('quality', 'alpha');
try {
$url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality;
$api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api);
//echo $url;
$request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
header('Content-type:image');
print $request['response'];
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}

View File

@ -0,0 +1,440 @@
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* PrestaShop Webservice Library
* @package PrestaShopWebservice
*/
/**
* @package PrestaShopWebservice
*/
class PrestaShopWebservice
{
/** @var string Shop URL */
protected $url;
/** @var string Authentification key */
protected $key;
/** @var boolean is debug activated */
protected $debug;
/** @var string PS version */
protected $version;
/** @var array compatible versions of PrestaShop Webservice */
const PSCOMPATIBLEVERSIONMIN = '1.4.0.0';
const PSCOMPATIBLEVERSIONMAX = '1.6.99.99';
/**
* PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* // Now we have a webservice object to play with
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
* @param string $url Root URL for the shop
* @param string $key Authentification key
* @param mixed $debug Debug mode Activated (true) or deactivated (false)
*/
function __construct($url, $key, $debug = true) {
if (!extension_loaded('curl'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
$this->url = $url;
$this->key = $key;
$this->debug = $debug;
$this->version = 'unknown';
}
/**
* Take the status code and throw an exception if the server didn't return 200 or 201 code
*
* @param int $status_code Status code of an HTTP return
*/
protected function checkStatusCode($status_code)
{
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
switch($status_code)
{
case 200:
case 201:
break;
case 204:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
case 400:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
case 401:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
case 404:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
case 405:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
case 500:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
default:
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
}
}
/**
* Handles a CURL request to PrestaShop Webservice. Can throw exception.
*
* @param string $url Resource name
* @param mixed $curl_params CURL parameters (sent to curl_set_opt)
* @return array status_code, response
*/
public function executeRequest($url, $curl_params = array())
{
$defaultParams = array(
CURLOPT_HEADER => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLINFO_HEADER_OUT => TRUE,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_USERPWD => $this->key.':',
CURLOPT_HTTPHEADER => array( 'Expect:' )
);
$session = curl_init($url);
$curl_options = array();
foreach ($defaultParams as $defkey => $defval)
{
if (isset($curl_params[$defkey]))
$curl_options[$defkey] = $curl_params[$defkey];
else
$curl_options[$defkey] = $defaultParams[$defkey];
}
foreach ($curl_params as $defkey => $defval)
if (!isset($curl_options[$defkey]))
$curl_options[$defkey] = $curl_params[$defkey];
curl_setopt_array($session, $curl_options);
$response = curl_exec($session);
$index = strpos($response, "\r\n\r\n");
if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD')
throw new PrestaShopWebserviceException('Bad HTTP response');
$header = substr($response, 0, $index);
$body = substr($response, $index + 4);
$headerArrayTmp = explode("\n", $header);
$headerArray = array();
foreach ($headerArrayTmp as &$headerItem)
{
$tmp = explode(':', $headerItem);
$tmp = array_map('trim', $tmp);
if (count($tmp) == 2)
$headerArray[$tmp[0]] = $tmp[1];
}
if (array_key_exists('PSWS-Version', $headerArray))
{
$this->version = $headerArray['PSWS-Version'];
if (
version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMIN, $headerArray['PSWS-Version']) == 1 ||
version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMAX, $headerArray['PSWS-Version']) == -1
)
throw new PrestaShopWebserviceException('This library is not compatible with this version of PrestaShop. Please upgrade/downgrade this library');
}
if ($this->debug)
{
$this->printDebug('HTTP REQUEST HEADER', curl_getinfo($session, CURLINFO_HEADER_OUT));
$this->printDebug('HTTP RESPONSE HEADER', $header);
}
$status_code = curl_getinfo($session, CURLINFO_HTTP_CODE);
if ($status_code === 0)
throw new PrestaShopWebserviceException('CURL Error: '.curl_error($session));
curl_close($session);
if ($this->debug)
{
if ($curl_params[CURLOPT_CUSTOMREQUEST] == 'PUT' || $curl_params[CURLOPT_CUSTOMREQUEST] == 'POST')
$this->printDebug('XML SENT', urldecode($curl_params[CURLOPT_POSTFIELDS]));
if ($curl_params[CURLOPT_CUSTOMREQUEST] != 'DELETE' && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD')
$this->printDebug('RETURN HTTP BODY', $body);
}
return array('status_code' => $status_code, 'response' => $body, 'header' => $header);
}
/**
* Output debug info
*
* @param string $title Title
* @param string $content Content
* @return void
*/
public function printDebug($title, $content)
{
echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'.$title.'</h6><pre>'.htmlentities($content).'</pre></div>';
}
/**
* Return version
*
* @return string Version
*/
public function getVersion()
{
return $this->version;
}
/**
* Load XML from string. Can throw exception
*
* @param string $response String from a CURL response
* @return SimpleXMLElement status_code, response
*/
protected function parseXML($response)
{
if ($response != '')
{
libxml_clear_errors();
libxml_use_internal_errors(true);
$xml = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
if (libxml_get_errors())
{
$msg = var_export(libxml_get_errors(), true);
libxml_clear_errors();
throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg);
}
return $xml;
}
else
throw new PrestaShopWebserviceException('HTTP response is empty');
}
/**
* Add (POST) a resource
* <p>Unique parameter must take : <br><br>
* 'resource' => Resource name<br>
* 'postXml' => Full XML string to add resource<br><br>
* Examples are given in the tutorial</p>
*
* @param array $options Options
* @return SimpleXMLElement status_code, response
*/
public function add($options)
{
$xml = '';
if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml']))
{
$url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']);
$xml = $options['postXml'];
if (isset($options['id_shop']))
$url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop']))
$url .= '&id_group_shop='.$options['id_group_shop'];
}
else
throw new PrestaShopWebserviceException('Bad parameters given');
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']);
return self::parseXML($request['response']);
}
/**
* Retrieve (GET) a resource
* <p>Unique parameter must take : <br><br>
* 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)<br>
* OR<br>
* 'resource' => Resource name,<br>
* 'id' => ID of a resource you want to get<br><br>
* </p>
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
* // Here in $xml, a SimpleXMLElement object you can parse
* foreach ($xml->children()->children() as $attName => $attValue)
* echo $attName.' = '.$attValue.'<br />';
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
* @param array $options Array representing resource to get.
* @return SimpleXMLElement status_code, response
*/
public function get($options)
{
if (isset($options['url']))
$url = $options['url'];
elseif (isset($options['resource']))
{
$url = $this->url.'/api/'.$options['resource'];
$url_params = array();
if (isset($options['id']))
$url .= '/'.$options['id'];
$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop');
foreach ($params as $p)
foreach ($options as $k => $o)
if (strpos($k, $p) !== false)
$url_params[$k] = $options[$k];
if (count($url_params) > 0)
$url .= '?'.http_build_query($url_params);
}
else
throw new PrestaShopWebserviceException('Bad parameters given ');
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']);
}
/**
* Head method (HEAD) a resource
*
* @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response
*/
public function head($options)
{
if (isset($options['url']))
$url = $options['url'];
elseif (isset($options['resource']))
{
$url = $this->url.'/api/'.$options['resource'];
$url_params = array();
if (isset($options['id']))
$url .= '/'.$options['id'];
$params = array('filter', 'display', 'sort', 'limit');
foreach ($params as $p)
foreach ($options as $k => $o)
if (strpos($k, $p) !== false)
$url_params[$k] = $options[$k];
if (count($url_params) > 0)
$url .= '?'.http_build_query($url_params);
}
else
throw new PrestaShopWebserviceException('Bad parameters given');
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
self::checkStatusCode($request['status_code']);// check the response validity
return $request['header'];
}
/**
* Edit (PUT) a resource
* <p>Unique parameter must take : <br><br>
* 'resource' => Resource name ,<br>
* 'id' => ID of a resource you want to edit,<br>
* 'putXml' => Modified XML string of a resource<br><br>
* Examples are given in the tutorial</p>
*
* @param array $options Array representing resource to edit.
* @return SimpleXMLElement status_code, response
*/
public function edit($options)
{
$xml = '';
if (isset($options['url']))
$url = $options['url'];
elseif ((isset($options['resource'], $options['id']) || isset($options['url'])) && $options['putXml'])
{
$url = (isset($options['url']) ? $options['url'] : $this->url.'/api/'.$options['resource'].'/'.$options['id']);
$xml = $options['putXml'];
if (isset($options['id_shop']))
$url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop']))
$url .= '&id_group_shop='.$options['id_group_shop'];
}
else
throw new PrestaShopWebserviceException('Bad parameters given');
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']);// check the response validity
return self::parseXML($request['response']);
}
/**
* Delete (DELETE) a resource.
* Unique parameter must take : <br><br>
* 'resource' => Resource name<br>
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
* <code>
* <?php
* require_once('./PrestaShopWebservice.php');
* try
* {
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
* // Following code will not be executed if an exception is thrown.
* echo 'Successfully deleted.';
* }
* catch (PrestaShopWebserviceException $ex)
* {
* echo 'Error : '.$ex->getMessage();
* }
* ?>
* </code>
* @param array $options Array representing resource to delete.
* @return boolean true
*/
public function delete($options)
{
if (isset($options['url']))
$url = $options['url'];
elseif (isset($options['resource']) && isset($options['id']))
if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
if (isset($options['id_shop']))
$url .= '&id_shop='.$options['id_shop'];
if (isset($options['id_group_shop']))
$url .= '&id_group_shop='.$options['id_group_shop'];
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity
return true;
}
}
/**
* @package PrestaShopWebservice
*/
class PrestaShopWebserviceException extends Exception
{
}

View File

@ -0,0 +1,320 @@
<?php
/*
* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
*
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
* it under the terms of the GNU General Public License as published bypliance with the License.
* the Free Software Foundation; either version 3 of the License, or
*
* 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 <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
/**
* Class DolistoreModel
*/
class DolistoreModel
{
function get_categories($parent = 0)
{
if (!isset($this->categories)) die('not possible');
if ($parent != 0) {
$html = '<ul>';
} else {
$html = '';
}
$nbofcateg = count($this->categories);
for ($i = 0; $i < $nbofcateg; $i++)
{
$cat = $this->categories[$i];
if ($cat->is_root_category == 1 && $parent == 0) {
$html .= '<li class="root"><h3 class="nomargesupinf"><a class="nomargesupinf link2cat" href="?mode=marketplace&categorie='.$cat->id.'" '
.'title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'"'
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a></h3>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau
$select = ($cat->id == $this->categorie) ? ' selected' : '';
$html .= '<li><a class="link2cat'.$select.'" href="?mode=marketplace&categorie='.$cat->id.'"'
.' title="'.dol_escape_htmltag(strip_tags($cat->description->language[$this->lang])).'" '
.'>'.$cat->name->language[$this->lang].' <sup>'.$cat->nb_products_recursive.'</sup></a>';
$html .= self::get_categories($cat->id);
$html .= "</li>\n";
} else {
}
}
if ($html == '<ul>') {
return '';
}
if ($parent != 0) {
return $html.'</ul>';
} else {
return $html;
}
}
function get_products()
{
global $langs, $conf;
$html = "";
$parity = "pair";
$last_month = time() - (30 * 24 * 60 * 60);
foreach ($this->products as $product) {
$parity = ($parity == "impair") ? 'pair' : 'impair';
// check new product ?
$newapp = '';
if ($last_month < strtotime($product->date_add)) {
$newapp .= '<span class="newApp">'.$langs->trans('New').'</span> ';
}
// check updated ?
if ($last_month < strtotime($product->date_upd) && $newapp == '') {
$newapp .= '<span class="updatedApp">'.$langs->trans('Updated').'</span> ';
}
// add image or default ?
if ($product->id_default_image != '') {
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
} else {
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
}
// free or pay ?
if ($product->price > 0) {
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).'&nbsp;&euro;</h3>';
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
2).'" /></a>';
} else {
$price = $langs->trans('Free');
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
2).'" /></a>';
}
//checking versions
if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) {
if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) {
//compatible
$version = '<span class="compatible">'.$langs->trans('CompatibleUpTo', $product->dolibarr_max,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = '';
} else {
//never compatible, module expired
$version = '<span class="notcompatible">'.$langs->trans('NotCompatible', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
} else {
//need update
$version = '<span class="compatibleafterupdate">'.$langs->trans('CompatibleAfterUpdate', DOL_VERSION,
$product->dolibarr_min, $product->dolibarr_max).'</span>';
$compatible = 'NotCompatible';
}
//output template
$html .= '<tr class="app '.$parity.' '.$compatible.'">
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
.'<br/><small>'.$version.'</small></h2>
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
<td class="margeCote" align="right">'.$price.'</td>
<td class="margeCote">'.$download_link.'</td>
</tr>';
}
return $html;
}
function get_previous_link($text = '<<')
{
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
}
function get_next_link($text = '>>')
{
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
}
}
/**
* Class Dolistore
*/
class Dolistore extends DolistoreModel
{
// params
public $start // beginning of pagination
, $end // end of pagination
, $per_page // pagination: display per page
, $categorie // the current categorie
, $search // the search keywords
// setups
, $url // the url of this page
, $shop_url // the url of the shop
, $vat_rate // the vat rate used in the shop (prices are provided without vat)
, $lang // the integer representing the lang in the store
, $debug_api; // usefull if no dialog
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{
global $conf, $langs;
$this->start = $options['start'];
$this->end = $options['end'];
$this->per_page = $options['per_page'];
$this->categorie = $options['categorie'];
$this->search = $options['search'];
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
$this->vat_rate = 1.2; // 20% de TVA
$this->debug_api = false;
if ($this->end == 0) {
$this->end = $this->per_page;
}
$langtmp = explode('_', $langs->defaultlang);
$lang = $langtmp[0];
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
try {
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
// Here we set the option array for the Webservice : we want products resources
$opt = array();
$opt['resource'] = 'products';
// make a search to limit the id returned.
if ($this->search != '') {
$opt2 = array();
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->products->children() as $product) {
$products[] = (int) $product['id'];
}
$opt['filter[id]'] = '['.implode('|', $products).']';
} elseif ($this->categorie != 0) {
$opt2 = array();
$opt2['resource'] = 'categories';
$opt2['id'] = $this->categorie;
// Call
$xml = $this->api->get($opt2);
$products = array();
foreach ($xml->category->associations->products->children() as $product) {
$products[] = (int) $product->id;
}
$opt['filter[id]'] = '['.implode('|', $products).']';
}
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
$opt['sort'] = 'id_desc';
$opt['filter[active]'] = '[1]';
$opt['limit'] = "$this->start,$this->end";
// Call
$xml = $this->api->get($opt);
$this->products = $xml->products->children();
// Here we set the option array for the Webservice : we want categories resources
$opt = array();
$opt['resource'] = 'categories';
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
$opt['sort'] = 'id_asc';
// Call
$xml = $this->api->get($opt);
$this->categories = $xml->categories->children();
} catch (PrestaShopWebserviceException $e) {
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) die('Bad ID');
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
}
}
function get_previous_url()
{
$param_array = array();
if ($this->start < $this->per_page) {
$sub = 0;
} else {
$sub = $this->per_page;
}
$param_array['start'] = $this->start - $sub;
$param_array['end'] = $this->end - $sub;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function get_next_url()
{
$param_array = array();
if (count($this->products) < $this->per_page) {
$add = 0;
} else {
$add = $this->per_page;
}
$param_array['start'] = $this->start + $add;
$param_array['end'] = $this->end + $add;
if ($this->categorie != 0) {
$param_array['categorie'] = $this->categorie;
}
$param = http_build_query($param_array);
return $this->url."&".$param;
}
function version_compare($v1, $v2)
{
$v1 = explode('.', $v1);
$v2 = explode('.', $v2);
$ret = 0;
$level = 0;
$count1 = count($v1);
$count2 = count($v2);
$maxcount = max($count1, $count2);
while ($level < $maxcount) {
$operande1 = isset($v1[$level]) ? $v1[$level] : 'x';
$operande2 = isset($v2[$level]) ? $v2[$level] : 'x';
$level++;
if (strtoupper($operande1) == 'X' || strtoupper($operande2) == 'X' || $operande1 == '*' || $operande2 == '*') {
break;
}
if ($operande1 < $operande2) {
$ret = -$level;
break;
}
if ($operande1 > $operande2) {
$ret = $level;
break;
}
}
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\n";
return $ret;
}
}

View File

@ -0,0 +1,72 @@
<html><head><title>CRUD Tutorial - Customer's list</title></head><body>
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* PrestaShop Webservice Library
* @package PrestaShopWebservice
*/
// Here we define constants /!\ You need to replace this parameters
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
define('DEBUG', true); // Debug mode
define('PS_SHOP_PATH', 'https://www.dolistore.com/'); // Root path of your PrestaShop store
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
require_once('./PSWebServiceLibrary.php');
// Here we make the WebService Call
try
{
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
// Here we set the option array for the Webservice : we want customers resources
$opt['resource'] = 'categories';
$opt['id'] = '1';
// Call
$xml = $webService->get($opt);
// Here we get the elements from children of customers markup "customer"
$resources = $xml->categories->children();
}
catch (PrestaShopWebserviceException $e)
{
// Here we are dealing with errors
$trace = $e->getTrace();
if ($trace[0]['args'][0] == 404) echo 'Bad ID';
else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
else echo 'Other error';
}
// We set the Title
echo "<h1>Categories's List</h1>";
echo '<table border="5">';
// if $resources is set we can lists element in it otherwise do nothing cause there's an error
if (isset($resources))
{
echo '<tr><th>Id</th></tr>';
foreach ($resources as $resource)
{
// Iterates on the found IDs
echo '<tr><td>'.$resource->attributes().'</td></tr>';
}
}
echo '</table>';
?>
</body></html>

View File

@ -0,0 +1,234 @@
div.divsearchfield {
float: left;
margin: 4px 12px 4px 2px;
padding-left: 2px;
}
.margeCoteGauche,.margeCote{
padding-right: 20px!important;
}
.margeCote,.margeCoteDroite{
padding-left: 20px!important;
}
.nomargesupinf{
margin-top: 0;
margin-bottom: 0;
}
#category-tree-left{
display: none;
vertical-align: top;
width: 24%;
}
#listing-content{
box-sizing: border-box;
display: inline-block;
width: 100%;
}
.tree{
margin: 0px 0px 0px 0px;
padding:0px;
list-style: none; line-height: 2em; font-family: Arial;
}
.tree li{
font-size: 16px;
position: relative;list-style: none;
}
.tree li:before{
position: absolute;
left: -15px;
top: -4px;
content: '';
display: block;
border-left: 1px solid #ddd;
height: 1em;
border-bottom: 1px solid #ddd;
width: 10px;
}
.tree li:after{
position: absolute;
left: -15px;
bottom: -7px;
content: '';
display: block;
border-left: 1px solid #ddd;
height: 100%;
}
.tree li.root{
margin: 0px 0px 0px 0px;
}
.tree li.root:before{
display: none;
}
.tree li.root:after{
display: none;
}
.tree li:last-child:after{
display: none
}
.blockUI {
cursor: auto!important;
}
.newAppParent{
position: relative;
overflow: hidden;
min-height: 100px;
}
.newApp, .updatedApp{
background-color: orange;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.35);
box-sizing: border-box;
color: white;
display: block;
font-size: 18px;
font-weight: bold;
left: -34px;
padding: 5px 0;
position: absolute;
text-align: center;
text-shadow: 0 0 5px rgba(0, 0, 0, 0.35);
top: 22px;
transform: rotate(-45deg);
width: 150px;
}
.updatedApp{
background-color: greenyellow;
}
.notcompatible {
color: red;
}
.compatibleafterupdate {
color: orange;
}
.compatible {
background-image: url("../img/compatible.png");
background-position: left center;
background-repeat: no-repeat;
color: green;
display: inline-block;
height: 32px;
line-height: 32px;
padding-left: 35px;
}
tr.app {
height:250px;
}
div#newsDoli.tabBar {
margin-top: 50px;
margin-right: 30px;
}
.selected {
text-decoration: underline!important;
}
.searchDolistore, .searchDolistore:hover {
padding-left: 30px;
padding-right: 30px;
font-weight: bold;
}
.searchDolistore:hover {
text-decoration: underline!important;
}
.score{
font-size: 16px;
font-weight: bold;
}
.formReviewArea{
display:none;
}
.formReview div.divsearchfield{
float: none;
}
.input100{
box-sizing: border-box;
width: 100%;
}
.input50{
box-sizing: border-box;
width: 49%;
}
textarea.row4{
min-height: 100px;
}
.reviewList {
max-height: 150px;
overflow-y: scroll;
}
.reviewRow{
margin-bottom: 20px;
}
.reviewRow .reviewMarge {
float:left;
width: 220px;
padding: 0 20px 20px 0;
}
.reviewRow .score {
font-size: 48px;
display: block;
text-align: center;
}
.reviewRow .reviewDate {
color:grey;
}
.reviewRow:after{
clear: both;
content:'';
display: block;
}
h2.appTitle small{
font-weight: normal;
}
tr.NotCompatible{
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=25)";
/* IE 5-7 */
filter: alpha(opacity=25);
/* Netscape */
-moz-opacity: 0.25;
/* Safari 1.x */
-khtml-opacity: 0.25;
/* Good browsers */
opacity: 0.25;
}
tr.NotCompatible:hover{
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
/* IE 5-7 */
filter: alpha(opacity=100);
/* Netscape */
-moz-opacity: 1;
/* Safari 1.x */
-khtml-opacity: 1;
/* Good browsers */
opacity: 1;
}
@media only screen and (min-width: 1150px) {
#categorieArea{
display:none;
}
#category-tree-left{
display:inline-block;
}
#listing-content{
width: 75%;
}
}
span.details{
font-size: 12px;
margin-left: 10px;
vertical-align: super;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -45,7 +45,7 @@ if (! $user->admin)
$action=GETPOST('action','alpha');
$value=GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='shipping';
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
@ -263,7 +263,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
}
@ -402,7 +402,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
@ -440,7 +440,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"),'sending').'</a>';
}
else
{

View File

@ -44,7 +44,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='expensereport';
@ -207,24 +207,26 @@ $head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip');
// Interventions numbering model
/*
print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
* Expense report numbering model
*/
print load_fiche_titre($langs->trans("ExpenseReportNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print "</tr>\n";
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/fichinter/");
$dir = dol_buildpath($reldir."core/modules/expensereport/");
if (is_dir($dir))
{
@ -235,21 +237,20 @@ foreach ($dirmodels as $reldir)
while (($file = readdir($handle))!==false)
{
if (preg_match('/^(mod_.*)\.php$/i',$file,$reg))
if (substr($file, 0, 18) == 'mod_expensereport_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = $reg[1];
$classname = substr($file,4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once $dir.$file.'.php';
$module = new $file;
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info();
@ -264,24 +265,26 @@ foreach ($dirmodels as $reldir)
print '</td>'."\n";
print '<td align="center">';
if ($conf->global->FICHEINTER_ADDON == $classname)
if ($conf->global->EXPENSEREPORT_ADDON == $file)
{
print img_picto($langs->trans("Activated"),'switch_on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>';
}
print '</td>';
$ficheinter=new Fichinter($db);
$ficheinter->initAsSpecimen();
$exp=new ExpenseReport($db);
$exp->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval=$module->getNextValue($mysoc,$ficheinter);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$nextval=$module->getNextValue($exp);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
@ -291,11 +294,12 @@ foreach ($dirmodels as $reldir)
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '</tr>';
print "</tr>\n";
}
}
}
@ -303,9 +307,7 @@ foreach ($dirmodels as $reldir)
}
}
}
print '</table><br>';
*/
print "</table><br>\n";
/*
* Documents models for Interventions
@ -398,7 +400,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
@ -406,7 +408,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -418,7 +420,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -44,7 +44,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='ficheinter';
@ -431,7 +431,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -451,7 +451,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
@ -495,7 +495,6 @@ print "<br>";
/*
* Other options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"),'','');

View File

@ -101,25 +101,24 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="update">';
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_UNIT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_UNIT . '"></td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_TOT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_TOT . '"></td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td><input class="flat" name="MAIN_MAX_DECIMALS_SHOWN" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_SHOWN . '"></td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td><input class="flat" name="MAIN_ROUNDING_RULE_TOT" size="3" value="' . $conf->global->MAIN_ROUNDING_RULE_TOT . '"></td></tr>';
@ -135,25 +134,23 @@ if ($action == 'edit')
}
else
{
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_UNIT.'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_TOT.'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td align="right">'.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly"));
print '</td><td align="right">'.$conf->global->MAIN_ROUNDING_RULE_TOT.'</td></tr>';

View File

@ -44,7 +44,7 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='delivery';
@ -385,7 +385,7 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def))
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
print "</td>";
@ -393,7 +393,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -405,7 +405,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -46,13 +46,18 @@ if ($action == 'test' || $action == 'send')
}
$substitutionarrayfortest=array(
'__LOGIN__' => $user->login,
'__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail',
'__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''),
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''), // Done into actions_sendmails
'__LOGIN__' => 'RecipientLogin',
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
'__ADDRESS__'=> 'RecipientAddress',
'__ZIP__'=> 'RecipientZip',
'__TOWN_'=> 'RecipientTown',
'__COUNTRY__'=> 'RecipientCountry'
);
complete_substitutions_array($substitutionarrayfortest, $langs);
@ -114,7 +119,7 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S
if (! $server) $server='127.0.0.1';
$wikihelp='EN:Setup EMails|FR:Paramétrage EMails|ES:Configuración EMails';
$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
llxHeader('',$langs->trans("Setup"),$wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
@ -127,6 +132,14 @@ $head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
if ($conf->mailing->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
$head[$h][2] = 'common_emailing';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
@ -238,7 +251,7 @@ if ($action == 'edit')
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
@ -462,7 +475,7 @@ else
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable

View File

@ -0,0 +1,643 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/mails.php
* \brief Page to setup emails sending
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("companies");
$langs->load("products");
$langs->load("admin");
$langs->load("mails");
$langs->load("other");
$langs->load("errors");
$action=GETPOST('action','alpha');
if (! $user->admin) accessforbidden();
$usersignature=$user->signature;
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
if ($action == 'test' || $action == 'send')
{
$usersignature=dol_string_nohtmltag($usersignature);
}
$substitutionarrayfortest=array(
'__LOGIN__' => $user->login,
'__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail',
'__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname',
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$usersignature:''),
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
);
complete_substitutions_array($substitutionarrayfortest, $langs);
/*
* Actions
*/
if ($action == 'update' && empty($_POST["cancel"]))
{
// Send mode parameters
dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_EMAILING", GETPOST("MAIN_MAIL_SMTPS_ID_EMAILING"), 'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING"), 'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"),'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
// Actions to send emails
$id=0;
$actiontypecode=''; // Not an event for agenda
$trigger_name=''; // Disable triggers
$paramname='id';
$mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
$sendcontext='emailing'; // Force to use dedicated context of setup for emailing
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') $action='testhtml';
/*
* View
*/
$linuxlike=1;
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
if (empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING)) $conf->global->MAIN_MAIL_SENDMODE_EMAILING='default';
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING)?$conf->global->MAIN_MAIL_SMTP_PORT_EMAILING:ini_get('smtp_port');
if (! $port) $port=25;
$server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:ini_get('SMTP');
if (! $server) $server='127.0.0.1';
$wikihelp='EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
llxHeader('',$langs->trans("Setup"),$wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
if ($conf->mailing->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
$head[$h][2] = 'common_emailing';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
$h++;
// List of sending methods
$listofmethods=array();
$listofmethods['default']=$langs->trans('DefaultOutgoingEmailSetup');
$listofmethods['mail']='PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps']='SMTP/SMTPS socket library';
$listofmethods['swiftmailer']='Swift Mailer socket library';
if ($action == 'edit')
{
$form=new Form($db);
if ($conf->use_javascript_ajax)
{
print "\n".'<script type="text/javascript" language="javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\')
{
jQuery(".hideifdefault").hide();
}
else
{
jQuery(".hideifdefault").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\')
{
jQuery(".drag").hide();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
';
if ($linuxlike)
{
print '
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").hide();
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").hide();
jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show();
';
}
else
{
print '
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true);
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
';
}
print '
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\')
{
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
{
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
}
}
initfields();
jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
initfields();
});
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
});
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
});
})';
print '</script>'."\n";
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'common_emailing', '', -1);
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
// SuperAdministrator access only
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
{
print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING',$listofmethods,$conf->global->MAIN_MAIL_SENDMODE_EMAILING);
}
else
{
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
if (empty($text)) $text = $langs->trans("Undefined");
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text,$htmltext,1,'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SENDMODE_EMAILING" value="'.$conf->global->MAIN_MAIL_SENDMODE_EMAILING.'">';
}
print '</td></tr>';
// Host server
print '<tr class="oddeven hideifdefault"><td>';
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')
{
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup");
}
else
{
$mainserver = (! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:'');
$smtpserver = ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_SERVER",$smtpserver);
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="' . $mainserver . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="' . $mainserver . '">';
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
}
else
{
$text = ! empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text,$htmltext,1,'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
}
}
print '</td></tr>';
// Port
print '<tr class="oddeven hideifdefault"><td>';
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')
{
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup");
}
else
{
$mainport = (! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
$smtpport = ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
else print $langs->trans("MAIN_MAIL_SMTP_PORT",$smtpport);
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && ! $user->entity))
{
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="' . $mainport . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="' . $mainport . '">';
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
}
else
{
$text = (! empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text,$htmltext,1,'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="'.$mainport.'">';
}
}
print '</td></tr>';
// ID
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:'');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="' . $mainstmpid . '">';
}
else
{
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING,$htmltext,1,'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="'.$mainstmpid.'">';
}
print '</td></tr>';
}
// PW
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING:'');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
}
else
{
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING,$htmltext,1,'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="'.$mainsmtppw.'">';
}
print '</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
if (function_exists('openssl_open'))
{
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING',(! empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING)?$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING:0),1);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// STARTTLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
if (function_exists('openssl_open'))
{
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING',(! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING)?$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING:0),1);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
print '</table>';
dol_fiche_end();
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
else
{
dol_fiche_head($head, 'common_emailing', '', -1);
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
if (empty($text)) $text=$langs->trans("Undefined").img_warning();
print $text;
print '</td></tr>';
if (! empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
{
// Host server
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
}
else
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING)?$conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING:'').'</td></tr>';
}
// Port
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
}
else
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).'</td><td>'.(! empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING)?$conf->global->MAIN_MAIL_SMTP_PORT_EMAILING:'').'</td></tr>';
}
// SMTPS ID
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING.'</td></tr>';
}
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING).'</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
if (function_exists('openssl_open'))
{
print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
// STARTTLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
if (function_exists('openssl_open'))
{
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING);
}
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>';
}
print '</table>';
dol_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
/*
// Warning 1
if ($linuxlike)
{
$sendmailoption=ini_get('mail.force_extra_parameters');
if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
{
print info_admin($langs->trans("SendmailOptionNotComplete"));
}
}*/
// Warning 2
print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
}
// Boutons actions
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
if (! empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
{
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || ! $linuxlike)
{
if (function_exists('fsockopen') && $port && $server)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
}
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
if (! empty($conf->fckeditor->enabled))
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
}
}
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
{
$text = $langs->trans("WarningPHPMail");
print info_admin($text);
}
// Run the test to connect
if ($action == 'testconnect')
{
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mail = new CMailFile('','','','');
$result=$mail->check_server_port($server,$port);
if ($result) print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort",$server,$port).'</div>';
else
{
$errormsg = $langs->trans("ServerNotAvailableOnIPOrPort",$server,$port);
if ($mail->error) {
$errormsg .= ' - '.$mail->error;
}
setEventMessages($errormsg, null, 'errors');
}
print '<br>';
}
// Show email send test form
if ($action == 'test' || $action == 'testhtml')
{
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
print load_fiche_titre($action == 'testhtml'?$langs->trans("DoTestSendHTML"):$langs->trans("DoTestSend"));
dol_fiche_head('');
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->fromname = (isset($_POST['fromname'])?$_POST['fromname']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->frommail = (isset($_POST['frommail'])?$_POST['frommail']:$conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->trackid=(($action == 'testhtml')?"testhtml":"test");
$formmail->withfromreadonly=0;
$formmail->withsubstit=0;
$formmail->withfrom=1;
$formmail->witherrorsto=1;
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
$formmail->withtocc=(! empty($_POST['sendtocc'])?$_POST['sendtocc']:1); // ! empty to keep field if empty
$formmail->withtoccc=(! empty($_POST['sendtoccc'])?$_POST['sendtoccc']:1); // ! empty to keep field if empty
$formmail->withtopic=(isset($_POST['subject'])?$_POST['subject']:$langs->trans("Test"));
$formmail->withtopicreadonly=0;
$formmail->withfile=2;
$formmail->withbody=(isset($_POST['message'])?$_POST['message']:($action == 'testhtml'?$langs->transnoentities("PredefinedMailTestHtml"):$langs->transnoentities("PredefinedMailTest")));
$formmail->withbodyreadonly=0;
$formmail->withcancel=1;
$formmail->withdeliveryreceipt=1;
$formmail->withfckeditor=($action == 'testhtml'?1:0);
$formmail->ckeditortoolbar='dolibarr_mailings';
// Tableau des substitutions
$formmail->substit=$substitutionarrayfortest;
// Tableau des parametres complementaires du post
$formmail->param["action"]="send";
$formmail->param["models"]="body";
$formmail->param["mailid"]=0;
$formmail->param["returnurl"]=$_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode")=='init')
{
$formmail->clear_attached_files();
}
print $formmail->get_form('addfile','removefile');
dol_fiche_end();
}
}
llxFooter();
$db->close();

View File

@ -45,6 +45,7 @@ $langs->load("errors");
$langs->load("admin");
$langs->load("main");
$langs->load("mails");
$langs->load("languages");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
@ -85,17 +86,17 @@ $tabsqlsort[25]="label ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[25]= "label,type_template,private,position,topic,content";
$tabfield[25]= "label,type_template,lang,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
$tabfieldvalue[25]= "label,type_template,lang,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
$tabfieldinsert[25]= "label,type_template,lang,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
@ -144,16 +145,16 @@ $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) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
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) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
@ -204,7 +205,7 @@ if (empty($reshook))
if ($value == 'content') $value='content-'.$rowid;
if ($value == 'content_lines') $value='content_lines-'.$rowid;
if (! isset($_POST[$value]) || $_POST[$value]=='')
if ((! isset($_POST[$value]) || $_POST[$value]=='') && $value != 'lang')
{
$ok=0;
$fieldnamekey=$listfield[$f];
@ -253,15 +254,16 @@ if (empty($reshook))
$i=0;
foreach ($listfieldinsert as $f => $value)
{
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
$keycode=$listfieldvalue[$i];
if ($value == 'lang') $keycode='langcode';
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=",";
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
$sql.=",1)";
@ -301,15 +303,16 @@ if (empty($reshook))
$i = 0;
foreach ($listfieldmodify as $field)
{
$keycode=$listfieldvalue[$i];
if ($field == 'lang') $keycode='langcode';
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
@ -410,6 +413,14 @@ $head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
if ($conf->mailing->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/admin/mails_emailing.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing");
$head[$h][2] = 'common_emailing';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
@ -426,16 +437,13 @@ if ($action == 'delete')
//var_dump($elementList);
$sql="SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active";
$sql="SELECT rowid as rowid, label, type_template, lang, private, position, topic, content_lines, content, active";
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql.=" WHERE entity IN (".getEntity('email_template').")";
if ($search_label) $sql.=natural_search('label', $search_label);
if ($search_country_id > 0)
if (empty($conf->global->MAIN_MULTILANGS))
{
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
}
if ($sortfield)
@ -461,21 +469,21 @@ $sql.=$db->plimit($listlimit+1,$offset);
$fieldlist=explode(',',$tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">';
// Form to add a new line
$alabelisused=0;
$var=false;
$fieldlist=explode(',',$tabfield[$id]);
if ($action != 'edit')
{
// Line for title
//if ($action != 'edit')
//{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">';
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
@ -585,12 +593,13 @@ if ($action != 'edit')
$colspan=count($fieldlist)+1;
//print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
print '</table>';
print '</form>';
print '</table>';
print '<br>';
print '</form>';
print '<br>';
//}
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -691,6 +700,7 @@ if ($resql)
$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';
@ -724,15 +734,15 @@ if ($resql)
// Show value for field
if ($showfield) {
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="5">'; // To create an artificial CR for the current tr we are on
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
print '</td>';
print '<td></td><td></td><td></td>';
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
print '</td>';
print '<td></td><td></td><td></td>';
print '<td></td>';
}
}
}
@ -756,12 +766,16 @@ if ($resql)
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'lang' && $valuetoshow)
{
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
}
$class='tddict';
// Show value for field
if ($showfield)
{
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
}
}
@ -876,14 +890,29 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
if ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
if (! empty($conf->global->MAIN_MULTILANGS))
{
$selectedlang = $langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1);
}
else
{
if (! empty($obj->{$fieldlist[$field]}))
{
print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]});
}
$keyname=$fieldlist[$field];
if ($keyname == 'lang') $keyname='langcode'; // Avoid conflict with lang param
print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">';
}
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
print '</td>';
}
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;

View File

@ -83,27 +83,27 @@ if ($action == 'update')
}
}
}
$menu = new Menubase($db);
$result=$menu->fetch($_POST['menuId']);
$result=$menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0)
{
$menu->titre=$_POST['titre'];
$menu->leftmenu=$_POST['leftmenu'];
$menu->url=$_POST['url'];
$menu->langs=$_POST['langs'];
$menu->position=$_POST['position'];
$menu->enabled=$_POST['enabled'];
$menu->perms=$_POST['perms'];
$menu->target=$_POST['target'];
$menu->user=$_POST['user'];
if (is_numeric($_POST['menuIdParent']))
$menu->titre=GETPOST('titre', 'alpha');
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
$menu->url=GETPOST('url','alpha');
$menu->langs=GETPOST('langs','alpha');
$menu->position=GETPOST('position','int');
$menu->enabled=GETPOST('enabled','alpha');
$menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha');
if (is_numeric(GETPOST('menuIdParent','alpha')))
{
$menu->fk_menu=$_POST['menuIdParent'];
$menu->fk_menu=GETPOST('menuIdParent','alpha');
}
else
{
if ($_POST['type'] == 'top') $menu->fk_menu=0;
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
@ -123,7 +123,6 @@ if ($action == 'update')
{
setEventMessages($menu->error, $menu->errors, 'errors');
}
$_GET["menuId"] = $_POST['menuId'];
$action = "edit";
}
else
@ -148,9 +147,9 @@ if ($action == 'add')
}
$leftmenu=''; $mainmenu='';
if (! empty($_POST['menuId']) && ! is_numeric($_POST['menuId']))
if (GETPOST('menuId','int') && ! is_numeric(GETPOST('menuId','int')))
{
$tmp=explode('&',$_POST['menuId']);
$tmp=explode('&',GETPOST('menuId','int'));
foreach($tmp as $s)
{
if (preg_match('/fk_mainmenu=/',$s))
@ -197,7 +196,7 @@ if ($action == 'add')
$action = 'create';
$error++;
}
if (! $error && empty($_POST['menuId']) && $_POST['type'] == 'left')
if (! $error && ! $_POST['menuId'] && $_POST['type'] == 'left')
{
setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
$action = 'create';
@ -207,23 +206,23 @@ if ($action == 'add')
if (! $error)
{
$menu = new Menubase($db);
$menu->menu_handler=preg_replace('/_menu$/','',$_POST['menu_handler']);
$menu->type=$_POST['type'];
$menu->titre=$_POST['titre'];
$menu->url=$_POST['url'];
$menu->langs=$_POST['langs'];
$menu->position=$_POST['position'];
$menu->enabled=$_POST['enabled'];
$menu->perms=$_POST['perms'];
$menu->target=$_POST['target'];
$menu->user=$_POST['user'];
if (is_numeric($_POST['menuId']))
$menu->menu_handler=preg_replace('/_menu$/','',GETPOST('menu_handler','aZ09'));
$menu->type=GETPOST('type','alpha');
$menu->titre=GETPOST('titre','alpha');
$menu->url=GETPOST('url','alpha');
$menu->langs=GETPOST('langs','alpha');
$menu->position=GETPOST('position','int');
$menu->enabled=GETPOST('enabled','alpha');
$menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha');
if (is_numeric(GETPOST('menuId','int')))
{
$menu->fk_menu=$_POST['menuId'];
$menu->fk_menu=GETPOST('menuId','int');
}
else
{
if ($_POST['type'] == 'top') $menu->fk_menu=0;
if (GETPOST('type','alpha') == 'top') $menu->fk_menu=0;
else $menu->fk_menu=-1;
$menu->fk_mainmenu=$mainmenu;
$menu->fk_leftmenu=$leftmenu;
@ -232,7 +231,7 @@ if ($action == 'add')
$result=$menu->create($user);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$_POST['menu_handler']);
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler','aZ09'));
exit;
}
else
@ -305,17 +304,17 @@ if ($action == 'create')
</script>';
print load_fiche_titre($langs->trans("NewMenu"),'','title_setup');
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
print '<form action="./edit.php?action=add&menuId='.GETPOST('menuId', 'int').'" method="post" name="formmenucreate">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
dol_fiche_head();
print '<table class="border" width="100%">';
// Id
$parent_rowid = $_GET['menuId'];
if ($_GET['menuId'])
$parent_rowid = GETPOST('menuId', 'int');
if (GETPOST('menuId', 'int'))
{
$sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".GETPOST('menuId', 'int');
$res = $db->query($sql);
@ -375,40 +374,40 @@ if ($action == 'create')
}
else
{
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.($_POST["menuId"]?$_POST["menuId"]:'').'"></td>';
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
}
print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>';
// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$_POST["titre"].'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.$_POST["url"].'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
print '<option value=""'.($menu->target==""?' selected':'').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.$_POST["enabled"].'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
// Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.$_POST["perms"].'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
print '</table>';
dol_fiche_end();
// Boutons
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
@ -426,14 +425,14 @@ elseif ($action == 'edit')
print '<form action="./edit.php?action=update" method="POST" name="formmenuedit">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
print '<input type="hidden" name="menuId" value="'.GETPOST('menuId', 'int').'">';
dol_fiche_head();
print '<table class="border" width="100%">';
$menu = new Menubase($db);
$result=$menu->fetch($_GET['menuId']);
$result=$menu->fetch(GETPOST('menuId', 'int'));
//var_dump($menu);
// Id
@ -472,20 +471,20 @@ elseif ($action == 'edit')
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.$menu->titre.'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$menu->langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
print '<option value=""'.($menu->target==""?' selected':'').'>'.$langs->trans('').'</option>';
print '<option value=""'.($menu->target==""?' selected':'').'>&nbsp;</option>';
print '<option value="_blank"'.($menu->target=="_blank"?' selected':'').'>'.$langs->trans('_blank').'</option>';
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
@ -502,7 +501,7 @@ elseif ($action == 'edit')
print '</table>';
dol_fiche_end();
// Bouton
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';

View File

@ -35,7 +35,8 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is n
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("errors");
$langs->load("admin");
@ -371,18 +372,20 @@ if ($mode == 'feature')
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
else $text.=$langs->trans("None");
$text.='<br><br><br>';
$text.='<br><br>';
$text.='<strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
$text.='<br><strong>'.$langs->trans("AddDataTables").':</strong> ';
$sqlfiles = dol_dir_list(dol_buildpath($moduledir.'/sql/'), 'files', 0, 'llx.*\.sql', array('\.key\.sql'));
if (count($sqlfiles) > 0)
{
$i=0;
foreach($objMod->tabs as $val)
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
$text.=$langs->trans("Yes").' (';
$i=0;
foreach($sqlfiles as $val)
{
$text.=($i?', ':'').preg_replace('/\.sql$/','',preg_replace('/llx_/','',$val['name']));
$i++;
}
$text.=')';
}
else $text.=$langs->trans("No");
@ -402,13 +405,24 @@ if ($mode == 'feature')
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
$text.='<br><strong>'.$langs->trans("AddData").':</strong> ';
$filedata = dol_buildpath($moduledir.'/sql/data.sql');
if (dol_is_file($filedata))
{
$text.=$langs->trans("Yes").' ('.$moduledir.'/sql/data.sql'.')';
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i=0;
foreach($objMod->boxes as $val)
foreach($objMod->tabs as $val)
{
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
}
@ -474,6 +488,20 @@ if ($mode == 'feature')
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i=0;
foreach($objMod->boxes as $val)
{
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
$langs->load("errors");
$langs->load("admin");
@ -46,6 +47,17 @@ $search_status=GETPOST('search_status','alpha');
$search_nature=GETPOST('search_nature','alpha');
$search_version=GETPOST('search_version','alpha');
// For dolistore search
$options = array();
$options['per_page'] = 20;
$options['categorie'] = GETPOST('categorie', 'int') + 0;
$options['start'] = GETPOST('start', 'int') + 0;
$options['end'] = GETPOST('end', 'int') + 0;
$options['search'] = GETPOST('search_keyword', 'alpha');
$dolistore = new Dolistore($options);
if (! $user->admin)
accessforbidden();
@ -240,6 +252,11 @@ if ($action == 'reset' && $user->admin)
* View
*/
$form = new Form($db);
$morejs = array("/admin/dolistore/js/dolistore.js.php");
$morecss = array("/admin/dolistore/css/dolistore.css");
// Set dir where external modules are installed
if (! dol_is_dir($dirins))
{
@ -247,10 +264,8 @@ if (! dol_is_dir($dirins))
}
$dirins_ok=(dol_is_dir($dirins));
$form = new Form($db);
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url);
llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0);
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
$arrayofwarnings=array(); // Array of warning each module want to show when activated
@ -423,24 +438,9 @@ print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common";
$head[$h][1] = $langs->trans("AvailableModules");
$head[$h][2] = 'common';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace";
$head[$h][1] = $langs->trans("ModulesMarketPlaces");
$head[$h][2] = 'marketplace';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy";
$head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther");
$head[$h][2] = 'deploy';
$h++;
$head = modules_prepare_head();
print "<br>\n";
@ -817,7 +817,6 @@ if ($mode == 'marketplace')
print '<td>'.$langs->trans("URL").'</td>';
print '</tr>';
print "<tr class=\"oddeven\">\n";
$url='https://www.dolistore.com';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
@ -825,17 +824,57 @@ if ($mode == 'marketplace')
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '</tr>';
print "<tr class=\"oddeven\">\n";
$url='https://partners.dolibarr.org';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '</tr>';
print "</table>\n";
dol_fiche_end();
print '<br>';
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
{
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span>';
?>
<br><br>
<div class="tabBar">
<form method="POST" id="searchFormList" action="<?php echo $dolistore->url ?>">
<input type="hidden" name="mode" value="marketplace" />
<div class="divsearchfield"><?php echo $langs->trans('Mot-cle') ?>:
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
</div>
<div class="divsearchfield">
<input class="button butAction searchDolistore" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
<a class="button butActionDelete" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Tout afficher') ?></a>
</div><br><br><br style="clear: both">
</form>
</div>
<div id="category-tree-left">
<ul class="tree">
<?php echo $dolistore->get_categories(); ?>
</ul>
</div>
<div id="listing-content">
<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">
<thead>
<tr class="liste_titre">
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
</tr>
</thead>
<tbody id="listOfModules">
<?php echo $dolistore->get_products($categorie); ?>
</tbody>
<tfoot>
<tr class="liste_titre">
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
</tr>
</tfoot>
</table>
</div>
<?php
}
}
@ -843,111 +882,133 @@ if ($mode == 'marketplace')
if ($mode == 'deploy')
{
dol_fiche_head($head, $mode, '', -1);
dol_fiche_head($head, $mode, '', -1);
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$message='';
if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$message='';
if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
if ($allowfromweb < 1)
{
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
print $message;
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
print '<br>';
}
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
print '<br>';
if ($allowfromweb < 1)
{
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
print $message;
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
print '<br>';
}
if ($allowfromweb >= 0)
{
if ($allowfromweb == 1)
{
//print $langs->trans("ThisIsProcessToFollow").'<br>';
}
else
{
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
}
print '<br>';
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
if ($allowfromweb >= 0)
{
if ($allowfromweb == 1)
{
//print $langs->trans("ThisIsProcessToFollow").'<br>';
}
else
{
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
}
print '<br>';
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
print '<br>';
print '<br>';
print '<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
print '<div class="center"><div class="logo_setup"></div></div>';
}
else
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
print '<br>';
print '<br>';
if (! empty($result['return']))
{
print '<br>';
print '<div class="center"><div class="logo_setup"></div></div>';
}
else
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
dol_fiche_end();
}
if (! empty($result['return']))
{
print '<br>';
if ($mode == 'develop')
{
dol_fiche_head($head, $mode, '', -1);
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
// Marketplace
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
//print '<td>'.$langs->trans("Logo").'</td>';
print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
print '<td>'.$langs->trans("URL").'</td>';
print '</tr>';
dol_fiche_end();
print "<tr class=\"oddeven\">\n";
$url='https://partners.dolibarr.org';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
print '</tr>';
print "</table>\n";
dol_fiche_end();
}

View File

@ -36,7 +36,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='invoice';
if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON = 'mod_payment_cicada.php';
@ -188,7 +188,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
print '</td>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2105 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -74,7 +74,11 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["_MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
@ -249,6 +253,40 @@ if ($action == 'edit') // Edit
print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
$var=true;
@ -444,6 +482,40 @@ else // Show
print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other
print load_fiche_titre($langs->trans("Other"),'','');
$var=true;

View File

@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -43,7 +43,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='propal';
/*
@ -443,7 +443,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -455,7 +455,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -44,7 +44,7 @@ accessforbidden();
$type=GETPOST('type', 'alpha');
$value=GETPOST('value', 'alpha');
$action=GETPOST('action', 'alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen();
@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
//if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
//{
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
/*}
@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -421,11 +421,11 @@ foreach ($dirmodels as $reldir)
{
//print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -45,7 +45,7 @@ $type=GETPOST('type', 'alpha');
$value=GETPOST('value', 'alpha');
$label = GETPOST('label','alpha');
$action=GETPOST('action', 'alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$specimenthirdparty=new Societe($db);
$specimenthirdparty->initAsSpecimen();
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
print '<td align="center">'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir)
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -445,7 +445,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -39,7 +39,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='supplier_payment';
@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
print '</td>';

View File

@ -38,7 +38,7 @@ if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$scandir = GETPOST('scan_dir','alpha');
$type='supplier_proposal';
$error=0;
@ -423,7 +423,7 @@ foreach ($dirmodels as $reldir)
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
@ -435,7 +435,7 @@ foreach ($dirmodels as $reldir)
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';

View File

@ -247,6 +247,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
$db->begin();
$website=new Website($db);
$rowid=GETPOST('rowid','int');
$website->fetch($rowid);
@ -281,14 +283,41 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
if ($newname != $website->ref)
{
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
@rename($srcfile, $destfile);
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
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$');
foreach ($listofilestochange as $key => $value)
{
dolReplaceInFile($value['fullname'], $arrayreplacement);
}
}
}
}
else
{
setEventMessages($db->error(), null, 'errors');
$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

View File

@ -260,10 +260,6 @@ p.titre {
padding: 0;
}
.resultats_dhtml {
width: 400px;
position: absolute;
}
/* --------------------- Combo lists ------------------- */
.select_design {

View File

@ -105,7 +105,7 @@ print '<td>';
$disabled=0;
$langs->load("companies");
if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',!$disabled,$disabled,1);
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):$conf->global->CASHDESK_ID_THIRDPARTY, 'socid', 's.client in (1,3)', !$disabled, 0, 0);
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";

View File

@ -51,26 +51,14 @@ function file(fichier) {
}
// Affichage des donnees aTexte dans le bloc identifie par aId
function afficheDonnees(aId, aTexte) {
document.getElementById(aId).innerHTML = aTexte;
}
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode, iLimit) {
if (aCode != '' && aCode.length >= iLimit) {
if (texte = file('facturation_dhtml.php?code='+escape(aCode))) {
afficheDonnees (aCible, texte);
document.getElementById(aCible).innerHTML = texte;
} else
afficheDonnees (aCible, '');
document.getElementById(aCible).innerHTML = '';
}
}

View File

@ -42,11 +42,10 @@ $langs->load("cashdesk");
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr>
<!-- Affichage de la reference et de la designation -->
<!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');"
onkeyup="javascript: verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onfocus="javascript: this.select(); verifResultat('resultats_dhtml', this.value, <?php echo (isset($conf->global->BARCODE_USE_SEARCH_TO_SELECT) ? (int) $conf->global->BARCODE_USE_SEARCH_TO_SELECT : 1) ?>);"
onBlur="javascript: document.getElementById('resultats_dhtml').innerHTML = '';"/>
onfocus="javascript: this.select();" />
</td>
<td class="select_design maxwidthonsmartphone">
<?php /*

View File

@ -62,14 +62,15 @@ class Categorie extends CommonObject
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
*/
private $MAP_ID = array(
'product' => 0,
'supplier' => 1,
'customer' => 2,
'member' => 3,
'contact' => 4,
'account' => 5,
'project' => 6,
'user' => 7,
'product' => 0,
'supplier' => 1,
'customer' => 2,
'member' => 3,
'contact' => 4,
'bank_account' => 5,
'project' => 6,
'user' => 7,
'bank_line' => 8,
);
public static $MAP_ID_TO_CODE = array(
0 => 'product',
@ -77,9 +78,10 @@ class Categorie extends CommonObject
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'account',
5 => 'bank_account',
6 => 'project',
7 => 'user',
8 => 'bank_line',
);
/**
@ -94,7 +96,8 @@ class Categorie extends CommonObject
'member' => 'member',
'contact' => 'socpeople',
'user' => 'user',
'account' => 'account',
'account' => 'account', // old for bank_account
'bank_account' => 'account',
'project' => 'project',
);
/**
@ -109,7 +112,8 @@ class Categorie extends CommonObject
'member' => 'member',
'contact' => 'contact',
'user' => 'user',
'account' => 'account',
'account' => 'account', // old for bank_account
'bank_account'=> 'account',
'project' => 'project',
);
/**
@ -124,7 +128,8 @@ class Categorie extends CommonObject
'member' => 'Adherent',
'contact' => 'Contact',
'user' => 'User',
'account' => 'Account',
'account' => 'Account', // old for bank account
'bank_account' => 'Account',
'project' => 'Project',
);
/**
@ -947,8 +952,8 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
*/
@ -1340,11 +1345,11 @@ class Categorie extends CommonObject
* Return list of categories (object instances or labels) linked to element of id $id and type $type
* Should be named getListOfCategForObject
*
* @param int $id Id of element
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
* @return mixed Array of category objects or < 0 if KO
* @param int $id Id of element
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
* @return mixed Array of category objects or < 0 if KO
*/
function containing($id, $type, $mode='object')
{
@ -1352,7 +1357,7 @@ class Categorie extends CommonObject
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
if ($type === Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
{
// Load bank groups
$sql = "SELECT c.label, c.rowid";

View File

@ -54,7 +54,7 @@ elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCat
elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; }
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }

View File

@ -577,6 +577,11 @@ if ($action == 'mupdate')
}
// Actions to delete doc
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
$permissioncreate = ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete));
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
/*
* View
@ -709,7 +714,7 @@ 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" size="50" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
}
// Assigned to
@ -965,7 +970,7 @@ if ($id > 0)
}
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="minwidth100" value="'.$object->label.'"></td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
@ -1049,7 +1054,7 @@ if ($id > 0)
// Location
if (empty($conf->global->AGENDA_DISABLE_LOCATION))
{
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$object->location.'"></td></tr>';
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" class="minwidth100" value="'.$object->location.'"></td></tr>';
}
// Assigned to
@ -1212,7 +1217,6 @@ if ($id > 0)
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
$linkback.=$out;
$morehtmlref='<div class="refidno">';
// Thirdparty
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
@ -1477,7 +1481,7 @@ if ($id > 0)
*/
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->agenda->myactions->create;
$delallowed=$user->rights->agenda->myactions->delete;

View File

@ -936,7 +936,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo");
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&amp;mainmenu=agenda';
if ($user->rights->agenda->allactions->read) $response->url.='&amp;filtert=-1';
$response->img = img_object('',"action");
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql))
@ -1509,9 +1509,19 @@ class ActionComm extends CommonObject
{
global $conf, $langs;
$this->output = '';
$this->error='';
if (empty($conf->global->AGENDA_REMINDER_EMAIL))
{
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
return 0;
}
dol_syslog(__METHOD__, LOG_DEBUG);
return 0;
}

View File

@ -206,7 +206,7 @@ if ($id > 0 && empty($object->id))
{
// Load data of third party
$res=$object->fetch($id);
if ($object->id <= 0) dol_print_error($db,$object->error);
if ($object->id <= 0) dol_print_error($db,$object->error,$object->errors);
}
$title=$langs->trans("CustomerCard");
@ -608,7 +608,7 @@ if ($id > 0)
if(empty($reshook)){
$boxstat.= $hookmanager->resPrint;
}
$boxstat.='</td></tr>';
$boxstat.='</table>';
$boxstat.='</div>';

View File

@ -61,7 +61,7 @@ $object->substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation
$object->substitutionarrayfortest=array(
'__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail',
//'__EMAIL__' => 'TESTEMail', // Done into "send" action
'__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname',
'__MAILTOEMAIL__' => 'TESTMailtoEmail',
@ -409,6 +409,8 @@ if (empty($reshook))
$msgishtml=-1; // Inconnu par defaut
if (preg_match('/[\s\t]*<html>/i',$object->body)) $msgishtml=1;
$object->substitutionarrayfortest['__EMAIL__'] = $object->sendto; // other are set at begin of page
// Pratique les substitutions sur le sujet et message
$tmpsujet=make_substitutions($object->sujet,$object->substitutionarrayfortest);
$tmpbody=make_substitutions($object->body,$object->substitutionarrayfortest);
@ -461,7 +463,7 @@ if (empty($reshook))
$object->email_errorsto = trim($_POST["errorsto"]);
$object->titre = trim($_POST["titre"]);
$object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]);
$object->body = trim($_POST["bodyemail"]);
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
@ -558,7 +560,7 @@ if (empty($reshook))
$mesgs = array();
$object->sujet = trim($_POST["sujet"]);
$object->body = trim($_POST["body"]);
$object->body = trim($_POST["bodyemail"]);
$object->bgcolor = trim($_POST["bgcolor"]);
$object->bgimage = trim($_POST["bgimage"]);
@ -684,7 +686,13 @@ $form = new Form($db);
$htmlother = new FormOther($db);
$help_url='EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing';
llxHeader('',$langs->trans("Mailing"),$help_url);
llxHeader('', $langs->trans("Mailing"), $help_url, '', 0, 0,
array(
'/includes/ace/ace.js',
'/includes/ace/ext-statusbar.js',
'/includes/ace/ext-language_tools.js',
//'/includes/ace/ext-chromevox.js'
), array());
if ($action == 'create')
{
@ -738,7 +746,7 @@ if ($action == 'create')
print '<div style="padding-top: 10px">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$_POST['body'],'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor=new DolEditor('bodyemail',GETPOST('bodyemail','none'),'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create();
print '</div>';
@ -778,7 +786,7 @@ else
}
if ($action != 'edit')
if ($action != 'edit' && $action != 'edithtml')
{
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
@ -933,7 +941,9 @@ else
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
if (! empty($conf->use_javascript_ajax)) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&amp;id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
}
//print '<a class="butAction" href="card.php?action=test&amp;id='.$object->id.'">'.$langs->trans("PreviewMailing").'</a>';
@ -1093,7 +1103,7 @@ else
$readonly=1;
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
$doleditor->Create();
}
else print dol_htmlentitiesbr($object->body);
@ -1105,7 +1115,7 @@ else
else
{
/*
* Mailing en mode edition
* Mailing en mode edition (CKeditor or HTML source)
*/
dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email');
@ -1185,7 +1195,8 @@ else
// Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
dol_fiche_head();
dol_fiche_head(null, '', '', -1);
print '<table class="border" width="100%">';
@ -1201,6 +1212,7 @@ else
print '<td colspan="3">';
// List of files
$listofpaths=dol_dir_list($upload_dir,'all',0,'','','name',SORT_ASC,0);
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out.= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out.= '<script type="text/javascript" language="javascript">';
@ -1240,17 +1252,29 @@ else
// Message
print '<div style="padding-top: 10px">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',600,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create();
if ($action == 'edit')
{
// Editeur wysiwyg
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
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');
}
print '</div>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'" name="save">';
print '<input type="submit" class="button buttonforacesave" value="'.$langs->trans("Save").'" name="save">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'" name="cancel">';
print '</div>';

View File

@ -56,6 +56,7 @@ $action=GETPOST('action','aZ09');
$search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname");
$search_email=GETPOST("search_email");
$search_other=GETPOST("search_other");
$search_dest_status=GETPOST('search_dest_status');
// Search modules dirs
@ -90,8 +91,7 @@ if ($action == 'add')
{
require_once $file;
// We fill $filtersarray. Using this variable is now deprecated.
// Kept for backward compatibility.
// We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
$filtersarray=array();
if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
@ -156,11 +156,13 @@ if ($action == 'delete')
}
}
if ($_POST["button_removefilter"])
// 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
{
$search_lastname='';
$search_firstname='';
$search_email='';
$search_other='';
$search_dest_status='';
}
@ -303,12 +305,10 @@ if ($object->fetch($id) >= 0)
if ($qualified)
{
$var = !$var;
//print '<tr class="oddeven">';
// print '<div '.$bctag[$var].'>';
if ($allowaddtarget)
{
print '<form aa '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
else
@ -316,13 +316,11 @@ if ($object->fetch($id) >= 0)
print '<div '.$bctag[$var].'>';
}
//print '<td>';
print '<div class="tagtd">';
if (empty($obj->picto)) $obj->picto='generic';
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto);
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj),$obj->picto);
print ' ';
print $obj->getDesc();
//print '</td>';
print '</div>';
try {
@ -333,7 +331,6 @@ if ($object->fetch($id) >= 0)
dol_syslog($e->getMessage(), LOG_ERR);
}
//print '<td align="center">';
print '<div class="tagtd center">';
if ($nbofrecipient >= 0)
{
@ -343,10 +340,8 @@ if ($object->fetch($id) >= 0)
{
print $langs->trans("Error").' '.img_error($obj->error);
}
//print '</td>';
print '</div>';
//print '<td align="left">';
print '<div class="tagtd" align="left">';
if ($allowaddtarget)
{
@ -360,10 +355,8 @@ if ($object->fetch($id) >= 0)
if ($filter) print $filter;
else print $langs->trans("None");
}
//print '</td>';
print '</div>';
//print '<td align="right">';
print '<div class="tagtd" align="right">';
if ($allowaddtarget)
{
@ -375,19 +368,14 @@ if ($object->fetch($id) >= 0)
//print $langs->trans("MailNoChangePossible");
print "&nbsp;";
}
//print '</td>';
print '</div>';
if ($allowaddtarget) print '</form>';
else print '</div>';
//print "</tr>\n";
// print '</div>'."\n";
}
}
} // End foreach dir
//print '</table>';
print '</div>';
print '<br><br>';
@ -397,9 +385,10 @@ if ($object->fetch($id) >= 0)
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.fk_mailing=".$object->id;
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
if ($search_firstname) $sql.= natural_search("mc.firstname", $search_firstname);
if ($search_email) $sql.= natural_search("mc.email", $search_email);
if ($search_other) $sql.= natural_search("mc.other", $search_other);
if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
$sql .= $db->order($sortfield,$sortorder);
@ -423,6 +412,7 @@ if ($object->fetch($id) >= 0)
if ($search_lastname) $param.= "&amp;search_lastname=".urlencode($search_lastname);
if ($search_firstname) $param.= "&amp;search_firstname=".urlencode($search_firstname);
if ($search_email) $param.= "&amp;search_email=".urlencode($search_email);
if ($search_other) $param.= "&amp;search_other=".urlencode($search_other);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -469,7 +459,7 @@ if ($object->fetch($id) >= 0)
print '</td>';
// Other
print '<td class="liste_titre">';
print '&nbsp';
print '<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).'">';
print '</td>';
// Source
print '<td class="liste_titre">';

View File

@ -1376,6 +1376,7 @@ if ($action == 'create')
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print '</td>';
}
print '</tr>' . "\n";

View File

@ -45,7 +45,6 @@ $ref = GETPOST('ref','alpha');
$socid='';
if (! empty($user->societe_id))
{
$action='';
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'propal', $id);

View File

@ -1467,7 +1467,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
print '</tr>';
// Client
// Thirdparty
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
if ($socid > 0) {
@ -1491,6 +1491,7 @@ if ($action == 'create' && $user->rights->commande->creer)
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
print '</td>';
}
print '</tr>' . "\n";

View File

@ -44,7 +44,6 @@ $ref = GETPOST('ref');
// Security check
if ($user->societe_id)
{
$action='';
$socid = $user->societe_id;
}
$result=restrictedArea($user,'commande',$id,'');

View File

@ -560,11 +560,7 @@ else
$_GET["id"]=$object->id;
}
/*
* Affichage onglets
*/
// Onglets
// Show tabs
$head=bank_prepare_head($object);
dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
@ -592,18 +588,6 @@ else
print '<table class="border" width="100%">';
// Ref
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';*/
// Label
/*print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
print '<td>'.$object->label.'</td></tr>';*/
// Type
print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
print '<td>'.$object->type_lib[$object->type].'</td></tr>';
@ -616,26 +600,6 @@ else
print $langs->trans("Currency".$selectedcode);
print '</td></tr>';
// Status
/*print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td>'.$object->getLibStatut(4).'</td></tr>';*/
// Country
/*
print '<tr><td>'.$langs->trans("BankAccountCountry").'</td><td>';
if ($object->country_id > 0)
{
$img=picto_from_langcode($object->country_code);
print $img?$img.' ':'';
print getCountry($object->getCountryCode(),0,$db);
}
print '</td></tr>';
// State
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($object->state_id > 0) print getState($object->state_id);
print '</td></tr>';*/
// Conciliate
print '<tr><td>'.$langs->trans("Conciliable").'</td>';
print '<td>';
@ -694,7 +658,7 @@ else
// Categories
if ($conf->categorie->enabled) {
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'account',1);
print $form->showCategories($object->id,'bank_account',1);
print "</td></tr>";
}

View File

@ -30,8 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
*/
class PaymentVarious extends CommonObject
{
//public $element='payment_various'; //!< Id that identify managed objects
//public $table_element='payment_various'; //!< Name of table without prefix where object is stored
public $element='variouspayment'; //!< Id that identify managed objects
public $table_element='payment_various'; //!< Name of table without prefix where object is stored
public $picto = 'bill';
var $tms;
var $datep;
@ -42,6 +43,7 @@ class PaymentVarious extends CommonObject
var $num_payment;
var $label;
var $accountancy_code;
var $fk_project;
var $fk_bank;
var $fk_user_author;
var $fk_user_modif;
@ -96,6 +98,7 @@ class PaymentVarious extends CommonObject
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.",";
$sql.= " fk_user_modif=".$this->fk_user_modif;
@ -154,6 +157,7 @@ class PaymentVarious extends CommonObject
$sql.= " v.label,";
$sql.= " v.note,";
$sql.= " v.accountancy_code,";
$sql.= " v.fk_projet as fk_project,";
$sql.= " v.fk_bank,";
$sql.= " v.fk_user_author,";
$sql.= " v.fk_user_modif,";
@ -185,6 +189,7 @@ class PaymentVarious extends CommonObject
$this->label = $obj->label;
$this->note = $obj->note;
$this->accountancy_code = $obj->accountancy_code;
$this->fk_project = $obj->fk_project;
$this->fk_bank = $obj->fk_bank;
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
@ -317,6 +322,7 @@ class PaymentVarious extends CommonObject
if ($this->note) $sql.= ", note";
$sql.= ", label";
$sql.= ", accountancy_code";
$sql.= ", fk_projet";
$sql.= ", fk_user_author";
$sql.= ", datec";
$sql.= ", fk_bank";
@ -451,6 +457,63 @@ class PaymentVarious extends CommonObject
}
/**
* Retourne le libelle du statut
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function getLibStatut($mode=0)
{
return $this->LibStatut($this->statut,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Libelle
*/
function LibStatut($statut,$mode=0)
{
global $langs;
if ($mode == 0)
{
return $langs->trans($this->statuts[$statut]);
}
if ($mode == 1)
{
return $langs->trans($this->statuts_short[$statut]);
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]);
}
if ($mode == 3)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
if ($mode == 4)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]);
}
if ($mode == 5)
{
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
}
}
/**
* Send name clicable (with possibly the picto)
*

View File

@ -3,7 +3,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -62,9 +62,7 @@ $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '',
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
if ($page == -1) {
$page = 0;
}
if (empty($page) || $page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -122,21 +120,21 @@ if ($id > 0 || !empty($ref)) {
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
print "</table>\n";
print '</div>';
dol_fiche_end();
$modulepart = 'bank';
$permission = $user->rights->banque->modifier;
$permtoedit = $user->rights->banque->modifier;

View File

@ -492,21 +492,36 @@ foreach ($accounts as $key=>$type)
// Account number
if (! empty($arrayfields['b.account_number']['checked']))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$acc->account_number);
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$acc->account_number);
print $accountingaccount->getNomUrl(0,1,1,'',1);
}
else
{
print $acc->account_number;
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accountancy journal
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($acc->fk_accountancy_journal);
print '<td>'.$accountingjournal->getNomUrl(0,1,1,'',1).'</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($acc->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0,1,1,'',1);
}
else
{
print '';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}

View File

@ -55,7 +55,7 @@ if ($action == 'add_confirm')
if (! $label)
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), null, 'errors');
}
if (! $amount)

View File

@ -29,6 +29,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
@ -44,6 +49,7 @@ $sens=GETPOST("sens","int");
$amount=GETPOST("amount");
$paymenttype=GETPOST("paymenttype");
$accountancy_code=GETPOST("accountancy_code","int");
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
$socid = GETPOST("socid","int");
@ -67,6 +73,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Link to a project
if ($action == 'classin' && $user->rights->banque->modifier)
{
$object->fetch($id);
$object->setProject(GETPOST('projectid'));
}
if ($cancel)
{
if ($action != 'addlink')
@ -98,6 +111,7 @@ if (empty($reshook))
$object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : "";
$object->sens=GETPOST('sens');
$object->fk_project= GETPOST('fk_project');
if (empty($datep) || empty($datev))
{
@ -205,6 +219,7 @@ llxHeader("",$langs->trans("VariousPayment"));
$form = new Form($db);
if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db);
if ($id)
{
@ -306,6 +321,21 @@ if ($action == 'create')
print '</td></tr>';
}
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Associated project
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -333,19 +363,52 @@ if ($action == 'create')
if ($id)
{
$head=various_payment_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), 0, 'payment');
print '<table class="border" width="100%">';
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, 'payment');
$morehtmlref='<div class="refidno">';
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.=$langs->trans('Project') . ' ';
if ($user->rights->tax->charges->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print "<tr>";
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
@ -404,6 +467,11 @@ if ($id)
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();

View File

@ -243,7 +243,7 @@ if ($result)
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1);
}
$accountstatic->label=$obj->blabel;

View File

@ -0,0 +1,121 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2017 John BOTELLA <contact@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture/admin/facture_cust_extrafields.php
* \ingroup invoice
* \brief Page to setup extra fields of customer invoice
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("admin");
$langs->load("bills");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='facture_rec'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
$head = invoice_admin_prepare_head();
dol_fiche_head($head, 'attributesrec', $langs->trans("Invoices"), -1, 'invoice');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition of an optional field */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
$langs->load("members");
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();

View File

@ -0,0 +1,119 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/facture/admin/facture_cust_extrafields.php
* \ingroup invoice
* \brief Page to setup extra fields of customer invoice
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("admin");
$langs->load("bills");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='facturedet_rec'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
$head = invoice_admin_prepare_head();
dol_fiche_head($head, 'attributeslinesrec', $langs->trans("Invoices"), -1, 'invoice');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
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';
}
llxFooter();
$db->close();

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