Merge branch 'develop' into 6.0-api
@ -1,16 +0,0 @@
|
||||
build
|
||||
build.xml
|
||||
ChangeLog
|
||||
composer.json
|
||||
CONTRIBUTING.md
|
||||
COPYING
|
||||
COPYRIGHT
|
||||
dev
|
||||
doc
|
||||
Dockerfile
|
||||
INSTALL
|
||||
README-FR.md
|
||||
README.md
|
||||
robots.txt
|
||||
scripts
|
||||
test
|
||||
@ -53,6 +53,7 @@ jQuery Tiptip 1.3 GPL and MIT License Yes
|
||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.gnu.org/licenses/licenses.en.html
|
||||
|
||||
19
ChangeLog
@ -2,8 +2,22 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||
|
||||
For developers:
|
||||
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||
NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* The methode "cloture" on contact were renamed into "closeAll".
|
||||
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||
__PROPALREF__, ...)
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.1 compared to 6.0.* *****
|
||||
FIX: #7000 Dashboard link for late pending payment supplier invoices do not work
|
||||
FIX: #7325 Default VAT rate when editing template invoices is 0%
|
||||
FIX: #7330
|
||||
@ -43,9 +57,8 @@ FIX: View of timespent for another user
|
||||
FIX: ODT generation
|
||||
FIX: CVE-2017-9840, CVE-2017-14238, CVE-2017-14239, CVE-2017-14240, CVE-2017-14241,
|
||||
CVE-2017-14242
|
||||
|
||||
|
||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||
|
||||
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
|
||||
NEW: Add a payment module for Stripe.
|
||||
NEW: Add module "Product variant" (like red, blue for the product shoes)
|
||||
|
||||
31
README.md
@ -2,9 +2,9 @@
|
||||
|
||||
 
|
||||
|
||||
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
|
||||
|
||||
3
build/docker/.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
Dockerfile
|
||||
README.md
|
||||
docker-compose.yml
|
||||
@ -1,4 +1,7 @@
|
||||
FROM php:5.6-apache
|
||||
FROM php:7.0-apache
|
||||
|
||||
ENV HOST_USER_ID 33
|
||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
@ -9,11 +12,9 @@ RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
|
||||
&& docker-php-ext-install mysqli \
|
||||
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
|
||||
|
||||
COPY htdocs/ /var/www/html/
|
||||
|
||||
RUN chown -hR www-data:www-data /var/www/html
|
||||
|
||||
VOLUME /var/www/html/conf
|
||||
VOLUME /var/www/html/documents
|
||||
COPY docker-run.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-run.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["docker-run.sh"]
|
||||
25
build/docker/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# How to use it ?
|
||||
|
||||
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
|
||||
|
||||
Before build/run, define the variable HOST_USER_ID as following:
|
||||
|
||||
export HOST_USER_ID=$(id -u)
|
||||
|
||||
Go in repository build/docker :
|
||||
|
||||
cd build/docker
|
||||
|
||||
And then, you can run :
|
||||
|
||||
docker-compose up
|
||||
|
||||
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
|
||||
|
||||
The URL to go to the Dolibarr is :
|
||||
|
||||
http://0.0.0.0
|
||||
|
||||
The URL to go to PhpMyAdmin is (login/password is root/root) :
|
||||
|
||||
http://0.0.0.0:8080
|
||||
25
build/docker/docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: dolibarr
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
environment:
|
||||
PMA_HOST: mariadb
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "8080:80"
|
||||
|
||||
web:
|
||||
build: .
|
||||
environment:
|
||||
HOST_USER_ID: $HOST_USER_ID
|
||||
volumes:
|
||||
- ../../htdocs:/var/www/html
|
||||
links:
|
||||
- mariadb
|
||||
ports:
|
||||
- "80:80"
|
||||
15
build/docker/docker-run.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
usermod -u $HOST_USER_ID www-data
|
||||
groupmod -g $HOST_USER_ID www-data
|
||||
|
||||
chown -hR www-data:www-data /var/www
|
||||
|
||||
if [ ! -f /usr/local/etc/php/php.ini ]; then
|
||||
cat <<EOF > /usr/local/etc/php/php.ini
|
||||
date.timezone = $PHP_INI_DATE_TIMEZONE
|
||||
display_errors = On
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec apache2-foreground
|
||||
@ -60,14 +60,14 @@ $db->begin();
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||
|
||||
// Create invoice object
|
||||
// Create user object
|
||||
$obj = new User($db);
|
||||
//$obj->initAsSpecimen();
|
||||
|
||||
$obj->login = 'ABCDEF';
|
||||
$obj->nom = 'ABCDEF';
|
||||
|
||||
// Create invoice
|
||||
// Create user
|
||||
$idobject=$obj->create($user);
|
||||
if ($idobject > 0)
|
||||
{
|
||||
|
||||
@ -67,7 +67,7 @@ $db->begin();
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
|
||||
// Create invoice object
|
||||
// Create contract object
|
||||
$obj = new Contrat($db);
|
||||
$obj->socid=$argv[1];
|
||||
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot5_1920x1080_a.jpg
Normal file
|
After Width: | Height: | Size: 223 KiB |
BIN
doc/images/dolibarr_screenshot5_1920x1080_b.jpg
Normal file
|
After Width: | Height: | Size: 124 KiB |
@ -37,7 +37,7 @@ $langs->load("salaries");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
|
||||
@ -53,12 +53,10 @@ if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'sortorder');
|
||||
$page = GETPOST("page", 'int');
|
||||
if ($page == - 1) {
|
||||
$page = 0;
|
||||
}
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -69,8 +67,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)
|
||||
);
|
||||
|
||||
@ -84,8 +82,8 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accounting
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -94,9 +92,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 +104,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 +118,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 +177,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 +188,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 +208,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 +226,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 +258,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 +273,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 +309,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 +370,11 @@ if ($resql)
|
||||
}
|
||||
print '</td>' . "\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
@ -289,7 +289,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
@ -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
|
||||
@ -739,15 +740,6 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
||||
print implode(', ', $tmp);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$colspan=count($fieldlist)+3;
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
@ -1139,6 +1131,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@ -37,10 +37,10 @@ $langs->load("accountancy");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action','aZ09');
|
||||
$backtopage = GETPOST('backtopage');
|
||||
$backtopage = GETPOST('backtopage','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
|
||||
// Security check
|
||||
|
||||
@ -52,7 +52,7 @@ $object = new AccountingAccount($db);
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel'))
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
@ -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');
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ $langs->load("accountancy");
|
||||
$mesg = '';
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$action = GETPOST('action','aZ09');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||
@ -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>';
|
||||
|
||||
@ -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')
|
||||
@ -207,20 +185,13 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$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> </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 ' ';
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -37,10 +37,10 @@ $langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
@ -53,13 +53,6 @@ $main_option = array (
|
||||
$model_option = array (
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE'
|
||||
/*
|
||||
'ACCOUNTING_EXPORT_PIECE',
|
||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
'ACCOUNTING_EXPORT_LABEL',
|
||||
'ACCOUNTING_EXPORT_AMOUNT',
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
*/
|
||||
);
|
||||
|
||||
/*
|
||||
@ -121,17 +114,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
|
||||
$head = admin_accounting_prepare_head();
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron');
|
||||
|
||||
$var = true;
|
||||
|
||||
/*
|
||||
@ -245,8 +234,6 @@ if ($num2) {
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page to show a fiscal year
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
||||
|
||||
@ -37,10 +37,9 @@ $langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("salaries");
|
||||
|
||||
// Security check
|
||||
if (empty($user->admin))
|
||||
// Security access
|
||||
if (empty($user->rights->accounting->chartofaccount))
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
@ -160,18 +159,13 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
|
||||
$head = admin_accounting_prepare_head($accounting);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron');
|
||||
|
||||
|
||||
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -287,18 +281,11 @@ foreach ($list as $key)
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>';
|
||||
|
||||
print '<br>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -174,7 +174,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -489,7 +490,7 @@ if ($id)
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
|
||||
print '<td colspan="4" align="right">';
|
||||
@ -594,7 +595,7 @@ if ($id)
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
// Show fields
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td align="center" colspan="4">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
@ -691,6 +692,7 @@ if ($id)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@ -711,7 +713,7 @@ $db->close();
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
function fieldListJournal($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $form, $mysoc;
|
||||
|
||||
@ -90,8 +90,8 @@ $arrayfields=array();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -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">
|
||||
|
||||
@ -28,7 +28,9 @@ require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
|
||||
@ -51,9 +53,8 @@ if ($search_accountancy_code_end == - 1) {
|
||||
$search_accountancy_code_end = '';
|
||||
}
|
||||
|
||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
|
||||
$action = 'export_csv';
|
||||
}
|
||||
if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
|
||||
@ -66,8 +67,18 @@ $formother = new FormOther($db);
|
||||
$form = new Form($db);
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
@ -136,7 +147,7 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
|
||||
else {
|
||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
||||
$title_page = $langs->trans("AccountBalance");
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
@ -156,7 +167,7 @@ else {
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -199,7 +210,7 @@ else {
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -269,4 +280,4 @@ else {
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -108,8 +108,8 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
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
|
||||
{
|
||||
@ -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>';
|
||||
|
||||
|
||||
@ -209,7 +209,7 @@ print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"]
|
||||
|
||||
$viewflat = ' <a class="nohover" href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/list.php">' . $langs->trans("ViewFlatList") . '</a>';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'',$limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords,'title_accountancy',0,$viewflat,'', $limit);
|
||||
|
||||
// Reverse sort order
|
||||
if ( preg_match('/^asc/i', $sortorder) )
|
||||
@ -315,7 +315,7 @@ while ($i < min($num, $limit))
|
||||
|
||||
// Affiche un lien vers la facture client/fournisseur
|
||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||
|
||||
|
||||
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Accounting Expert
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
|
||||
/**
|
||||
* \file accounting/bookkeeping/thirdparty_lettrage.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Tab to setup lettering
|
||||
*/
|
||||
|
||||
// Dolibarr environment
|
||||
|
||||
@ -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 = '".$this->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
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @return array Array of groups
|
||||
*/
|
||||
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,12 +424,12 @@ 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 ++;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
@ -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 $predefinedgroupwhere 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 ++;
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ class AccountancySystem
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')";
|
||||
|
||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -47,7 +47,7 @@ class AccountingAccount extends CommonObject
|
||||
var $fk_user_modif;
|
||||
var $active; // duplicate with status
|
||||
var $status;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -56,7 +56,7 @@ class AccountingAccount extends CommonObject
|
||||
function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
@ -67,7 +67,7 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
|
||||
global $conf;
|
||||
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql .= ", ca.label as category_label";
|
||||
@ -87,7 +87,7 @@ class AccountingAccount extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
|
||||
if ($obj) {
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
@ -105,7 +105,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->active = $obj->active;
|
||||
$this->status = $obj->active;
|
||||
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
return 0;
|
||||
@ -117,7 +117,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
return - 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert new accounting account in chart of accounts
|
||||
*
|
||||
@ -129,7 +129,7 @@ class AccountingAccount extends CommonObject
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_pcg_version))
|
||||
$this->fk_pcg_version = trim($this->fk_pcg_version);
|
||||
@ -149,7 +149,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_author = trim($this->fk_user_author);
|
||||
if (isset($this->active))
|
||||
$this->active = trim($this->active);
|
||||
|
||||
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
{
|
||||
$this->pcg_type = 'XXXXXX';
|
||||
@ -160,7 +160,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
|
||||
$sql .= "datec";
|
||||
@ -179,31 +179,31 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", " . $conf->entity;
|
||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
|
||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
|
||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||
$sql .= ", " . $user->id;
|
||||
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
|
||||
$sql .= ")";
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account");
|
||||
|
||||
|
||||
// if (! $notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
|
||||
// // Call triggers
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
// $interface=new Interfaces($this->db);
|
||||
@ -212,7 +212,7 @@ class AccountingAccount extends CommonObject
|
||||
// // End call triggers
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ( $this->errors as $errmsg ) {
|
||||
@ -226,14 +226,14 @@ class AccountingAccount extends CommonObject
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update record
|
||||
*
|
||||
* @param User $user Use making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user)
|
||||
function update($user)
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||
@ -244,9 +244,9 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
$this->pcg_subtype = 'XXXXXX';
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
|
||||
$sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null");
|
||||
@ -258,7 +258,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = " . $this->active;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -270,7 +270,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check usage of accounting code
|
||||
*
|
||||
@ -278,16 +278,16 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function checkUsage() {
|
||||
global $langs;
|
||||
|
||||
|
||||
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
|
||||
$sql .= "UNION";
|
||||
$sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
@ -301,7 +301,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
@ -311,18 +311,18 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function delete($user, $notrigger = 0) {
|
||||
$error = 0;
|
||||
|
||||
|
||||
$result = $this->checkUsage();
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
// if (! $error) {
|
||||
// if (! $notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
|
||||
// // Call triggers
|
||||
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
// $interface=new Interfaces($this->db);
|
||||
@ -331,11 +331,11 @@ class AccountingAccount extends CommonObject
|
||||
// // End call triggers
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account";
|
||||
$sql .= " WHERE rowid=" . $this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::delete sql=" . $sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
@ -343,7 +343,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ( $this->errors as $errmsg ) {
|
||||
@ -360,7 +360,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
@ -375,7 +375,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
@ -412,7 +412,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
$linkstart = '';
|
||||
$linkclose = '';
|
||||
$linkend = '';
|
||||
$linkend = '';
|
||||
}
|
||||
|
||||
$label_link = length_accountg($this->account_number);
|
||||
@ -423,7 +423,7 @@ class AccountingAccount extends CommonObject
|
||||
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
@ -434,10 +434,10 @@ class AccountingAccount extends CommonObject
|
||||
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
|
||||
$sql .= ' WHERE a.rowid = ' . $id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . '::info sql=' . $sql);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -460,7 +460,7 @@ class AccountingAccount extends CommonObject
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account desactivate
|
||||
*
|
||||
@ -469,17 +469,17 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function account_desactivate($id) {
|
||||
$result = $this->checkUsage();
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '0'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -492,7 +492,7 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Account activate
|
||||
*
|
||||
@ -501,11 +501,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
function account_activate($id) {
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '1'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
|
||||
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -517,8 +517,8 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||
*
|
||||
@ -529,7 +529,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -541,7 +541,7 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('users');
|
||||
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
|
||||
@ -71,6 +71,7 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
*/
|
||||
public $doc_date;
|
||||
public $date_lim_reglement;
|
||||
public $doc_type;
|
||||
public $doc_ref;
|
||||
public $fk_doc;
|
||||
@ -255,6 +256,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
|
||||
$sql .= "doc_date";
|
||||
$sql .= ", date_lim_reglement";
|
||||
$sql .= ", doc_type";
|
||||
$sql .= ", doc_ref";
|
||||
$sql .= ", fk_doc";
|
||||
@ -277,6 +279,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ', entity';
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||
$sql .= ",'" . $this->db->idate($this->date_lim_reglement) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||
$sql .= "," . $this->fk_doc;
|
||||
@ -444,6 +447,7 @@ class BookKeeping extends CommonObject
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
||||
$sql .= 'doc_date,';
|
||||
$sql .= 'date_lim_reglement,';
|
||||
$sql .= 'doc_type,';
|
||||
$sql .= 'doc_ref,';
|
||||
$sql .= 'fk_doc,';
|
||||
@ -466,6 +470,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= 'entity';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
|
||||
@ -540,6 +545,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
$sql .= " t.fk_doc,";
|
||||
@ -577,6 +583,7 @@ class BookKeeping extends CommonObject
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||
$this->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$this->doc_type = $obj->doc_type;
|
||||
$this->doc_ref = $obj->doc_ref;
|
||||
$this->fk_doc = $obj->fk_doc;
|
||||
@ -1217,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') . ")";
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
|
||||
/**
|
||||
* \file accountancy/class/bookkeeping.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Fichier de la classe des comptes comptable
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class for lettering
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT."/accountancy/class/bookkeeping.class.php";
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card customer ventilation
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -47,11 +47,11 @@ if ($user->societe_id > 0)
|
||||
if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
if ($codeventil < 0) $codeventil = 0;
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer journalization page
|
||||
* \brief Home customer journalization page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -108,29 +108,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -144,7 +121,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -169,13 +146,29 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
||||
|
||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always or into the repair.php script.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
|
||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
@ -205,6 +198,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>';
|
||||
@ -266,13 +260,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>';
|
||||
@ -335,7 +330,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 ?
|
||||
@ -346,6 +341,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 ++) {
|
||||
@ -387,10 +383,12 @@ 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 ++) {
|
||||
@ -433,6 +431,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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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">
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -95,8 +101,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
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
|
||||
@ -109,6 +115,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -174,6 +182,7 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
@ -216,6 +225,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -246,6 +268,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -280,7 +311,11 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card expense report ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
@ -56,7 +56,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
|
||||
@ -104,29 +104,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -168,13 +145,25 @@ print $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always or into the repair.php script.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
|
||||
|
||||
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
@ -186,6 +175,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>';
|
||||
@ -243,7 +233,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -251,6 +241,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>';
|
||||
@ -308,7 +299,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@ -320,6 +311,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 ++) {
|
||||
@ -358,6 +350,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>';
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -58,6 +60,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -91,8 +97,8 @@ $accounting = new AccountingAccount($db);
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
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
|
||||
@ -103,14 +109,16 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Skeleton';
|
||||
$objectlabel='Skeleton';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
$objectclass='ExpenseReport';
|
||||
$objectlabel='ExpenseReport';
|
||||
$permtoread = $user->rights->expensereport->read;
|
||||
$permtodelete = $user->rights->expensereport->delete;
|
||||
$uploaddir = $conf->expensereport->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'ventil') {
|
||||
@ -169,6 +177,7 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
|
||||
@ -203,6 +212,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -228,6 +250,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_expensereport) $param.='&search_expensereport='.urlencode($search_expensereport);
|
||||
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -263,7 +294,11 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
@ -313,6 +348,7 @@ if ($result) {
|
||||
// Ref Expense report
|
||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Date
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||
|
||||
// Fees label
|
||||
|
||||
@ -72,13 +72,13 @@ print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
@ -87,15 +87,20 @@ 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("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||
print "<br>\n";
|
||||
if (! empty($conf->tax->enabled))
|
||||
{
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>';
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||
print "<br>\n";
|
||||
@ -111,31 +116,29 @@ if (! empty($conf->tax->enabled))
|
||||
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
/*
|
||||
if (! empty($conf->loan->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDonationAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}*/
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
||||
print "<br>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
@ -147,15 +150,15 @@ $step = 0;
|
||||
$langs->loadLangs(array('bills', 'trips'));
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<?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>
|
||||
@ -70,6 +68,7 @@ $in_bookkeeping = GETPOST('in_bookkeeping','aZ09');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
// Security check
|
||||
@ -752,7 +751,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>';
|
||||
|
||||
@ -772,7 +771,7 @@ if (empty($action) || $action == 'view') {
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
print img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
||||
}
|
||||
}
|
||||
@ -783,14 +782,14 @@ if (empty($action) || $action == 'view') {
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||
|| 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 '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
|
||||
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
@ -798,15 +797,15 @@ if (empty($action) || $action == 'view') {
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
console.log("Set value into form and submit");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
console.log("Set value into form and submit");
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
@ -816,6 +815,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>";
|
||||
@ -977,6 +977,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
@ -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"));
|
||||
@ -510,19 +510,20 @@ 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 '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||
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') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
@ -543,6 +544,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 +670,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -85,7 +85,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
@ -155,6 +155,7 @@ if ($result) {
|
||||
}
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
|
||||
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
|
||||
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
|
||||
@ -222,6 +223,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
@ -269,6 +271,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
@ -322,6 +325,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'supplier_invoice';
|
||||
@ -510,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");
|
||||
@ -528,29 +532,30 @@ 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') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
@ -560,6 +565,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>";
|
||||
@ -688,6 +694,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
|
||||
$idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
@ -178,6 +178,7 @@ if ($result) {
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
|
||||
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
$tabfac[$obj->rowid]["type"] = $obj->type;
|
||||
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
|
||||
@ -240,6 +241,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
@ -287,6 +289,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
@ -340,6 +343,7 @@ if ($action == 'writebookkeeping') {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
$bookkeeping->date_create = $now;
|
||||
$bookkeeping->doc_type = 'customer_invoice';
|
||||
@ -531,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");
|
||||
@ -548,29 +552,30 @@ 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') {
|
||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||
}
|
||||
else {
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||
}
|
||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||
print '</div>';
|
||||
|
||||
// TODO Avoid using js. We can use a direct link with $param
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
function writebookkeeping() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||
$("div.fiche form input[type=\"submit\"]").click();
|
||||
$("div.fiche form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
@ -580,6 +585,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>";
|
||||
@ -704,6 +710,7 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -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 = ' <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();
|
||||
@ -22,9 +22,9 @@
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Card supplier ventilation
|
||||
* \file htdocs/accountancy/supplier/card.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Card supplier ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ $id = GETPOST('id');
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -97,14 +97,14 @@ if (! empty($id)) {
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
|
||||
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num_lines) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
@ -105,29 +105,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.= ")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
@ -168,10 +145,25 @@ print $langs->trans("DescVentilSupplier") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always or into the repair.php script.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
@ -182,6 +174,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>';
|
||||
@ -239,8 +232,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
@ -248,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>';
|
||||
@ -305,7 +298,7 @@ if ($resql) {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@ -317,6 +310,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 ++) {
|
||||
@ -357,6 +351,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>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day=GETPOST("search_day","int");
|
||||
$search_month=GETPOST("search_month","int");
|
||||
$search_year=GETPOST("search_year","int");
|
||||
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -96,8 +102,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
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
|
||||
@ -110,6 +116,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
@ -176,6 +184,7 @@ if ($massaction == 'ventil') {
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
@ -218,6 +227,19 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
if ($search_month > 0)
|
||||
{
|
||||
if ($search_year > 0 && empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||
else if ($search_year > 0 && ! empty($search_day))
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||
}
|
||||
else if ($search_year > 0)
|
||||
{
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
@ -243,6 +265,15 @@ if ($result) {
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -279,7 +310,11 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
|
||||
@ -203,7 +203,7 @@ if ($conf->facture->enabled)
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
|
||||
@ -263,40 +263,6 @@ $helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_MAIL',
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
);
|
||||
|
||||
print load_fiche_titre($langs->trans("Other"),'','');
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
190
htdocs/adherents/admin/adherent_emails.php
Normal file
@ -0,0 +1,190 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/adherents/admin/adherent.php
|
||||
* \ingroup member
|
||||
* \brief Page to setup the module Foundation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("members");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
//
|
||||
if ($action == 'updateall')
|
||||
{
|
||||
$db->begin();
|
||||
$res1=$res2=$res3=$res4=$res5=$res6=0;
|
||||
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
// Use vat for invoice creation
|
||||
if ($conf->facture->enabled)
|
||||
{
|
||||
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
}
|
||||
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||
{
|
||||
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
}
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST('constname','alpha');
|
||||
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||
|
||||
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
|
||||
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||
{
|
||||
if ($constvalue) $constvalue=0;
|
||||
else $constvalue=1;
|
||||
}
|
||||
|
||||
$consttype=GETPOST('consttype','alpha');
|
||||
$constnote=GETPOST('constnote');
|
||||
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
|
||||
llxHeader('',$langs->trans("MembersSetup"),$help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
$head = member_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_MAIL',
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
);
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -43,6 +43,12 @@ if (! $user->admin) accessforbidden();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setMEMBER_ENABLE_PUBLIC')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||
@ -94,7 +100,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head($head, 'public', $langs->trans("Members"), -1, 'user');
|
||||
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
@ -135,99 +141,109 @@ if ($conf->use_javascript_ajax)
|
||||
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Allow public form
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("EnablePublicSubscriptionForm");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Force Type
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" align="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
||||
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$enabledisablehtml.='</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||
$enabledisablehtml.='</a>';
|
||||
}
|
||||
print $enabledisablehtml;
|
||||
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC)?0:1).'">';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Force Type
|
||||
$adht = new AdherentType($db);
|
||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||
print $langs->trans("ForceMemberType");
|
||||
print '</td><td width="60" align="right">';
|
||||
$listofval = array(-1 => $langs->trans("Undefined"));
|
||||
$listofval += $adht->liste_array();
|
||||
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
|
||||
print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Amount
|
||||
print '<tr class="oddeven" id="tramount"><td>';
|
||||
print $langs->trans("DefaultAmount");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(! empty($conf->global->MEMBER_NEWFORM_AMOUNT)?$conf->global->MEMBER_NEWFORM_AMOUNT:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Can edit
|
||||
print '<tr class="oddeven" id="tredit"><td>';
|
||||
print $langs->trans("CanEditAmount");
|
||||
print '</td><td align="right">';
|
||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="trpayment"><td>';
|
||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||
print '</td><td align="right">';
|
||||
$listofval=array();
|
||||
$listofval['-1']=$langs->trans('No');
|
||||
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
||||
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
||||
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
|
||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</center>';
|
||||
}
|
||||
|
||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
||||
{
|
||||
// Jump to an online payment page
|
||||
print '<tr class="oddeven" id="tremail"><td>';
|
||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||
print '</td><td align="right">';
|
||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||
if ($conf->multicompany->enabled) {
|
||||
$entity_qr='?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr='';
|
||||
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||
{
|
||||
print '<br>';
|
||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||
if ($conf->multicompany->enabled) {
|
||||
$entity_qr='?entity='.$conf->entity;
|
||||
} else {
|
||||
$entity_qr='';
|
||||
}
|
||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||
}
|
||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||
|
||||
/*
|
||||
print '<table class="border" cellspacing="0" cellpadding="3">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
|
||||
print '</table>';
|
||||
*/
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -76,6 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
*/
|
||||
function assign_values(&$action, $id)
|
||||
{
|
||||
global $limit, $offset, $sortfield, $sortorder;
|
||||
global $conf, $db, $langs, $user;
|
||||
global $form;
|
||||
|
||||
@ -114,14 +115,14 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
||||
|
||||
if ($action == 'list')
|
||||
{
|
||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
||||
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch datas list
|
||||
* Fetch datas list and save into ->list_datas
|
||||
*
|
||||
* @param int $limit Limit number of responses
|
||||
* @param int $offset Offset for first response
|
||||
|
||||
@ -121,14 +121,22 @@ $hookmanager->initHooks(array('membercard','globalcard'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) $action='';
|
||||
|
||||
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||
{
|
||||
$error=0;
|
||||
@ -230,6 +238,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->email)
|
||||
@ -242,7 +251,7 @@ if (empty($reshook))
|
||||
$langs->load("mails");
|
||||
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
|
||||
{
|
||||
@ -715,10 +724,21 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Actions when printing a doc from card
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->adherent->dir_output;
|
||||
$permissioncreate=$user->rights->adherent->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='MEMBER_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$mode='emailfrommember';
|
||||
$trackid='mem'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1344,10 +1364,10 @@ else
|
||||
}
|
||||
|
||||
// Confirm send card by mail
|
||||
if ($action == 'sendinfo')
|
||||
/*if ($action == 'sendinfo')
|
||||
{
|
||||
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
|
||||
}
|
||||
}*/
|
||||
|
||||
// Confirm terminate
|
||||
if ($action == 'resign')
|
||||
@ -1590,6 +1610,31 @@ else
|
||||
if (empty($reshook)) {
|
||||
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
|
||||
{
|
||||
// Send
|
||||
if ($object->statut == 1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendByMail') . '</a></div>';
|
||||
}
|
||||
|
||||
// Send card by email
|
||||
// TODO Remove this to replace with a template
|
||||
/*
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
if ($object->statut >= 1)
|
||||
{
|
||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}*/
|
||||
|
||||
// Modify
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
@ -1626,24 +1671,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
// Send card by email
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
if ($object->statut >= 1)
|
||||
{
|
||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}
|
||||
|
||||
// Terminate
|
||||
if ($object->statut >= 1)
|
||||
{
|
||||
@ -1720,47 +1747,65 @@ else
|
||||
}
|
||||
|
||||
|
||||
// Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents generes
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
//$filename = 'tmp_cards.php';
|
||||
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
||||
$genallowed = $user->rights->adherent->creer;
|
||||
$delallowed = $user->rights->adherent->supprimer;
|
||||
// Documents generes
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
//$filename = 'tmp_cards.php';
|
||||
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
||||
$genallowed = $user->rights->adherent->creer;
|
||||
$delallowed = $user->rights->adherent->supprimer;
|
||||
|
||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
//$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
//$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
// Link for paypal payment
|
||||
/*
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
||||
}
|
||||
*/
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
// Shon online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
// List of actions on element
|
||||
/* Already in tab Agenda/Events
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'member', $socid);
|
||||
*/
|
||||
print '</div></div></div>';
|
||||
if ($useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', 10);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='member';
|
||||
$defaulttopic='SendMemberRef';
|
||||
$diroutput = $conf->adherent->dir_output;
|
||||
$trackid = 'mem'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,6 +46,10 @@ $mesg='';
|
||||
|
||||
$adherentstatic=new Adherent($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -65,8 +69,12 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
||||
$sql.= " t.libelle as type,";
|
||||
$sql.= " c.code as country_code, c.label as country";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val)
|
||||
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||
@ -85,9 +93,27 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
|
||||
if ($objp->country == '-') $objp->country='';
|
||||
|
||||
$adherentstatic->id=$objp->rowid;
|
||||
$adherentstatic->lastname=$objp->lastname;
|
||||
$adherentstatic->firstname=$objp->firstname;
|
||||
|
||||
// format extrafiled so they can be parsed in function complete_substitutions_array
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
$adherentstatic->array_options = array();
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$tmpkey='options_'.$key;
|
||||
if (!empty($objp->$tmpkey))
|
||||
{
|
||||
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
|
||||
}
|
||||
//if (!empty($objp->$key))
|
||||
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||
}
|
||||
}
|
||||
|
||||
// List of values to scan for a replacement
|
||||
$substitutionarray = array (
|
||||
'%ID%'=>$objp->rowid,
|
||||
@ -110,7 +136,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||
);
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||
|
||||
// For business cards
|
||||
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
||||
|
||||
@ -213,51 +213,23 @@ class Adherent extends CommonObject
|
||||
|
||||
// Substitutions
|
||||
$substitutionarray=array(
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
|
||||
'__CIVILITY__'=>$this->getCivilityLabel(),
|
||||
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||
'__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
|
||||
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
||||
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
||||
'__TOWN_'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
||||
'__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
||||
'__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
||||
'__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
||||
'__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||
'__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||
'__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||
// For backward compatibility
|
||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||
'%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id,
|
||||
'%CIVILITY%'=>$this->getCivilityLabel(),
|
||||
'%FIRSTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
'%LASTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||
'%FULLNAME%'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
|
||||
'%COMPANY%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'%ADDRESS%'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
||||
'%ZIP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
||||
'%TOWN%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
||||
'%COUNTRY%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
||||
'%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
||||
'%BIRTH%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
|
||||
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||
// For backward compatibility
|
||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
'%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||
'%CP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
||||
'%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
||||
'%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
||||
'__CIVILITY__'=>$this->getCivilityLabel(),
|
||||
'__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||
'__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname,
|
||||
'__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs),
|
||||
'__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||
'__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address,
|
||||
'__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip,
|
||||
'__TOWN__'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town,
|
||||
'__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country,
|
||||
'__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email,
|
||||
'__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday,
|
||||
'__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||
'__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||
'__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||
'__PHONE__'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||
'__PHONEPRO__'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||
'__PHONEMOBILE__'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||
);
|
||||
|
||||
complete_substitutions_array($substitutionarray, $langs, $this);
|
||||
@ -325,10 +297,10 @@ class Adherent extends CommonObject
|
||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
||||
$sql.= ", null, null, '".$this->morphy."'";
|
||||
$sql.= ", '".$this->typeid."'";
|
||||
$sql.= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||
$sql.= ", ".$this->typeid;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null");
|
||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -447,17 +419,17 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql.= " civility = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
|
||||
$sql.= " civility = ".(!is_null($this->civility_id)?$this->db->escape($this->civility_id):"null");
|
||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||
$sql.= ", lastname=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||
$sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||
$sql.= ", zip=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||
$sql.= ", country=".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||
$sql.= ", state_id=".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||
$sql.= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
@ -465,7 +437,7 @@ class Adherent extends CommonObject
|
||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||
$sql.= ", public='".$this->db->escape($this->public)."'";
|
||||
$sql.= ", statut=" .$this->statut;
|
||||
$sql.= ", fk_adherent_type=".$this->typeid;
|
||||
@ -1192,7 +1164,7 @@ class Adherent extends CommonObject
|
||||
// Load other properties
|
||||
$result=$this->fetch_subscriptions();
|
||||
|
||||
return $result;
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -138,8 +138,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
@ -789,14 +789,10 @@ if ($rowid > 0)
|
||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* List of subscriptions
|
||||
*/
|
||||
@ -882,24 +878,21 @@ if ($rowid > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Link for paypal payment
|
||||
if (! empty($conf->paypal->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('membersubscription',$object->ref);
|
||||
}
|
||||
|
||||
// Link for stripe payment
|
||||
if (! empty($conf->stripe->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
||||
print showStripePaymentUrl('membersubscription',$object->ref);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Shon online payment link
|
||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||
|
||||
if ($useonlinepayment)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add new subscription form
|
||||
*/
|
||||
|
||||
@ -39,7 +39,7 @@ $errmsg='';
|
||||
$action=GETPOST("action",'alpha');
|
||||
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
||||
$typeid=GETPOST("typeid","int");
|
||||
$cancel=GETPOST('cancel');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$confirm=GETPOST('confirm');
|
||||
|
||||
if (! $user->rights->adherent->cotisation->lire)
|
||||
@ -402,21 +402,15 @@ if ($rowid && $action != 'edit')
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
|
||||
// Link for paypal payment
|
||||
/*
|
||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
||||
}
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
@ -75,8 +75,8 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
@ -165,6 +165,8 @@ if (! empty($triggers))
|
||||
if ($module == 'shipping') $module = 'expedition_bon';
|
||||
if ($module == 'member') $module = 'adherent';
|
||||
if ($module == 'project') $module = 'projet';
|
||||
if ($module == 'proposal_supplier') $module = 'supplier_proposal';
|
||||
|
||||
//print 'module='.$module.'<br>';
|
||||
if (! empty($conf->$module->enabled))
|
||||
{
|
||||
|
||||
@ -390,37 +390,6 @@ $tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->tra
|
||||
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA NOTIFICATION
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_NOTIFICATION_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
255
htdocs/admin/agenda_reminder.php
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/agenda_reminder.php
|
||||
* \ingroup agenda
|
||||
* \brief Page to setup agenda reminder options
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("other");
|
||||
$langs->load("agenda");
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$param = GETPOST('param','alpha');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
$type = 'action';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('/del_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
if ($action == 'set')
|
||||
{
|
||||
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
else if ($action == 'specimen') // For orders
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db,$commande);
|
||||
|
||||
if ($module->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($module->error, $module->errors, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'setmodel')
|
||||
{
|
||||
//print "sssd".$value;
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->ACTION_EVENT_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* View
|
||||
*/
|
||||
|
||||
$formactions=new FormActions($db);
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
llxHeader();
|
||||
|
||||
$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();
|
||||
|
||||
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
|
||||
print '<input type="hidden" name="action" value="set">';
|
||||
|
||||
print '<table class="noborder allwidth">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
// AGENDA REMINDER EMAIL
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// AGENDA REMINDER BROWSER
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
|
||||
{
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
|
||||
if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input class="button" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print "<br>";
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -21,15 +22,14 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/bank.php
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
* \ingroup bank
|
||||
* \brief Page to setup the bank module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -38,12 +38,12 @@ $langs->load("other");
|
||||
$langs->load("banks");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'bankaccount';
|
||||
|
||||
|
||||
@ -52,100 +52,109 @@ $type = 'bankaccount';
|
||||
*/
|
||||
|
||||
//Order display of bank account
|
||||
if ($action == 'setbankorder')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",GETPOST('value','alpha'),'chaine',0,'',$conf->entity) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($action == 'setbankorder') {
|
||||
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",
|
||||
GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
//Auto report last num releve on conciliate
|
||||
if ($action == 'setreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
elseif ($action == 'unsetreportlastnumreleve') {
|
||||
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0,
|
||||
'', $conf->entity) > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
if ($modele == 'sepamandate')
|
||||
{
|
||||
if ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
if ($modele == 'sepamandate') {
|
||||
$object = new CompanyBankAccount($db);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
$object = new Account($db);
|
||||
}
|
||||
$object->initAsSpecimen();
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
$file = '';
|
||||
$classname = '';
|
||||
$filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php",
|
||||
0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_" . $modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($object,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
|
||||
if ($module->write_file($object, $langs) > 0) {
|
||||
header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=bank&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
if ($action == 'set') {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity);
|
||||
}
|
||||
else if ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if ($conf->global->BANKADDON_PDF == "$value")
|
||||
dolibarr_del_const($db, 'BANKADDON_PDF', $conf->entity);
|
||||
}
|
||||
}
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
else if ($action == 'setdoc') {
|
||||
if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '',
|
||||
$conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->BANKADDON_PDF = $value;
|
||||
}
|
||||
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
@ -156,80 +165,78 @@ else if ($action == 'setdoc')
|
||||
* view
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("",$langs->trans("BankSetupModule"));
|
||||
llxHeader("", $langs->trans("BankSetupModule"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback,
|
||||
'title_setup');
|
||||
|
||||
$head = bank_admin_prepare_head(null);
|
||||
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account');
|
||||
|
||||
$var=true;
|
||||
$var = true;
|
||||
|
||||
$var=! $var;
|
||||
$var = !$var;
|
||||
|
||||
//Show bank account order
|
||||
print load_fiche_titre($langs->trans("BankOrderShow"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||
print '<td width="140">' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td>' . $langs->trans("Example") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Status") . '</td>';
|
||||
print '<td align="center" width="60"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0]=$langs->trans("BankOrderES");
|
||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
$bankorder[0][0] = $langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1] = $langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2] = 'BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0] = $langs->trans("BankOrderES");
|
||||
$bankorder[1][1] = $langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2] = 'BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$nbofbank=count($bankorder);
|
||||
while ($i < $nbofbank)
|
||||
{
|
||||
$var = !$var;
|
||||
$nbofbank = count($bankorder);
|
||||
while ($i < $nbofbank) {
|
||||
$var = !$var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$bankorder[$i][0]."</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray=explode(' ',$bankorder[$i][2]);
|
||||
foreach($tmparray as $key => $val)
|
||||
{
|
||||
if ($key > 0) print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $bankorder[$i][0] . "</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
$tmparray = explode(' ', $bankorder[$i][2]);
|
||||
foreach ($tmparray as $key => $val) {
|
||||
if ($key > 0)
|
||||
print ', ';
|
||||
print $langs->trans($val);
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"),'on');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&value='.$i.'">';
|
||||
print img_picto($langs->trans("Disabled"),'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
|
||||
print '<td align="center">';
|
||||
print img_picto($langs->trans("Activated"), 'on');
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center"><a href="' . $_SERVER['PHP_SELF'] . '?action=setbankorder&value=' . $i . '">';
|
||||
print img_picto($langs->trans("Disabled"), 'off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>' . "\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</table>' . "\n";
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
@ -257,7 +264,8 @@ if ($resql) {
|
||||
array_push($def, $array[0]);
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -273,11 +281,10 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$dir = dol_buildpath($reldir . "core/modules/bank" . $valdir);
|
||||
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
@ -286,23 +293,26 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/',
|
||||
$file)) {
|
||||
|
||||
if (file_exists($dir . '/' . $file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
|
||||
require_once $dir . '/' . $file;
|
||||
$module = new $classname($db);
|
||||
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 2)
|
||||
$modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL
|
||||
< 1)
|
||||
$modulequalified = 0;
|
||||
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
@ -312,29 +322,35 @@ foreach ($dirmodels as $reldir)
|
||||
else
|
||||
print $module->description;
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print img_picto($langs->trans("Enabled"),
|
||||
'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
|
||||
// Default
|
||||
print '<td align="center">';
|
||||
if ($conf->global->BANKADDON_PDF == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
print img_picto($langs->trans("Default"),
|
||||
'on');
|
||||
}
|
||||
else {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&scan_dir=' . $module->scandir . '&label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
|
||||
'off') . '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Info
|
||||
$htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
|
||||
$htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
@ -342,27 +358,33 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo,
|
||||
1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang,
|
||||
1, 1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print $form->textwithpicto('', $htmltooltip, 1,
|
||||
0);
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Preview
|
||||
print '<td align="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
|
||||
} else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"),
|
||||
'bill') . '</a>';
|
||||
}
|
||||
else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"),
|
||||
'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
@ -372,9 +394,51 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
//}
|
||||
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
//{
|
||||
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', '');
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>' . $langs->trans("Name") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="center" width="60">' . $langs->trans("Status") . "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print $langs->trans('AccountStatement');
|
||||
print "</td><td>\n";
|
||||
print $langs->trans('AutoReportLastAccountStatement');
|
||||
print '</td>';
|
||||
// Active
|
||||
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=unsetreportlastnumreleve">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center">' . "\n";
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"),
|
||||
'switch_off') . '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -157,7 +157,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
||||
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, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
@ -547,8 +547,8 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
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>';
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ foreach ($list as $key)
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '<br><br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -69,8 +69,8 @@ $hookmanager->initHooks(array('admindefaultvalues','globaladmin'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -248,8 +248,8 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
// Page
|
||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2');
|
||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
||||
// Field
|
||||
|
||||
@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -126,6 +126,8 @@ $tabname[30]= MAIN_DB_PREFIX."c_format_cards";
|
||||
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
|
||||
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -163,6 +165,8 @@ $tablib[30]= "DictionaryFormatCards";
|
||||
//$tablib[32]= "DictionaryAccountancyCategory";
|
||||
$tablib[33]= "DictionaryDepartment";
|
||||
$tablib[34]= "DictionaryFunction";
|
||||
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -200,6 +204,8 @@ $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmar
|
||||
//$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[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -237,6 +243,8 @@ $tabsqlsort[30]="code ASC";
|
||||
//$tabsqlsort[32]="position ASC";
|
||||
$tabsqlsort[33]="code ASC";
|
||||
$tabsqlsort[34]="code ASC";
|
||||
$tabsqlsort[35]="c.label ASC";
|
||||
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -272,8 +280,8 @@ $tabfield[29]= "code,label,percent,position";
|
||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
//$tabfield[31]= "pcg_version,label";
|
||||
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||
$tabfield[33]= "code,label";
|
||||
$tabfield[34]= "code,label";
|
||||
$tabfield[35]= "label";
|
||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -311,6 +319,8 @@ $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargi
|
||||
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||
$tabfieldvalue[33]= "code,label";
|
||||
$tabfieldvalue[34]= "code,label";
|
||||
$tabfieldvalue[35]= "label";
|
||||
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -348,6 +358,8 @@ $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmarg
|
||||
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[33]= "code,label";
|
||||
$tabfieldinsert[34]= "code,label";
|
||||
$tabfieldinsert[35]= "label";
|
||||
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -387,6 +399,8 @@ $tabrowid[30]= "";
|
||||
//$tabrowid[32]= "";
|
||||
$tabrowid[33]= "rowid";
|
||||
$tabrowid[34]= "rowid";
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid[36]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -424,6 +438,8 @@ $tabcond[30]= ! empty($conf->label->enabled);
|
||||
//$tabcond[32]= ! empty($conf->accounting->enabled);
|
||||
$tabcond[33]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -461,6 +477,8 @@ $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->tran
|
||||
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35]= array();
|
||||
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -498,6 +516,8 @@ $tabfieldcheck[30] = array();
|
||||
//$tabfieldcheck[32] = array();
|
||||
$tabfieldcheck[33] = array();
|
||||
$tabfieldcheck[34] = array();
|
||||
$tabfieldcheck[35]= array();
|
||||
$tabfieldcheck[36]= array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
|
||||
@ -642,7 +662,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
@ -990,7 +1010,7 @@ if ($id)
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Line for title
|
||||
@ -1066,6 +1086,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1157,7 +1180,7 @@ if ($id)
|
||||
print '<div class="clearboth"></div>';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Title line with search boxes
|
||||
@ -1283,6 +1306,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
|
||||
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
|
||||
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -1500,6 +1526,26 @@ if ($id)
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'fk_tva')
|
||||
{
|
||||
foreach ($form->cache_vatrates as $key => $Tab)
|
||||
{
|
||||
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow)
|
||||
{
|
||||
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
|
||||
{
|
||||
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
}
|
||||
elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
|
||||
{
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
||||
@ -1670,7 +1716,7 @@ $db->close();
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf,$langs,$db,$mysoc;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
@ -1837,6 +1883,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'fk_tva')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'fk_range')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectExpenseRanges($obj->fk_range);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$classtd=''; $class='';
|
||||
|
||||
68
htdocs/admin/dolistore/ajax/image.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
398
htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php
Normal file
@ -0,0 +1,398 @@
|
||||
<?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']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @package PrestaShopWebservice
|
||||
*/
|
||||
class PrestaShopWebserviceException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
341
htdocs/admin/dolistore/class/dolistore.class.php
Normal file
@ -0,0 +1,341 @@
|
||||
<?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 Dolistore
|
||||
*/
|
||||
class Dolistore
|
||||
{
|
||||
// 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
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$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;
|
||||
|
||||
$langtmp = explode('_', $langs->defaultlang);
|
||||
$lang = $langtmp[0];
|
||||
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||
$this->lang = $lang_array[$lang];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from remote Dolistore market place.
|
||||
* This fills ->categories
|
||||
*
|
||||
* @param array $options Options
|
||||
* @return void
|
||||
*/
|
||||
function getRemoteData($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'];
|
||||
|
||||
if ($this->end == 0) {
|
||||
$this->end = $this->per_page;
|
||||
}
|
||||
|
||||
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";
|
||||
// $opt['filter[id]'] contais list of product id that are result of search
|
||||
|
||||
// Call API to get the detail
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return tree of Dolistore categories. $this->categories must have been loaded before.
|
||||
*
|
||||
* @param int $parent Id of parent category
|
||||
* @return string
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of product formated for output
|
||||
*
|
||||
* @return string HTML output
|
||||
*/
|
||||
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_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$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_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||
}
|
||||
|
||||
// free or pay ?
|
||||
if ($product->price > 0) {
|
||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||
} else {
|
||||
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||
$download_link.= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></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';
|
||||
}
|
||||
|
||||
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
||||
|
||||
//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">'.$product->name->language[$this->lang]
|
||||
.'<br/><small>'.$version.'</small></h2>
|
||||
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$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="center">'.$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>';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
237
htdocs/admin/dolistore/css/dolistore.css
Normal file
@ -0,0 +1,237 @@
|
||||
|
||||
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;
|
||||
}
|
||||
tr.app td {
|
||||
border-bottom: 1px solid #888;
|
||||
}
|
||||
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%;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
span.details{
|
||||
font-size: 12px;
|
||||
margin-left: 10px;
|
||||
vertical-align: super;
|
||||
}
|
||||
BIN
htdocs/admin/dolistore/img/Download-128.png
Normal file
|
After Width: | Height: | Size: 761 B |
BIN
htdocs/admin/dolistore/img/NoImageAvailable.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
htdocs/admin/dolistore/img/compatible.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
htdocs/admin/dolistore/img/dolistore.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
htdocs/admin/dolistore/img/follow.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
htdocs/admin/dolistore/img/object_dolistore.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
@ -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&value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&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
|
||||
|
||||
188
htdocs/admin/expensereport_ik.php
Normal file
@ -0,0 +1,188 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Pierre-Henry Favre <phf@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 2 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/expensereport_ik.php
|
||||
* \ingroup expensereport
|
||||
* \brief Page to display expense tax ik
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
|
||||
|
||||
$langs->load('admin');
|
||||
$langs->load('other');
|
||||
$langs->load('trips');
|
||||
$langs->load('errors');
|
||||
$langs->load('dict');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$offset = GETPOST('offset','int');
|
||||
$coef = GETPOST('coef','int');
|
||||
|
||||
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
|
||||
$fk_range = GETPOST('fk_range');
|
||||
|
||||
if ($action == 'updateik')
|
||||
{
|
||||
$expIk = new ExpenseReportIk($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $expIk->fetch($id);
|
||||
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
|
||||
}
|
||||
|
||||
$expIk->setValues($_POST);
|
||||
$result = $expIk->create($user);
|
||||
|
||||
if ($result > 0) setEventMessages('SetupSaved', null, 'mesgs');
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}
|
||||
elseif ($action == 'delete') // TODO add confirm
|
||||
{
|
||||
$expIk = new ExpenseReportIk($db);
|
||||
if ($id > 0)
|
||||
{
|
||||
$result = $expIk->fetch($id);
|
||||
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
|
||||
|
||||
$expIk->delete($user);
|
||||
}
|
||||
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rangesbycateg = ExpenseReportIk::getAllRanges();
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ExpenseReportsIkSetup"),$linkback,'title_setup');
|
||||
|
||||
$head=expensereport_admin_prepare_head();
|
||||
dol_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), -1, 'trip');
|
||||
|
||||
echo $langs->trans('ExpenseReportIkDesc');
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
echo '<input type="hidden" name="id" value="'.$id.'" />';
|
||||
echo '<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.'" />';
|
||||
echo '<input type="hidden" name="fk_range" value="'.$fk_range.'" />';
|
||||
echo '<input type="hidden" name="action" value="updateik" />';
|
||||
}
|
||||
|
||||
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
|
||||
foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
|
||||
{
|
||||
$title = ($Tab['active'] == 1) ? $langs->trans($Tab['label']) : $form->textwithpicto($langs->trans($Tab['label']), $langs->trans('expenseReportCatDisabled'), 1, 'help', '', 0, 3);
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td>'.$title.'</td>';
|
||||
echo '<td>'.$langs->trans('expenseReportOffset').'</td>';
|
||||
echo '<td>'.$langs->trans('expenseReportCoef').'</td>';
|
||||
echo '<td>'.$langs->trans('expenseReportTotalForFive').'</td>';
|
||||
echo '<td> </td>';
|
||||
echo '</tr>';
|
||||
|
||||
if ($Tab['active'] == 0) continue;
|
||||
|
||||
$tranche=1;
|
||||
$var = true;
|
||||
foreach ($Tab['ranges'] as $k => $range)
|
||||
{
|
||||
if (isset($Tab['ranges'][$k+1])) $label = $langs->trans('expenseReportRangeFromTo', $range->range_ik, ($Tab['ranges'][$k+1]->range_ik-1));
|
||||
else $label = $langs->trans('expenseReportRangeMoreThan', $range->range_ik);
|
||||
|
||||
if ($range->range_active == 0) $label = $form->textwithpicto($label, $langs->trans('expenseReportRangeDisabled'), 1, 'help', '', 0, 3);
|
||||
|
||||
echo '<tr '.$bc[$var].'>';
|
||||
|
||||
// Label
|
||||
echo '<td width="20%"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
|
||||
|
||||
// Offset
|
||||
echo '<td width="20%">';
|
||||
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="offset" value="'.$range->ik->offset.'" />';
|
||||
else echo $range->ik->offset;
|
||||
echo '</td>';
|
||||
// Coef
|
||||
echo '<td width="20%">';
|
||||
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="coef" value="'.$range->ik->coef.'" />';
|
||||
else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans('expenseReportCoefUndefined'));
|
||||
echo '</td>';
|
||||
|
||||
// Total for one
|
||||
echo '<td width="30%">'.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).'</td>';
|
||||
|
||||
// Action
|
||||
echo '<td align="right">';
|
||||
if ($range->range_active == 1)
|
||||
{
|
||||
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat)
|
||||
{
|
||||
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
|
||||
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
|
||||
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
|
||||
// TODO add delete link
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
$var=!$var;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
366
htdocs/admin/expensereport_rules.php
Normal file
@ -0,0 +1,366 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
|
||||
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
|
||||
* Copyright (C) 2017 Pierre-Henry Favre <phf@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 2 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/expensereport_ik.php
|
||||
* \ingroup expensereport
|
||||
* \brief Page to display expense tax ik
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
|
||||
|
||||
$langs->load('admin');
|
||||
$langs->load('other');
|
||||
$langs->load('trips');
|
||||
$langs->load('errors');
|
||||
$langs->load('dict');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user');
|
||||
$fk_usergroup = GETPOST('fk_usergroup');
|
||||
|
||||
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||
$amount = GETPOST('amount');
|
||||
$restrictive = GETPOST('restrictive');
|
||||
|
||||
$object = new ExpenseReportRule($db);
|
||||
if (!empty($id))
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) dol_print_error('', $object->error, $object->errors);
|
||||
}
|
||||
|
||||
// TODO do action
|
||||
if ($action == 'save')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
// check parameters
|
||||
if (empty($apply_to)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
|
||||
}
|
||||
if (empty($fk_c_type_fees)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
|
||||
}
|
||||
if (empty($code_expense_rules_type)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
|
||||
}
|
||||
if (empty($dates)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
|
||||
}
|
||||
if (empty($datee)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
|
||||
}
|
||||
if (empty($amount)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
|
||||
}
|
||||
|
||||
if (empty($error))
|
||||
{
|
||||
$object->setValues($_POST);
|
||||
|
||||
if($apply_to=='U'){
|
||||
$object->fk_user=$fk_user;
|
||||
$object->fk_usergroup=0;
|
||||
$object->is_for_all=0;
|
||||
}elseif($apply_to=='G'){
|
||||
$object->fk_usergroup=$fk_usergroup;
|
||||
$object->fk_user=0;
|
||||
$object->is_for_all=0;
|
||||
}elseif($apply_to=='A'){
|
||||
$object->is_for_all=1;
|
||||
$object->fk_user=0;
|
||||
$object->fk_usergroup=0;
|
||||
}
|
||||
|
||||
$object->dates = $dates;
|
||||
$object->datee = $datee;
|
||||
|
||||
$object->entity = $conf->entity;
|
||||
|
||||
$res = $object->create($user);
|
||||
if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||
else dol_print_error($object->db);
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
elseif ($action == 'delete')
|
||||
{
|
||||
// TODO add confirm
|
||||
$res = $object->delete($user);
|
||||
|
||||
if ($res < 0) dol_print_error($object->db);
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$rules = ExpenseReportRule::getAllRule();
|
||||
|
||||
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
|
||||
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"),$linkback,'title_setup');
|
||||
|
||||
$head=expensereport_admin_prepare_head();
|
||||
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
||||
|
||||
echo $langs->trans('ExpenseReportRulesDesc');
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||
echo '<th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
$var=true;
|
||||
echo '<tr '.$bc[$var].'>';
|
||||
echo '<td>';
|
||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
|
||||
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
|
||||
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
|
||||
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
|
||||
echo '<td>'.$form->select_date(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0, 1).'</td>';
|
||||
echo '<td>'.$form->select_date(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0, 1).'</td>';
|
||||
echo '<td><input type="text" value="" name="amount" class="amount" />'.$conf->currency.'</td>';
|
||||
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
|
||||
echo '<td align="right"><input type="submit" class="button" value="'.$langs->trans('Add').'" /></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
echo '<input type="hidden" name="id" value="'.$object->id.'" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
}
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||
echo '<th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
$var=true;
|
||||
foreach ($rules as $rule)
|
||||
{
|
||||
echo '<tr '.$bc[$var].'>';
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
|
||||
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
|
||||
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rule->is_for_all > 0) echo $tab_apply['A'];
|
||||
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
|
||||
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
|
||||
else
|
||||
{
|
||||
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||
if ($key != $langs->trans($key)) echo $langs->trans($key);
|
||||
else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $tab_rules_type[$rule->code_expense_rules_type];
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo $form->select_date(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo dol_print_date($rule->dates, 'day');
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo $form->select_date(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo dol_print_date($rule->datee, 'day');
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($action == 'edit' && $object->id == $rule->id)
|
||||
{
|
||||
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo yn($rule->restrictive, 1, 1);
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
if ($object->id != $rule->id)
|
||||
{
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a> ';
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" /> ';
|
||||
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<script type="text/javascript"> $(function() {
|
||||
$("#apply_to").change(function() {
|
||||
var value = $(this).val();
|
||||
if (value == "A") {
|
||||
$("#group").hide(); $("#user").hide();
|
||||
} else if (value == "U") {
|
||||
$("#user").show();
|
||||
$("#group").hide();
|
||||
} else if (value == "G") {
|
||||
$("#group").show();
|
||||
$("#user").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#apply_to").change();
|
||||
|
||||
}); </script>';
|
||||
|
||||
dol_fiche_end();
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -524,7 +524,6 @@ print "<br>";
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
@ -55,7 +55,7 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel'))
|
||||
if (GETPOST('cancel','alpha'))
|
||||
{
|
||||
$action='';
|
||||
}
|
||||
@ -82,8 +82,8 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["main_multilangs"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"],'chaine',0,'',$conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"],'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
|
||||
|
||||
@ -230,15 +230,15 @@ if ($action == 'edit') // Edit
|
||||
print '</tr>';
|
||||
|
||||
// Default language
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'main_lang_default', 1, 0, 0, 0, 0, 'minwidth300');
|
||||
print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300');
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multilingual GUI
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -349,9 +349,8 @@ if ($action == 'edit') // Edit
|
||||
print '</tr>';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object'));
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans('TranslationKey');
|
||||
|
||||
print '<tr><td class="titlefield">';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
@ -359,7 +358,7 @@ if ($action == 'edit') // Edit
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, '');
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
@ -379,16 +378,15 @@ if ($action == 'edit') // Edit
|
||||
print '</tr>';
|
||||
|
||||
// Message on login page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','user'));
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans('TranslationKey');
|
||||
print '<tr><td>';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, '');
|
||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||
print '</td><td colspan="2">';
|
||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2013 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
|
||||
@ -34,46 +34,54 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
|
||||
$langs->load("admin");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action','aZ09');
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('adminldap','globaladmin'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$error=0;
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$db->begin();
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_TYPE',GETPOST("type"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION',GETPOST("LDAP_SERVER_PROTOCOLVERSION"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_HOST',GETPOST("host"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_HOST_SLAVE',GETPOST("slave"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_PORT',GETPOST("port"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_DN',GETPOST("dn"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_ADMIN_DN',GETPOST("admin"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_ADMIN_PASS',GETPOST("pass"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_USE_TLS',GETPOST("usetls"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE',GETPOST("activesynchro"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',GETPOST("activecontact"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE',GETPOST("activemembers"),'chaine',0,'',$conf->entity)) $error++;
|
||||
$db->begin();
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_TYPE',GETPOST("type"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION',GETPOST("LDAP_SERVER_PROTOCOLVERSION"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_HOST',GETPOST("host"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_HOST_SLAVE',GETPOST("slave"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_PORT',GETPOST("port"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_DN',GETPOST("dn"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_ADMIN_DN',GETPOST("admin"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_ADMIN_PASS',GETPOST("pass"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SERVER_USE_TLS',GETPOST("usetls"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE',GETPOST("activesynchro"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE',GETPOST("activecontact"),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (! dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE',GETPOST("activemembers"),'chaine',0,'',$conf->entity)) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -149,6 +157,11 @@ if (! empty($conf->adherent->enabled))
|
||||
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('addAdminLdapOptions',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
@ -193,11 +206,11 @@ print '</td><td>'.$langs->trans("LDAPServerExample").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>';
|
||||
if (! empty($conf->global->LDAP_SERVER_PORT))
|
||||
{
|
||||
print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
|
||||
print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input size="25" type="text" name="port" value="389">';
|
||||
print '<input size="25" type="text" name="port" value="389">';
|
||||
}
|
||||
print '</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>';
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
@ -47,7 +47,7 @@ $list = array (
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
@ -99,7 +99,7 @@ foreach ($list as $key)
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$label = $langs->trans($key);
|
||||
print '<td><label for="'.$key.'">'.$label.'</label></td>';
|
||||
|
||||
// Value
|
||||
@ -120,7 +120,7 @@ print '</tr>';
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '<br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -119,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');
|
||||
@ -132,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';
|
||||
@ -243,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
|
||||
|
||||
@ -467,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
|
||||
|
||||
|
||||
643
htdocs/admin/mails_emailing.php
Normal 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 ' ';
|
||||
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&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (! empty($conf->fckeditor->enabled))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&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();
|
||||
@ -28,8 +28,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/mails_templates.php
|
||||
* \ingroup setup
|
||||
* \brief Page to administer data tables
|
||||
* \ingroup core
|
||||
* \brief Page to administer emails templates
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
@ -45,14 +45,20 @@ $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');
|
||||
$id=GETPOST('id','int');
|
||||
$rowid=GETPOST('rowid','alpha');
|
||||
$search_label=GETPOST('search_label','alpha');
|
||||
$search_type_template=GETPOST('search_type_template','alpha');
|
||||
$search_topic=GETPOST('search_topic','alpha');
|
||||
$search_lang=GETPOST('search_lang','alpha');
|
||||
$search_fk_user=GETPOST('search_fk_user','intcomma');
|
||||
$search_topic=GETPOST('search_topic','alpha');
|
||||
|
||||
$allowed=$user->admin;
|
||||
$allowed=1;
|
||||
if (! $allowed) accessforbidden();
|
||||
|
||||
$acts[0] = "activate";
|
||||
@ -72,6 +78,9 @@ $offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (empty($sortfield)) $sortfield='label, lang, position';
|
||||
if (empty($sortorder)) $sortorder='ASC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('emailtemplates'));
|
||||
|
||||
@ -81,21 +90,21 @@ $tabname[25]= MAIN_DB_PREFIX."c_email_templates";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[25]="label ASC";
|
||||
$tabsqlsort[25]="label ASC, lang ASC, position 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,fk_user,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,fk_user,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,fk_user,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
|
||||
|
||||
@ -116,17 +125,30 @@ $formmail=new FormMail($db);
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||
{
|
||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
||||
$tmp['__(AnyTranslationKey)__']='__(AnyTranslationKey)__';
|
||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
||||
$tmp['__(AnyTranslationKey)__']='Translation';
|
||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
|
||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
|
||||
foreach($tmp as $key => $val)
|
||||
{
|
||||
$helpsubstit.=$key.' -> '.$val.'<br>';
|
||||
$helpsubstitforlines.=$key.' -> '.$val.'<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmp=FormMail::getAvailableSubstitKey('formemailwithlines');
|
||||
$tmp['__(AnyTranslationKey)__']='__(AnyTranslationKey)__';
|
||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
||||
$tmp['__(AnyTranslationKey)__']='Translation';
|
||||
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
|
||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
|
||||
foreach($tmp as $key => $val)
|
||||
{
|
||||
$helpsubstit.=$key.' -> '.$val.'<br>';
|
||||
}
|
||||
$tmp=FormMail::getAvailableSubstitKey('formemailforlines');
|
||||
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
|
||||
foreach($tmp as $key => $val)
|
||||
{
|
||||
$helpsubstitforlines.=$key.' -> '.$val.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -144,16 +166,20 @@ $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->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
$elementList['all']=$langs->trans('VisibleEverywhere');
|
||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||
|
||||
|
||||
$parameters=array('elementList'=>$elementList);
|
||||
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
@ -170,8 +196,8 @@ $id = 25;
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -183,6 +209,10 @@ if (empty($reshook))
|
||||
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_label='';
|
||||
$search_type_template='';
|
||||
$search_lang='';
|
||||
$search_fk_user='';
|
||||
$search_topic='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
@ -204,7 +234,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]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
@ -213,7 +243,11 @@ if (empty($reshook))
|
||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||
if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
|
||||
if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner';
|
||||
if ($fieldnamekey == 'private') $fieldnamekey = 'Private';
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -253,15 +287,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;
|
||||
}
|
||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||
$keycode=$listfieldvalue[$i];
|
||||
if ($value == 'lang') $keycode='langcode';
|
||||
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 == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
|
||||
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 +336,17 @@ if (empty($reshook))
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
|
||||
$keycode=$listfieldvalue[$i];
|
||||
if ($field == 'lang') $keycode='langcode';
|
||||
|
||||
if ($field == 'fk_user' && ! ($_POST['fk_user'] > 0)) $_POST['fk_user']='';
|
||||
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."'";
|
||||
@ -405,10 +442,22 @@ print load_fiche_titre($titre,$linkback,$titlepicto);
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
|
||||
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
|
||||
if ($user->admin && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
|
||||
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
|
||||
if (! empty($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");
|
||||
@ -426,18 +475,23 @@ 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, fk_user, 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 (! $user->admin)
|
||||
{
|
||||
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " c.rowid = ".$search_country_id;
|
||||
$sql.=" AND (private = 0 OR (private = 1 AND fk_user = ".$user->id."))"; // Show only public and private to me
|
||||
$sql.=" AND (active = 1 OR fk_user = ".$user->id.")"; // Show only active or owned by me
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$sql.= " AND (lang = '".$langs->defaultlang."' OR lang IS NULL)";
|
||||
}
|
||||
if ($search_label) $sql.=natural_search('label', $search_label);
|
||||
if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_search('type_template', $search_type_template);
|
||||
if ($search_lang) $sql.=natural_search('lang', $search_lang);
|
||||
if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2);
|
||||
if ($search_topic) $sql.=natural_search('topic', $search_topic);
|
||||
if ($sortfield)
|
||||
{
|
||||
// If sort order is "country", we use country_code instead
|
||||
@ -461,6 +515,10 @@ $sql.=$db->plimit($listlimit+1,$offset);
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
// Form to add a new line
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
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')).'">';
|
||||
@ -468,30 +526,25 @@ print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('fro
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
if ($action != 'edit')
|
||||
// Line to enter new values (title)
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? ' ' : $langs->trans("Language")); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
@ -506,85 +559,82 @@ if ($action != 'edit')
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
|
||||
print '<td colspan="3">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val=GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="right" colspan="3">';
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$fieldsforcontent = array('content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
|
||||
{
|
||||
$fieldsforcontent = array('content', 'content_lines');
|
||||
}
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="5">';
|
||||
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
|
||||
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
|
||||
|
||||
if ($context != 'hide')
|
||||
{
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended=true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist})?$obj->{$tmpfieldlist}:''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if ($tmpfieldlist == 'content')
|
||||
{
|
||||
print '<td align="center" colspan="3" rowspan="'.(count($fieldsforcontent)).'">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
//else print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$colspan=count($fieldlist)+1;
|
||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
print '<td colspan="3">';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values (input fields)
|
||||
print "<tr " . $bcnd[$var] . ">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
{
|
||||
foreach ($fieldlist as $key => $val) {
|
||||
if (GETPOST($val) != '')
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters = array(
|
||||
'fieldlist' => $fieldlist,
|
||||
'tabname' => $tabname[$id]
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action == 'edit') {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'hide');
|
||||
} else {
|
||||
fieldList($fieldlist, $obj, $tabname[$id], 'add');
|
||||
}
|
||||
}
|
||||
|
||||
print '<td align="right" colspan="3">';
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$fieldsforcontent = array('content');
|
||||
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
|
||||
foreach ($fieldsforcontent as $tmpfieldlist)
|
||||
{
|
||||
print '<tr class="impair nodrag nodrop nohover"><td colspan="6">';
|
||||
if ($tmpfieldlist == 'content')
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||
if ($tmpfieldlist == 'content_lines')
|
||||
print '<strong>' . $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong><br>';
|
||||
|
||||
if ($context != 'hide') {
|
||||
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
||||
$okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
} else
|
||||
print ' ';
|
||||
print '</td>';
|
||||
if ($tmpfieldlist == 'content') {
|
||||
print '<td align="center" colspan="3" rowspan="' . (count($fieldsforcontent)) . '">';
|
||||
if ($action != 'edit') {
|
||||
print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// else print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$colspan=count($fieldlist)+1;
|
||||
//print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
@ -593,6 +643,7 @@ print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
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')).'">';
|
||||
@ -630,12 +681,32 @@ if ($resql)
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
elseif ($value == 'lang')
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($value == 'fk_user')
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$restrictid=array();
|
||||
if (! $user->admin) $restrictid=array($user->id);
|
||||
//var_dump($restrictid);
|
||||
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
||||
elseif ($value == 'type_template')
|
||||
{
|
||||
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100onsmartphone').'</td>';
|
||||
}
|
||||
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
|
||||
}
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre" align="right" width="64">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -660,12 +731,15 @@ if ($resql)
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); }
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
|
||||
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
|
||||
if ($fieldlist[$field]=='private') { $align='center'; }
|
||||
if ($fieldlist[$field]=='position') { $align='center'; }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -689,13 +763,13 @@ if ($resql)
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
@ -726,15 +800,16 @@ 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="7">'; // 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>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -758,19 +833,48 @@ if ($resql)
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
if ($value == 'lang' && $valuetoshow)
|
||||
{
|
||||
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
||||
}
|
||||
if ($value == 'fk_user')
|
||||
{
|
||||
if ($valuetoshow > 0)
|
||||
{
|
||||
$fuser=new User($db);
|
||||
$fuser->fetch($valuetoshow);
|
||||
$valuetoshow = $fuser->getNomUrl(1);
|
||||
}
|
||||
}
|
||||
if ($value == 'private')
|
||||
{
|
||||
$align="center";
|
||||
if ($valuetoshow) $valuetoshow=yn($valuetoshow);
|
||||
else $valuetoshow='';
|
||||
}
|
||||
if ($value == 'position')
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
// Show value for field
|
||||
if ($showfield)
|
||||
{
|
||||
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
print '<!-- '.$fieldlist[$field].' -->';
|
||||
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
$canbemodified=$iserasable;
|
||||
if (! $user->admin && $obj->fk_user != $user->id)
|
||||
{
|
||||
$iserasable=0;
|
||||
$canbedisabled=0;
|
||||
$canbemodified=0;
|
||||
}
|
||||
|
||||
$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;
|
||||
@ -779,28 +883,21 @@ if ($resql)
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
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 "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
if ($canbemodified) print '<td align="center" width="64"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||
print '<td align="center" width="64">';
|
||||
print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
|
||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
else print '<td></td>';
|
||||
|
||||
/*
|
||||
$fieldsforcontent = array('content');
|
||||
@ -864,7 +961,7 @@ $db->close();
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf, $langs, $user, $db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
@ -872,35 +969,107 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'lang')
|
||||
if ($fieldlist[$field] == 'fk_user')
|
||||
{
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
||||
if ($user->admin)
|
||||
{
|
||||
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($context == 'add') // I am not admin and we show the add form
|
||||
{
|
||||
print $user->getNomUrl(1); // Me
|
||||
$forcedvalue=$user->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($obj && ! empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0)
|
||||
{
|
||||
$fuser=new User($db);
|
||||
$fuser->fetch($obj->{$fieldlist[$field]});
|
||||
print $fuser->getNomUrl(1);
|
||||
$forcedvalue=$fuser->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$forcedvalue=$obj->{$fieldlist[$field]};
|
||||
}
|
||||
}
|
||||
$keyname=$fieldlist[$field];
|
||||
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang')
|
||||
{
|
||||
print '<td>';
|
||||
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]}:''));
|
||||
if ($context == 'edit' && ! empty($obj->{$fieldlist[$field]}) && ! in_array($obj->{$fieldlist[$field]}, array_keys($elementList)))
|
||||
{
|
||||
// Current tempalte type is an unknown type, so we must keep it as it is.
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
|
||||
print $obj->{$fieldlist[$field]};
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size=''; $class='';
|
||||
$size=''; $class=''; $classtd='';
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if ($fieldlist[$field]=='private') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='position') $class='maxwidth50';
|
||||
if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; }
|
||||
if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; }
|
||||
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='topic') $class='quatrevingtpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $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'.($classtd?' class="'.$classtd.'"':'').'>';
|
||||
if ($fieldlist[$field]=='private')
|
||||
{
|
||||
if (empty($user->admin))
|
||||
{
|
||||
print $form->selectyesno($fieldlist[$field], '1', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
|
||||
print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
@ -269,7 +270,7 @@ if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
$moduleauthor=$objMod->getPublisher();
|
||||
|
||||
$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
|
||||
print '<div class="centpercent">';
|
||||
@ -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++;
|
||||
}
|
||||
}
|
||||
@ -449,9 +463,40 @@ if ($mode == 'feature')
|
||||
$text.='<br>';
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
$moreinfoontriggerfile='';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
$yesno='Yes';
|
||||
}
|
||||
else
|
||||
{
|
||||
$yesno='No';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers'));
|
||||
foreach($triggers as $triggercursor)
|
||||
{
|
||||
if ($triggercursor['module'] == $moduledir)
|
||||
{
|
||||
$yesno='Yes';
|
||||
$moreinfoontriggerfile=' ('.$triggercursor['relpath'].')';
|
||||
}
|
||||
}
|
||||
|
||||
$text.=$langs->trans($yesno).$moreinfoontriggerfile;
|
||||
|
||||
$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");
|
||||
|
||||
|
||||
@ -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')?GETPOST('categorie', 'int'):0) + 0);
|
||||
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
|
||||
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
|
||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||
$dolistore = new Dolistore();
|
||||
|
||||
|
||||
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,67 @@ 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)
|
||||
{
|
||||
// $options is array with filter criterias
|
||||
//var_dump($options);
|
||||
$dolistore->getRemoteData($options);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
|
||||
|
||||
$previouslink = $dolistore->get_previous_link();
|
||||
$nextlink = $dolistore->get_next_link();
|
||||
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
|
||||
|
||||
?>
|
||||
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||
<input type="hidden" name="mode" value="marketplace" />
|
||||
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
|
||||
<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" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
||||
<a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="divsearchfield right">
|
||||
<?php
|
||||
print $previouslink;
|
||||
print $nextlink;
|
||||
?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
print '</div></div>';
|
||||
print '<div class="clearboth"></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="productlist centpercent">
|
||||
<tbody id="listOfModules">
|
||||
<?php echo $dolistore->get_products($categorie); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -948,6 +997,32 @@ if ($mode == 'deploy')
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
if ($mode == 'develop')
|
||||
{
|
||||
dol_fiche_head($head, $mode, '', -1);
|
||||
|
||||
// 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>';
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -100,7 +100,7 @@ elseif ($action == 'update_currency')
|
||||
if ($submit == $langs->trans('Modify'))
|
||||
{
|
||||
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
|
||||
$rate = GETPOST('rate', 'float');
|
||||
$rate = price2num(GETPOST('rate', 'alpha'));
|
||||
$currency = new MultiCurrency($db);
|
||||
|
||||
if ($currency->fetch($fk_multicurrency) > 0)
|
||||
@ -235,7 +235,7 @@ print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
{
|
||||
@ -293,7 +293,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "<br />";
|
||||
print "<br>";
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@ -103,6 +103,7 @@ else if ($action == 'delete')
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
@ -45,6 +45,10 @@ if($action)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
if ($action == 'STOCK_SUPPORTS_SERVICES')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "STOCK_SUPPORTS_SERVICES", GETPOST('STOCK_SUPPORTS_SERVICES','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
|
||||
{
|
||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
||||
@ -164,8 +168,8 @@ $found=0;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("DeStockOnBill").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("DeStockOnBill").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -184,8 +188,8 @@ $found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -206,8 +210,8 @@ $found++;
|
||||
//{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("DeStockOnShipment").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->expedition->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -226,8 +230,8 @@ $found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->expedition->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -246,7 +250,7 @@ $found++;
|
||||
|
||||
/*if (! $found)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -268,8 +272,8 @@ $found=0;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("ReStockOnBill").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -289,8 +293,8 @@ $found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("ReStockOnValidateOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -309,8 +313,8 @@ $found++;
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
@ -329,7 +333,7 @@ $found++;
|
||||
|
||||
/*if (! $found)
|
||||
{
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockIncrease").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -346,8 +350,8 @@ print '</tr>'."\n";
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
|
||||
@ -361,8 +365,8 @@ print "</tr>\n";
|
||||
if($conf->invoice->enabled) {
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
|
||||
@ -376,8 +380,8 @@ if($conf->invoice->enabled) {
|
||||
if($conf->order->enabled) {
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
|
||||
@ -391,8 +395,8 @@ if($conf->order->enabled) {
|
||||
if($conf->expedition->enabled) {
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
|
||||
@ -404,6 +408,9 @@ if($conf->expedition->enabled) {
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
$virtualdiffersfromphysical=0;
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||
@ -411,7 +418,6 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||
|
||||
if ($virtualdiffersfromphysical)
|
||||
{
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
|
||||
@ -419,8 +425,8 @@ if ($virtualdiffersfromphysical)
|
||||
print '</tr>'."\n";
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
|
||||
@ -430,10 +436,71 @@ if ($virtualdiffersfromphysical)
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<br />';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("Other")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
|
||||
print '<td class="width100" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
|
||||
print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")).'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_SUPPORTS_SERVICES\">";
|
||||
print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
|
||||
print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
||||
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n";
|
||||
print "</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -441,7 +508,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<td>'.$langs->trans("Inventory").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="center" width="100"> </td>'."\n";
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||
@ -454,7 +521,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
||||
@ -467,7 +534,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
|
||||
@ -480,68 +547,19 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print " <td>".$langs->trans("Other")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("UseDispatchStatus").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
||||
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n";
|
||||
print "</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("UserWarehouseAutoCreate").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
|
||||
print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
|
||||
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
|
||||
print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||
if ($conf->global->PRODUIT_SOUSPRODUITS)
|
||||
{
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("IndependantSubProductStock").'</td>';
|
||||
|
||||
print '<td width="160" align="right">';
|
||||
print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
|
||||
print '<td align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
|
||||
@ -553,8 +571,6 @@ if ($conf->global->PRODUIT_SOUSPRODUITS)
|
||||
}
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
@ -336,7 +336,7 @@ jQuery(document).ready(function() {
|
||||
var compjsphpstring;
|
||||
getjsphpurl = $.ajax({
|
||||
type: "GET",
|
||||
url: \''.DOL_URL_ROOT.'/core/js/datepicker.js.php\',
|
||||
url: \''.DOL_URL_ROOT.'/core/js/lib_head.js.php\',
|
||||
cache: false,
|
||||
/* async: false, */
|
||||
/* crossDomain: true,*/
|
||||
|
||||
@ -64,8 +64,8 @@ $hookmanager->initHooks(array('admintranslation','globaladmin'));
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -88,7 +88,45 @@ if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION')
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
if ($action == 'update')
|
||||
{
|
||||
if ($transvalue == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".GETPOST('rowid','int');
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action="";
|
||||
$transkey="";
|
||||
$transvalue="";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@ -209,7 +247,6 @@ print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
@ -230,8 +267,7 @@ if ($mode == 'overwrite')
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
print '<input type="hidden" name="action" value="'.($action=='edit'?'update':'add').'">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -248,13 +284,16 @@ if ($mode == 'overwrite')
|
||||
// Line to add new record
|
||||
print "\n";
|
||||
|
||||
$disablededit='';
|
||||
if ($action == 'edit') $disablededit=' disabled';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="">';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="">';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
@ -270,7 +309,7 @@ if ($mode == 'overwrite')
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
//}
|
||||
$disabled='';
|
||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
||||
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
@ -308,11 +347,30 @@ if ($mode == 'overwrite')
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
print $obj->transvalue;
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$obj->transvalue.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $obj->transvalue;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -389,7 +447,6 @@ if ($mode == 'searchkey')
|
||||
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')';
|
||||
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[1] = "ref,description";
|
||||
$tabfield[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[1] = "ref,description";
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[1] = "ref,description,entity";
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -103,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp[1] = array();
|
||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -114,7 +114,7 @@ $tabfieldcheck[1] = array();
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
|
||||
// Actions add or modify an entry into a dictionary
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
@ -126,12 +126,25 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
if ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (! empty($_POST['ref']))
|
||||
{
|
||||
$websitekey=strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
@ -153,6 +166,12 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
}
|
||||
}
|
||||
|
||||
/* $website=new Website($db);
|
||||
$website->ref=
|
||||
$website->description=
|
||||
$website->virtualhost=
|
||||
$website->create($user); */
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
@ -171,6 +190,9 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
@ -182,6 +204,29 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
global $dolibarr_main_data_root;
|
||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||
$filecss=$pathofwebsite.'/styles.css.php';
|
||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||
$fileindex=$pathofwebsite.'/index.php';
|
||||
|
||||
// Css file
|
||||
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
|
||||
$csscontent.= '<?php '."\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "?>"."\n";
|
||||
$csscontent.= '<!-- END -->'."\n";
|
||||
$csscontent.= 'body { margin: 0; }'."\n";
|
||||
|
||||
dol_syslog("Save file css into ".$filecss);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
}
|
||||
@ -202,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);
|
||||
@ -236,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
|
||||
@ -393,7 +467,11 @@ if ($id)
|
||||
{
|
||||
print '<td class="'.$align.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||
elseif (! empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
}
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -77,6 +77,8 @@ if ($action == 'setproductionmode')
|
||||
}
|
||||
}
|
||||
|
||||
dol_mkdir(DOL_DATA_ROOT.'/api/temp'); // May have been deleted by a purge
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -37,6 +37,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
|
||||
// Force entity if a value provided int HTTP header. Otherwise, will use the entity of user of token used.
|
||||
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
||||
if (! $res) die("Include of main fails");
|
||||
|
||||