forked from Wavyzz/dolibarr
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
92
ChangeLog
92
ChangeLog
@@ -24,69 +24,65 @@ Dolibarr better:
|
||||
- Function delete of class Facture (invoice) need the object $user as first parameter. Also you must
|
||||
check you make a fetch on object before calling the delete.
|
||||
- The old driver of "mysql" has been removed. Dolibarr use the new one (mysqli) by default.
|
||||
- Remove not used function calculate_byte(). Use dol_print_size() instead.
|
||||
- Function pdf_getTotalQty is now deprecated. Not used by Dolibarr core.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 4.0.0 compared to 3.9.* *****
|
||||
For users:
|
||||
NEW: Add reccuring invoice feature and automatic generation of invoices.
|
||||
NEW: Add recurring invoice feature and automatic generation of invoices.
|
||||
NEW: Add module "Loan" as stable.
|
||||
NEW: Add module "Supplier commercial proposal" (price request) is set to stable status.
|
||||
NEW: Experimental module Accountancy Expert
|
||||
NEW: Experimental module Multicurency
|
||||
NEW: Show into badge on tab head the number of dedicated contacts for all objects.
|
||||
NEW: Add module "Supplier commercial proposal" (price request) with stable status.
|
||||
NEW: Can select dynamicaly number of lines to show on page on product, shipment, contact, orders, thirdparties.
|
||||
NEW: Can select fields to show on list also for list of customer orders, supplier orders, shipments, proposals and invoices.
|
||||
NEW: Show into badge on tab head, the number of dedicated contacts for all objects.
|
||||
NEW: Add a checkbox to select/unselect all lines on page that support mass actions (like invoice list page)
|
||||
NEW: Add a new method for margin calculation. Added margin on "cost price" to margin on WAP price and margin on "best supplier price".
|
||||
NEW: Add a new method for margin calculation. Added margin on "cost price" in addition to margin on WAP price and margin on "best supplier price".
|
||||
NEW: Add an explanation message on shipment page to explain you can't make shipment if order is not validated
|
||||
NEW: Add date_rum into table of thirdparty bank account.
|
||||
NEW: The probability of lead/opportunity can be defined per lead.
|
||||
NEW: Added Malta VAT into migration script
|
||||
NEW: #4972 Translated Charges sociales (type 0) and Charges sociales (type 1) in reports page
|
||||
NEW: Add Expense report into accountancy report
|
||||
NEW: Add Expense report to approve into workboard
|
||||
NEW: Selection of boxes is move on top of home page
|
||||
NEW: Add filter on a keyword, status and nature into list of modules
|
||||
NEW: Selection of boxes is moved on top of home page
|
||||
NEW: Add filter on a keyword, status and nature into list of modules.
|
||||
NEW: Add hidden option BANK_DISABLE_CHECK_DEPOSIT to disable check deposit feature.
|
||||
NEW: Add option MAIN_PUBLIC_NOTE_IN_ADDRESS
|
||||
NEW: add html id/class to locate value in the DOM html
|
||||
NEW: Add hidden option MAIN_PUBLIC_NOTE_IN_ADDRESS
|
||||
NEW: Add index on invoice status
|
||||
NEW: Add constant MAIN_LOGTOHTML to 0 into other setup by default to save time when we need to make debug on hosted instance.
|
||||
NEW: Add constant MAIN_LOGTOHTML to 0 into setup by default to save time when we need to make debug on hosted instance.
|
||||
NEW: Add list of billed
|
||||
NEW: Add minimum stock and desired stock into import/export profiles.
|
||||
NEW: Add state into thirdparty export fields
|
||||
NEW: Add state into thirdparty export fields.
|
||||
NEW: Add more trackable events (create, submit and receive supplier order).
|
||||
NEW: Add option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
|
||||
NEW: Add hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN
|
||||
NEW: Add picto on module list to show warning and if module is an external module.
|
||||
NEW: add product type filter on turnover report
|
||||
NEW: Add product type filter on turnover report
|
||||
NEW: Add state into list of fields available for personalized fields of thirdparties
|
||||
NEW: Add statistics for interventions module
|
||||
NEW: Add statistics on number of projets on home page
|
||||
NEW: Add stats and late records into dashboard for supplier proposals.
|
||||
NEW: Add statistics and late records into dashboard for supplier proposals.
|
||||
NEW: Add the admin info on combo of type of contact
|
||||
NEW: Add the event BILL_PAYED to list of supported events for module notification.
|
||||
NEW: Add total weight and volume on PDF
|
||||
NEW: Add the event BILL_PAYED to the list of supported events for module notification.
|
||||
NEW: Add total weight and volume on PDF.
|
||||
NEW: Add hidden option to hide column qty ordered on shipments.
|
||||
NEW: Add view of virtual stock into product list (when appropriate)
|
||||
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter)
|
||||
NEW: Add weight/volume for one product into shipment export
|
||||
NEW: Add view of virtual stock into product list (when appropriate).
|
||||
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter).
|
||||
NEW: Add weight/volume for one product into shipment export.
|
||||
NEW: Add width and height on product card
|
||||
NEW: allow a document to be linked to project from another customer on config
|
||||
NEW: allow project to be shared across entities (for multicompany module)
|
||||
NEW: allow a document to be linked to project of another customer by config setup.
|
||||
NEW: allow project to be shared across entities (for multicompany module).
|
||||
NEW: All variant of ckeditor config can be tested into the setup page of module.
|
||||
NEW: Can change dynamically number of records visible into lists.
|
||||
NEW: Can change type of extrafields for some combinations.
|
||||
NEW: Can define number of first and last line into import wizard.
|
||||
NEW: Can change type of extrafields (for some combinations only).
|
||||
NEW: Can define number of first and last line to import into import wizard.
|
||||
NEW: Can edit next execution date of a cron job.
|
||||
NEW: Can edit value date of a vat payment after recording it.
|
||||
NEW: Can filter modules on publisher
|
||||
NEW: Can filter on employee status when building emailing from users
|
||||
NEW: Can reopen an closed shipment
|
||||
NEW: Can search on shipments into the quick search box
|
||||
NEW: Can select dynamicaly number of lines to show on page on product, shipment, contact, orders, thirdparties
|
||||
NEW: Can select fields to show on supplier orders list.
|
||||
NEW: Can select fields to show on list also for list of customer orders, shipments and invoices.
|
||||
NEW: Can select fields to show on proposal lists.
|
||||
NEW: Can select language from combo list on page to overwrite a translation
|
||||
NEW: Can filter modules on publisher.
|
||||
NEW: Can filter on employee status when building emailing from users.
|
||||
NEW: Can reopen an closed shipment.
|
||||
NEW: Can search on shipments into the quick search box.
|
||||
NEW: Can select language from a combo list on page to overwrite a translation.
|
||||
NEW: Can select number of lines on page list for projects and tasks.
|
||||
NEW: Can use ^ and $ (to say start with or end with like regex syntax) into search fields when search field is text. Bonus: ^$ can filter all lines with field not defined.
|
||||
NEW: Clean and enhance code for cron engine
|
||||
@@ -108,32 +104,35 @@ NEW: Into GED module, filename is truncated only if there is not enough space in
|
||||
NEW: Introduce a predefined job to run database backup
|
||||
NEW: Introduce option MAIN_WEIGHT_DEFAULT_UNIT and MAIN_VOLUME_DEFAULT_UNIT to force output unit for weight and volume.
|
||||
NEW: Introduce position of records into dictionnary of type of contacts
|
||||
NEW: Link on user in leave context reach to leave tab.
|
||||
NEW: List of user in agenda view per user show photo thumb
|
||||
NEW: Link on a user in leave page reach to leave tab of user.
|
||||
NEW: List of user in agenda view per user show photo thumb.
|
||||
NEW: Margins module - Check/update buying price on invoice lines
|
||||
NEW: Merge all admin tools (system and module admin tools) into same entry "Admin tools", so now things are clear: All features restricted to an admin user is inside "setup" (for setup) or "admin tools" (for action tools) instead of 3 different entries.
|
||||
NEW: Merge all boxes "related objects" into one. This save a lot of room on most card and avoid often horizontal scoll.
|
||||
NEW: Moved code that deals with bank categories to BankCateg. Created BankCateg::fetchAll function
|
||||
NEW: Move Expense report menu from module to menu files
|
||||
NEW: Move HRM dictionary from module to core dictionaries
|
||||
NEW: Move HRM dictionary from module to core dictionaries.
|
||||
NEW: Mutualize code to manage email substitution variables. Show available variables into page to edit email templates.
|
||||
NEW: Mutualize code: Use one call of function "addThumbs", when possible, to generate thumbs files instead of several call of "vignette" function.
|
||||
NEW: On translation admin page, admin can overwrite a translation value.
|
||||
NEW: Option MAIN_LIST_FILTER_ON_DAY is supported on proposal list
|
||||
NEW: Add reputation field for price supplier
|
||||
NEW: Rest API token is no more reset at each call. We can reset it with param reset=1 on login call.
|
||||
NEW: Option MAIN_LIST_FILTER_ON_DAY is supported on proposal list.
|
||||
NEW: Add reputation field for price supplier.
|
||||
NEW: Selection of fields is available on member list.
|
||||
NEW: Show a badge with number of withdraw requests done on the withdraw tab of invoice.
|
||||
NEW: Add option to show detail per warehouse into reassort
|
||||
NEW: Show total number of modules into the module list
|
||||
NEW: Add option to show detail per warehouse into reassort.
|
||||
NEW: Show total number of modules into the module list.
|
||||
NEW: Survey system has now a status like other objects. You can close or reopen a survey.
|
||||
NEW: The note on time spent can be entered when using the view per day.
|
||||
NEW: Use ellipsis truncation on too large left menu text
|
||||
NEW: The note on time spent can be entered when using the "view per day".
|
||||
NEW: Use ellipsis truncation on too large left menu text.
|
||||
NEW: When a new field to show into lists is selected, the form is automatically submited and field added.
|
||||
NEW: When creating a template invoice from a draft invoice, if there is link to contract on draft invoice, link is kept on template invoice.
|
||||
NEW: When emailing is not sent completely, show progression.
|
||||
NEW: Experimental module Accountancy Expert.
|
||||
NEW: Experimental module Multicurency
|
||||
|
||||
For developers:
|
||||
NEW: Add entity field in llx_societe_remise_except and llx_societe_remise.
|
||||
NEW: Rest API token is no more reset at each call. We can reset it with param reset=1 on login call.
|
||||
NEW: Add html id/class to locate value in the DOM html
|
||||
NEW: Add a css class style called 'reposition', so when clicking on a link with this class will move scrollbarr to be placed at same page location.
|
||||
NEW: TimeZone can be supplied to mktime
|
||||
NEW: hook in shipment card
|
||||
@@ -153,8 +152,9 @@ NEW: Removed deprecated CommonObject::client property. Please use CommonObject::
|
||||
NEW: Removed unused FormOrder::selectSourcesCommande function
|
||||
NEW: Renamed ActionComm::add function to ActionComm::create
|
||||
NEW: Rename Form::select_date to Form::selectDate and Form::form_date to Form::formDate
|
||||
NEW: Rename path for generiN
|
||||
NEW: Rename path for generic media files
|
||||
NEW: More phpunit tests. Include some REST API into automatic tests.
|
||||
NEW: Move Expense report menu from module to menu files.
|
||||
|
||||
|
||||
WARNING:
|
||||
|
||||
@@ -25,7 +25,7 @@ OpenSuse, Mandriva ou Mageia).
|
||||
Vous pouvez les télécharger depuis la rubrique *download* du portail officiel:
|
||||
https://www.dolibarr.org/
|
||||
|
||||
Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql),
|
||||
Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (MariaDb/MySql/PostgreSql),
|
||||
vous pouvez installer Dolibarr avec cette version de la manière suivante:
|
||||
|
||||
- Copier le répertoire "dolibarr" et son contenu dans la racine de votre serveur
|
||||
@@ -117,8 +117,8 @@ Voir fichier ChangeLog.
|
||||
- Application simple à utiliser.
|
||||
- Plusieurs thèmes visuels.
|
||||
- Code simple et facilement personnalisable.
|
||||
- Requiert PHP et Mysql ou Postgresql (Voir versions exactes sur http://wiki.dolibarr.org/index.php/Prérequis).
|
||||
- Compatible avec toutes les offres Cloud du marché respectant les prérequis MySQL et PHP ou Postgresql.
|
||||
- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur http://wiki.dolibarr.org/index.php/Prérequis).
|
||||
- Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP.
|
||||
- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ 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 (MySQL recommended) 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)
|
||||
@@ -119,7 +119,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Can manage several currencies by adding external module multi-currency.
|
||||
- Very user friendly and easy to use
|
||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||
- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Works with PHP 5.3+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
|
||||
- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture)
|
||||
- Support for country specific features:
|
||||
|
||||
@@ -26,11 +26,11 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm |
|
||||
# Misc dependencies
|
||||
# fonts-dejavu-core | ttf-dejavu-core,
|
||||
xdg-utils,
|
||||
mysql-server,
|
||||
mysql-client,
|
||||
virtual-mysql-client,
|
||||
${misc:Depends},
|
||||
${perl:Depends}
|
||||
Recommends: apache2 | lighttpd | httpd
|
||||
Recommends: apache2 | lighttpd | httpd,
|
||||
virtual-mysql-server
|
||||
Suggests: www-browser, php5-geoip
|
||||
Description: Web based software to manage a company or foundation
|
||||
Dolibarr ERP & CRM is an easy to use open source/free software package for
|
||||
|
||||
@@ -603,7 +603,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'TGZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
@@ -635,7 +635,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'XZ')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
@@ -672,7 +672,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'ZIP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/standard');
|
||||
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
|
||||
@@ -713,7 +713,7 @@ if ($nboftargetok) {
|
||||
if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; }
|
||||
if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; }
|
||||
if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; }
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/'.$subdir);
|
||||
if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; }
|
||||
@@ -799,7 +799,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'DEB')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_debian-ubuntu');
|
||||
if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; }
|
||||
@@ -1002,7 +1002,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'APS')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_aps');
|
||||
if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; }
|
||||
@@ -1088,7 +1088,7 @@ if ($nboftargetok) {
|
||||
if ($target eq 'EXEDOLIWAMP')
|
||||
{
|
||||
$NEWDESTI=$DESTI;
|
||||
if ($NEWPUBLISH =~ /stable/)
|
||||
if ($NEWDESTI =~ /stable/)
|
||||
{
|
||||
mkdir($DESTI.'/package_windows');
|
||||
if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; }
|
||||
|
||||
@@ -2,14 +2,22 @@
|
||||
"name": "dolibarr/dolibarr",
|
||||
"type": "project",
|
||||
"description": "Dolibarr ERP & CRM is a modern and easy to use web software to manage your business",
|
||||
"keywords": ["erp","crm","invoice","sme","proposal","order","stock"],
|
||||
"homepage": "http://www.dolibarr.org",
|
||||
"keywords": [
|
||||
"erp",
|
||||
"crm",
|
||||
"invoice",
|
||||
"sme",
|
||||
"proposal",
|
||||
"order",
|
||||
"stock",
|
||||
"agenda"
|
||||
],
|
||||
"homepage": "https://www.dolibarr.org",
|
||||
"license": "GPL-3.0+",
|
||||
"support": {
|
||||
"issues": "https://github.com/Dolibarr/dolibarr/issues",
|
||||
"forum": "http://www.dolibarr.org/forum",
|
||||
"wiki": "http://wiki.dolibarr.org",
|
||||
"irc": "irc://chat.freenode.net/dolibarr",
|
||||
"forum": "https://www.dolibarr.org/forum",
|
||||
"wiki": "https://wiki.dolibarr.org",
|
||||
"source": "https://github.com/Dolibarr/dolibarr"
|
||||
},
|
||||
"config": {
|
||||
@@ -48,6 +56,5 @@
|
||||
"ext-zip": "ODT and Excel support",
|
||||
"ext-xml": "Excel support",
|
||||
"firephp/firephp-core": "Logging to Firebug console support",
|
||||
"raven/raven": "Sentry logging server support"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
doc/images/dolibarr_screenshot1_1280x800.jpg
Normal file
BIN
doc/images/dolibarr_screenshot1_1280x800.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 234 KiB |
@@ -69,10 +69,10 @@ if ($action == 'add') {
|
||||
$account_number = clean_account(GETPOST('account_number'));
|
||||
}
|
||||
|
||||
if (GETPOST('account_category') <= 0) {
|
||||
$account_parent = '';
|
||||
if (GETPOST('account_parent') <= 0) {
|
||||
$account_parent = 0;
|
||||
} else {
|
||||
$account_parent = GETPOST('account_category','int');
|
||||
$account_parent = GETPOST('account_parent','int');
|
||||
}
|
||||
|
||||
$object->fk_pcg_version = $obj->pcg_version;
|
||||
@@ -98,7 +98,7 @@ if ($action == 'add') {
|
||||
header("Location: account.php");
|
||||
exit;
|
||||
} else if ($action == 'edit') {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
if (! $cancel) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
@@ -119,10 +119,10 @@ if ($action == 'add') {
|
||||
$account_number = clean_account(GETPOST('account_number'));
|
||||
}
|
||||
|
||||
if (GETPOST('account_category') <= 0) {
|
||||
$account_parent = '';
|
||||
if (GETPOST('account_parent') <= 0) {
|
||||
$account_parent = 0;
|
||||
} else {
|
||||
$account_parent = GETPOST('account_category','int');
|
||||
$account_parent = GETPOST('account_parent','int');
|
||||
}
|
||||
|
||||
$object->fk_pcg_version = $obj->pcg_version;
|
||||
@@ -165,7 +165,9 @@ if ($action == 'add') {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxheader('', $langs->trans('AccountAccounting'));
|
||||
$title = $langs->trans('AccountAccounting') ." - ". $langs->trans('Card');
|
||||
$helpurl = '';
|
||||
llxheader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
$htmlacc = new FormVentilation($db);
|
||||
@@ -184,7 +186,7 @@ if ($action == 'create') {
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
|
||||
// Label
|
||||
@@ -247,7 +249,7 @@ if ($action == 'create') {
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"</td></tr>';
|
||||
|
||||
// Label
|
||||
@@ -299,7 +301,7 @@ if ($action == 'create') {
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td>' . $object->account_number . '</td>';
|
||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ if ($action == 'update') {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
||||
dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,18 @@ if ($action == 'setmanagezero') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdisabledirectinput') {
|
||||
$setdisabledirectinput = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
|
||||
if (! $res > 0)
|
||||
$error ++;
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -342,6 +354,20 @@ if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td width="80%">' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>';
|
||||
if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
|
||||
print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td align="center" colspan="2"><a href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@@ -47,8 +47,6 @@ class AccountancyCategory
|
||||
*/
|
||||
public function __construct($db) {
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -295,6 +295,8 @@ class AccountancyExport
|
||||
public function exportCiel(&$TData) {
|
||||
global $conf;
|
||||
|
||||
$this->end_line ="\r\n";
|
||||
|
||||
$i = 1;
|
||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
|
||||
foreach ( $TData as $data ) {
|
||||
@@ -333,6 +335,8 @@ class AccountancyExport
|
||||
public function exportQuadratus(&$TData) {
|
||||
global $conf;
|
||||
|
||||
$this->end_line ="\r\n";
|
||||
|
||||
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
|
||||
foreach ( $TData as $data ) {
|
||||
$code_compta = $data->numero_compte;
|
||||
|
||||
@@ -95,7 +95,6 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function __construct(DoliDB $db) {
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
@@ -57,17 +57,17 @@ if ($year == 0) {
|
||||
// Validate History
|
||||
$action = GETPOST('action');
|
||||
if ($action == 'validatehistory') {
|
||||
|
||||
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = accnt.rowid";
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = accnt.rowid";
|
||||
@@ -75,9 +75,9 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@@ -90,7 +90,7 @@ if ($action == 'validatehistory') {
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
@@ -98,9 +98,9 @@ if ($action == 'validatehistory') {
|
||||
$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 ++;
|
||||
@@ -113,15 +113,15 @@ if ($action == 'validatehistory') {
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
|
||||
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@@ -196,11 +196,10 @@ $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
@@ -210,7 +209,6 @@ if ($resql) {
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@@ -245,10 +243,8 @@ $resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
@@ -271,37 +267,34 @@ if (! empty($conf->margin->enabled)) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS 'Marge',";
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as 'Total'";
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
|
||||
@@ -185,7 +185,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND product_type <= 2";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
|
||||
@@ -307,6 +307,7 @@ if ($result) {
|
||||
// Ref Invoice
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
// Ref Product
|
||||
$product_static->ref = $objp->product_ref;
|
||||
|
||||
@@ -166,7 +166,7 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($tabfac as $key => $val)
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
@@ -425,7 +425,7 @@ if ($action == 'export_csv') {
|
||||
'action' => ''
|
||||
));
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
@@ -443,7 +443,7 @@ if ($action == 'export_csv') {
|
||||
'action' => ''
|
||||
));
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
|
||||
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
|
||||
} else {
|
||||
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
@@ -41,7 +41,7 @@ if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
@@ -55,17 +55,17 @@ if ($year == 0) {
|
||||
// Validate History
|
||||
$action = GETPOST('action');
|
||||
if ($action == 'validatehistory') {
|
||||
|
||||
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = accnt.rowid";
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = accnt.rowid";
|
||||
@@ -73,7 +73,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@@ -86,7 +86,7 @@ if ($action == 'validatehistory') {
|
||||
} elseif ($action == 'fixaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
@@ -94,9 +94,9 @@ if ($action == 'validatehistory') {
|
||||
$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 ++;
|
||||
@@ -109,15 +109,15 @@ if ($action == 'validatehistory') {
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
|
||||
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
@@ -154,35 +154,17 @@ $var = true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',";
|
||||
$sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=1,ffd.total_ht,0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=2,ffd.total_ht,0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=3,ffd.total_ht,0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=4,ffd.total_ht,0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=5,ffd.total_ht,0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=6,ffd.total_ht,0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=7,ffd.total_ht,0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=8,ffd.total_ht,0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=9,ffd.total_ht,0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=10,ffd.total_ht,0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=11,ffd.total_ht,0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=12,ffd.total_ht,0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as 'Total'";
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
@@ -194,35 +176,24 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 1) . ")";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
print '<td align="right">' . price($row[4]) . '</td>';
|
||||
print '<td align="right">' . price($row[5]) . '</td>';
|
||||
print '<td align="right">' . price($row[6]) . '</td>';
|
||||
print '<td align="right">' . price($row[7]) . '</td>';
|
||||
print '<td align="right">' . price($row[8]) . '</td>';
|
||||
print '<td align="right">' . price($row[9]) . '</td>';
|
||||
print '<td align="right">' . price($row[10]) . '</td>';
|
||||
print '<td align="right">' . price($row[11]) . '</td>';
|
||||
print '<td align="right">' . price($row[12]) . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@@ -233,34 +204,16 @@ print "</table>\n";
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td width="60" align="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="center">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="center"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("CAHTF") . "' AS 'Total',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=1,ffd.total_ht,0)),2) AS 'Janvier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=2,ffd.total_ht,0)),2) AS 'Fevrier',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=3,ffd.total_ht,0)),2) AS 'Mars',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=4,ffd.total_ht,0)),2) AS 'Avril',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=5,ffd.total_ht,0)),2) AS 'Mai',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=6,ffd.total_ht,0)),2) AS 'Juin',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=7,ffd.total_ht,0)),2) AS 'Juillet',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=8,ffd.total_ht,0)),2) AS 'Aout',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=9,ffd.total_ht,0)),2) AS 'Septembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=10,ffd.total_ht,0)),2) AS 'Octobre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=11,ffd.total_ht,0)),2) AS 'Novembre',";
|
||||
$sql .= " ROUND(SUM(IF(MONTH(ff.datef)=12,ffd.total_ht,0)),2) AS 'Decembre',";
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as 'Total'";
|
||||
$sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
@@ -274,31 +227,19 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
print '<td align="right">' . $row[1] . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
print '<td align="right">' . price($row[4]) . '</td>';
|
||||
print '<td align="right">' . price($row[5]) . '</td>';
|
||||
print '<td align="right">' . price($row[6]) . '</td>';
|
||||
print '<td align="right">' . price($row[7]) . '</td>';
|
||||
print '<td align="right">' . price($row[8]) . '</td>';
|
||||
print '<td align="right">' . price($row[9]) . '</td>';
|
||||
print '<td align="right">' . price($row[10]) . '</td>';
|
||||
print '<td align="right">' . price($row[11]) . '</td>';
|
||||
print '<td align="right">' . price($row[12]) . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
|
||||
@@ -77,7 +77,9 @@ if ($object->id > 0)
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
llxHeader("",$langs->trans("Agenda"),'');
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Agenda");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
@@ -717,8 +717,9 @@ if (empty($reshook))
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Card");
|
||||
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('',$langs->trans("Member"),$help_url);
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
|
||||
@@ -557,7 +557,9 @@ $form = new Form($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Subscriptions");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
if ($rowid > 0)
|
||||
{
|
||||
|
||||
@@ -1580,7 +1580,7 @@ class Adherent extends CommonObject
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
$link=''; $linkend='';
|
||||
if ($option == 'card')
|
||||
if ($option == 'card' || $option == 'category')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
@@ -1590,12 +1590,6 @@ class Adherent extends CommonObject
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
if ($option == 'category')
|
||||
{
|
||||
$type = Categorie::TYPE_MEMBER;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type='.$type.$linkclose;
|
||||
$linkend='</a>';
|
||||
}
|
||||
|
||||
$picto='user';
|
||||
|
||||
|
||||
@@ -85,7 +85,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Documents");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,9 @@ $result=restrictedArea($user,'adherent',$id);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Info");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$object = new Adherent($db);
|
||||
$object->fetch($id);
|
||||
|
||||
@@ -215,6 +215,7 @@ if ($search_ref)
|
||||
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
|
||||
else $sql.=" AND 1 = 2"; // Always wrong
|
||||
}
|
||||
if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname);
|
||||
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
|
||||
if ($search_login) $sql.= natural_search("d.login", $search_login);
|
||||
if ($search_email) $sql.= natural_search("d.email", $search_email);
|
||||
@@ -421,7 +422,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="search_ref" value="'.$search_firstname.'" size="6"></td>';
|
||||
print '<input class="flat" type="text" name="search_firstname" value="'.$search_firstname.'" size="6"></td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
@@ -611,6 +612,13 @@ if ($resql)
|
||||
print "<td>";
|
||||
print $memberstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Lastname
|
||||
if (! empty($arrayfields['d.lastname']['checked']))
|
||||
@@ -618,13 +626,6 @@ if ($resql)
|
||||
print "<td>";
|
||||
print $obj->lastname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Firstname
|
||||
if (! empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->firstname;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Company
|
||||
if (! empty($arrayfields['d.company']['checked']))
|
||||
|
||||
@@ -59,8 +59,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
$title=$langs->trans("Member") . " - " . $langs->trans("Note");
|
||||
$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ if ($action == 'edit') // Edit
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Multilangual GUI
|
||||
// Multilingual GUI
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1);
|
||||
@@ -186,7 +186,7 @@ if ($action == 'edit') // Edit
|
||||
show_theme(null,1);
|
||||
print '<br>';
|
||||
|
||||
// Liste des zone de recherche permanantes supportees
|
||||
// List of permanent supported search box
|
||||
if (! empty($searchform))
|
||||
{
|
||||
print '<table summary="search" class="noborder" width="100%">';
|
||||
|
||||
@@ -48,11 +48,11 @@ if ($action == "set")
|
||||
|
||||
$id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int');
|
||||
$account = new Account($db);
|
||||
|
||||
if($account->fetch($id)>0)
|
||||
{
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
/*
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
|
||||
@@ -67,6 +67,7 @@ if ($action == "set")
|
||||
if (! $res > 0) $error++;
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
*/
|
||||
}
|
||||
else $error++;
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
global $conf;
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$langs->load("admin");
|
||||
@@ -40,34 +42,37 @@ $activeModules = array();
|
||||
|
||||
if (defined('SYSLOG_HANDLERS')) $activeModules = json_decode(constant('SYSLOG_HANDLERS'));
|
||||
|
||||
$dir = dol_buildpath('/core/modules/syslog/');
|
||||
$dirsyslogs = array_merge(array('/core/modules/syslog/'), $conf->modules_parts['syslog']);
|
||||
foreach ($dirsyslogs as $reldir) {
|
||||
$dir = dol_buildpath($reldir, 0);
|
||||
$newdir = dol_osencode($dir);
|
||||
if (is_dir($newdir)) {
|
||||
$handle = opendir($newdir);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
$var = true;
|
||||
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
require_once $newdir . $file . '.php';
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
$module = new $file;
|
||||
|
||||
$module = new $file;
|
||||
// Show modules according to features level
|
||||
if ($module->getVersion() == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($module->getVersion() == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->getVersion() == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->getVersion() == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
$syslogModules[] = $file;
|
||||
$syslogModules[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
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/class/html.formadmin.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
@@ -36,15 +37,52 @@ if (!$user->admin) accessforbidden();
|
||||
|
||||
$id=GETPOST('rowid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
$langcode=GETPOST('langcode','alpha');
|
||||
$transkey=GETPOST('transkey','alpha');
|
||||
$transvalue=GETPOST('transvalue','alpha');
|
||||
|
||||
|
||||
$mode = GETPOST('mode')?GETPOST('mode'):'overwrite';
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='lang,transkey';
|
||||
if (! $sortorder) $sortorder='ASC';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $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
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$transkey='';
|
||||
$transvalue='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
@@ -62,7 +100,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
}
|
||||
if ($transvalue == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
@@ -113,127 +151,290 @@ $formadmin = new FormAdmin($db);
|
||||
$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración';
|
||||
llxHeader('',$langs->trans("Setup"),$wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("TranslationSetup"),'','title_setup');
|
||||
print load_fiche_titre($langs->trans("Translation"),'','title_setup');
|
||||
|
||||
print $langs->trans("TranslationDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>';
|
||||
print '<br>';
|
||||
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
|
||||
$urlwikitranslatordoc='http://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print $langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a><br>';
|
||||
$current_language_code=$langs->defaultlang;
|
||||
$s=picto_from_langcode($current_language_code);
|
||||
print $langs->trans("CurrentUserLanguage").': <strong>'.$s.' '.$current_language_code.'</strong><br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("Value"))."<br>\n";
|
||||
$param='&mode='.$mode;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($langcode) $param.='&langcode='.urlencode($langcode);
|
||||
if ($transkey) $param.='&transkey='.urlencode($transkey);
|
||||
if ($transvalue) $param.='&transvalue='.urlencode($transvalue);
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
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 '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Language").' (en_US, es_MX, ...)</td>';
|
||||
print '<td>'.$langs->trans("Key").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
$head=translation_prepare_head();
|
||||
|
||||
dol_fiche_head($head, $mode, '', 0, '');
|
||||
|
||||
// Line to add new record
|
||||
$var=false;
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'),'langcode',0,null,1,0,0,'',1);
|
||||
//print '<input type="text" class="flat" size="24" name="langcode" value="'.GETPOST('langcode').'">';
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="30" name="transkey" value="">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="40" name="transvalue" value="">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
if ($mode == 'overwrite')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="add">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
||||
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a>)<br>';
|
||||
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Line to add new record
|
||||
$var=false;
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="add">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT";
|
||||
$sql.= " rowid";
|
||||
$sql.= ", lang";
|
||||
$sql.= ", transkey";
|
||||
$sql.= ", transvalue";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
||||
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
|
||||
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||
//if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
|
||||
//$sql.= " ORDER BY entity, name ASC";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=false;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
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>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT";
|
||||
$sql.= " rowid";
|
||||
$sql.= ", lang";
|
||||
$sql.= ", transkey";
|
||||
$sql.= ", transvalue";
|
||||
//$sql.= ", entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
||||
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
|
||||
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||
//if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
|
||||
//$sql.= " ORDER BY entity, name ASC";
|
||||
$sql.= " ORDER BY lang ASC, transkey ASC";
|
||||
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=false;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
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>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'searchkey')
|
||||
{
|
||||
$langcode=GETPOST('langcode')?GETPOST('langcode'):$langs->defaultlang;
|
||||
|
||||
$newlang=new Translate('',$conf);
|
||||
$newlang->setDefaultLang($langcode);
|
||||
|
||||
print '</table>';
|
||||
$newlangfileonly=new Translate('',$conf);
|
||||
$newlangfileonly->setDefaultLang($langcode);
|
||||
|
||||
$recordtoshow=array();
|
||||
|
||||
$nbempty=0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
var_dump($transvalue);*/
|
||||
if (empty($langcode) || $langcode == '-1') $nbempty++;
|
||||
if (empty($transkey)) $nbempty++;
|
||||
if (empty($transvalue)) $nbempty++;
|
||||
if ($action == 'search' && ($nbempty > 999)) // 999 to disable this
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load all translations keys
|
||||
foreach($conf->file->dol_document_root as $keydir => $searchdir)
|
||||
{
|
||||
// Directory of translation files
|
||||
$dir_lang = $searchdir."/langs/".$langcode;
|
||||
$dir_lang_osencoded=dol_osencode($dir_lang);
|
||||
|
||||
$filearray=dol_dir_list($dir_lang_osencoded,'files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
|
||||
foreach($filearray as $file)
|
||||
{
|
||||
$tmpfile=preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$newlang->load($tmpfile, 0, 0, '', 0);
|
||||
$newlangfileonly->load($tmpfile, 0, 0, '', 1);
|
||||
//print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Now search into translation array
|
||||
foreach($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && ! preg_match('/'.preg_quote($transkey).'/', $key)) continue;
|
||||
if ($transvalue && ! preg_match('/'.preg_quote($transvalue).'/', $val)) continue;
|
||||
$recordtoshow[$key]=$val;
|
||||
}
|
||||
}
|
||||
|
||||
//print '<br>';
|
||||
$nbtotalofrecordswithoutfilters = count($newlang->tab_translate);
|
||||
$nbtotalofrecords = count($recordtoshow);
|
||||
$num = $limit + 1;
|
||||
if (($offset + $num) > $nbtotalofrecords) $num = $limit;
|
||||
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
if ($nbtotalofrecords > 0) $title.=' ('.$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.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
|
||||
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("CurrentTranslationString"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Line to search new record
|
||||
$var=false;
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode,'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
// Limit to superadmin
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="1" name="entitysearch" value="'.$conf->entity.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="entitysearch" value="'.$conf->entity.'">';
|
||||
}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow);
|
||||
|
||||
// Show result
|
||||
$i=0;
|
||||
$var=false;
|
||||
foreach($recordtoshow as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($i <= $offset) continue;
|
||||
if ($i > ($offset + $limit)) break;
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td align="right">';
|
||||
if ($val != $newlangfileonly->tab_translate[$key])
|
||||
{
|
||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ $langs->load("main");
|
||||
print '<div class="menu_bloc">';
|
||||
print '<ul class="menu">';
|
||||
// Link to new sell
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span>'.$langs->trans("NewSell").'</span></a></li>';
|
||||
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span class="hideonsmartphone">'.$langs->trans("NewSell").'</span></a></li>';
|
||||
// Open new tab on backoffice (this is not a disconnect from POS)
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
print '<li class="menu_choix2"><a href=".." target="backoffice"><span class="hideonsmartphone">'.$langs->trans("BackOffice").'</span></a></li>';
|
||||
// Disconnect
|
||||
print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['firstname'].' '.$_SESSION['lastname'];
|
||||
print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
|
||||
|
||||
@@ -58,6 +58,7 @@ if ($origin)
|
||||
if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin;
|
||||
if ($type == Categorie::TYPE_MEMBER) $idMemberOrigin = $origin;
|
||||
if ($type == Categorie::TYPE_CONTACT) $idContactOrigin = $origin;
|
||||
if ($type == Categorie::TYPE_PROJECT) $idProjectOrigin = $origin;
|
||||
}
|
||||
|
||||
if ($catorigin && $type == Categorie::TYPE_PRODUCT) $idCatOrigin = $catorigin;
|
||||
@@ -88,17 +89,17 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
||||
}
|
||||
else if ($idProdOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&type='.$type);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idCompanyOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&type='.$type);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idSupplierOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&type='.$type);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idMemberOrigin)
|
||||
@@ -106,16 +107,16 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idCatOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idContactOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idProjectOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
|
||||
@@ -173,32 +174,32 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr
|
||||
}
|
||||
else if ($idProdOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idCompanyOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idSupplierOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idMemberOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type);
|
||||
exit;
|
||||
}
|
||||
else if ($idCatOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCatOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idContactOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idProjectOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -215,7 +216,8 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader("","",$langs->trans("Categories"));
|
||||
$helpurl='';
|
||||
llxHeader("",$langs->trans("Categories"),$helpurl);
|
||||
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
@@ -244,7 +246,7 @@ if ($user->rights->categorie->creer)
|
||||
|
||||
// Ref
|
||||
print '<tr>';
|
||||
print '<td width="20%" class="fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">';
|
||||
print'</td></tr>';
|
||||
|
||||
// Description
|
||||
@@ -258,7 +260,7 @@ if ($user->rights->categorie->creer)
|
||||
print '<tr><td>'.$langs->trans("Color").'</td><td>';
|
||||
print $formother->selectColor($color,'color');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Parent category
|
||||
print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
|
||||
print $form->select_all_categories($type, $catorigin);
|
||||
|
||||
@@ -1,738 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@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/categories/categorie.php
|
||||
* \ingroup category
|
||||
* \brief Page to show category tab
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
$langs->load("categories");
|
||||
$langs->load("products");
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
$type = GETPOST('type');
|
||||
|
||||
$removecat = GETPOST('removecat','int');
|
||||
$parent=GETPOST('parent','int');
|
||||
|
||||
$dbtablename = '';
|
||||
|
||||
|
||||
// For categories on third parties
|
||||
if (! empty($socid)) $id = $socid;
|
||||
if (! isset($type)) $type = Categorie::TYPE_PRODUCT;
|
||||
if ($type == Categorie::TYPE_SUPPLIER || $type == Categorie::TYPE_CUSTOMER) $socid = $id;
|
||||
|
||||
if ($id || $ref)
|
||||
{
|
||||
if ($type == Categorie::TYPE_PRODUCT) {
|
||||
$elementtype = 'product';
|
||||
$objecttype = 'produit|service&categorie';
|
||||
$objectid = isset($id)?$id:(isset($ref)?$ref:'');
|
||||
$dbtablename = 'product';
|
||||
$fieldid = isset($ref)?'ref':'rowid';
|
||||
}
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) {
|
||||
$elementtype = 'fournisseur';
|
||||
$objecttype = 'societe&categorie';
|
||||
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
||||
$dbtablename = '&societe';
|
||||
$fieldid = 'rowid';
|
||||
}
|
||||
elseif ($type == Categorie::TYPE_CUSTOMER) {
|
||||
$elementtype = 'societe';
|
||||
$objecttype = 'societe&categorie';
|
||||
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
||||
$dbtablename = '&societe';
|
||||
$fieldid = 'rowid';
|
||||
}
|
||||
elseif ($type == Categorie::TYPE_MEMBER) {
|
||||
$elementtype = 'member';
|
||||
$objecttype = 'adherent&categorie';
|
||||
$objectid = isset($id)?$id:(isset($ref)?$ref:'');
|
||||
$dbtablename = 'adherent';
|
||||
$fieldid = ! empty($ref)?'ref':'rowid';
|
||||
}
|
||||
elseif ($type == Categorie::TYPE_CONTACT) {
|
||||
$elementtype = 'societe';
|
||||
$objecttype = 'contact';
|
||||
$objectid = isset($id)?$id:(isset($ref)?$ref:'');
|
||||
$dbtablename = 'socpeople&societe';
|
||||
$fieldid = ! empty($ref)?'ref':'rowid';
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid);
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('categorycard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$socid);
|
||||
$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))
|
||||
{
|
||||
// Remove element from category
|
||||
if ($removecat > 0)
|
||||
{
|
||||
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
$elementtype = 'product';
|
||||
}
|
||||
if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
$object = new Fournisseur($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'fournisseur';
|
||||
}
|
||||
if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'societe';
|
||||
}
|
||||
if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'member';
|
||||
}
|
||||
if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$object = new Contact($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'contact';
|
||||
}
|
||||
$cat = new Categorie($db);
|
||||
$result=$cat->fetch($removecat);
|
||||
|
||||
$result=$cat->del_type($object,$elementtype);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Add object into a category
|
||||
if ($parent > 0)
|
||||
{
|
||||
if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
$elementtype = 'product';
|
||||
}
|
||||
if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
$object = new Fournisseur($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'fournisseur';
|
||||
}
|
||||
if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'societe';
|
||||
}
|
||||
if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$object = new Adherent($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'member';
|
||||
}
|
||||
if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$object = new Contact($db);
|
||||
$result = $object->fetch($objectid);
|
||||
$elementtype = 'contact';
|
||||
}
|
||||
$cat = new Categorie($db);
|
||||
$result=$cat->fetch($parent);
|
||||
|
||||
$result=$cat->add_type($object,$elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessages($langs->trans("WasAddedSuccessfully",$cat->label), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
/*
|
||||
* Fiche categorie de client et/ou fournisseur
|
||||
*/
|
||||
if ($socid)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
|
||||
$soc = new Societe($db);
|
||||
$result = $soc->fetch($socid);
|
||||
|
||||
$title=$langs->trans("Category");
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$soc->name." - ".$title;
|
||||
llxHeader("",$title);
|
||||
|
||||
// Show tabs
|
||||
$head = societe_prepare_head($soc);
|
||||
|
||||
dol_fiche_head($head, 'category', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans("ThirdPartyName").'</td><td colspan="3">';
|
||||
print $form->showrefnav($soc,'socid','',($user->societe_id?0:1),'rowid','nom','','&type='.$type);
|
||||
print '</td></tr>';
|
||||
|
||||
// Alias names (commercial, trademark or alias names)
|
||||
print '<tr><td valign="top">'.$langs->trans('AliasNames').'</td><td colspan="3">';
|
||||
print $soc->name_alias;
|
||||
print "</td></tr>";
|
||||
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->client)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td colspan="3">';
|
||||
print $soc->code_client;
|
||||
if ($soc->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($soc->fournisseur)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('SupplierCode').'</td><td colspan="3">';
|
||||
print $soc->code_fournisseur;
|
||||
if ($soc->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->barcode->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Gencod').'</td><td colspan="3">'.$soc->barcode.'</td></tr>';
|
||||
}
|
||||
|
||||
// Address
|
||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3">';
|
||||
dol_print_address($soc->address,'gmap','thirdparty',$soc->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$soc->zip."</td>";
|
||||
print '<td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$soc->town."</td></tr>";
|
||||
|
||||
// Country
|
||||
if ($soc->country)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
//$img=picto_from_langcode($soc->country_code);
|
||||
$img='';
|
||||
print ($img?$img.' ':'');
|
||||
print $soc->country;
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans('EMail').'</td><td colspan="3">';
|
||||
print dol_print_email($soc->email,0,$soc->id,'AC_EMAIL');
|
||||
print '</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">';
|
||||
print dol_print_url($soc->url);
|
||||
print '</td></tr>';
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($soc->phone,$soc->country_code,0,$soc->id,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($soc->fax,$soc->country_code,0,$soc->id,'AC_FAX').'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if ($soc->client) formCategory($db,$soc,2,$socid,$user->rights->societe->creer);
|
||||
|
||||
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
||||
|
||||
if ($soc->fournisseur) formCategory($db,$soc,1,$socid,$user->rights->societe->creer);
|
||||
}
|
||||
else if ($id || $ref)
|
||||
{
|
||||
if ($type == Categorie::TYPE_PRODUCT)
|
||||
{
|
||||
$langs->load("products");
|
||||
|
||||
/*
|
||||
* Category card for product
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
// Product
|
||||
$product = new Product($db);
|
||||
$result = $product->fetch($id, $ref);
|
||||
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
|
||||
|
||||
$head=product_prepare_head($product);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'category', $titre,0,$picto);
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print "<tr>";
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($product,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->label.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||
print $product->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||
print $product->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
formCategory($db,$product,0,$socid,($user->rights->produit->creer || $user->rights->service->creer));
|
||||
}
|
||||
|
||||
if ($type == Categorie::TYPE_MEMBER)
|
||||
{
|
||||
$langs->load("members");
|
||||
|
||||
/*
|
||||
* Category card for member
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
|
||||
// Produit
|
||||
$member = new Adherent($db);
|
||||
$result = $member->fetch($id, $ref);
|
||||
|
||||
$membert = new AdherentType($db);
|
||||
$membert->fetch($member->typeid);
|
||||
|
||||
llxHeader("","",$langs->trans("Member"));
|
||||
|
||||
|
||||
$head=member_prepare_head($member);
|
||||
$titre=$langs->trans("Member");
|
||||
$picto='user';
|
||||
dol_fiche_head($head, 'category', $titre,0,$picto);
|
||||
|
||||
$rowspan=5;
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan+=1;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print $form->showrefnav($member,'id','','1','rowid','ref','','&type='.$type);
|
||||
print '</td></tr>';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$member->login.' </td></tr>';
|
||||
}
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$member->getmorphylib().'</td>';
|
||||
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
|
||||
print $form->showphoto('memberphoto',$member);
|
||||
print '</td>';*/
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$member->societe.'</td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$member->getCivilityLabel().' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lastname
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$member->lastname.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$member->firstname.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$member->getLibStatut(4).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
formCategory($db,$member,3,0,$user->rights->adherent->creer);
|
||||
}
|
||||
if ($type == Categorie::TYPE_CONTACT)
|
||||
{
|
||||
$langs->load("contact");
|
||||
|
||||
/*
|
||||
* Category card for contact
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
|
||||
// Produit
|
||||
$object = new Contact($db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
llxHeader("","",$langs->trans("Contact"));
|
||||
|
||||
|
||||
$head=contact_prepare_head($object);
|
||||
$titre=$langs->trans("ContactsAddresses");
|
||||
$picto='contact';
|
||||
dol_fiche_head($head, 'category', $titre,0,$picto);
|
||||
|
||||
$rowspan=5;
|
||||
if (! empty($conf->societe->enabled)) $rowspan++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print $form->showrefnav($object,'rowid');
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
|
||||
if (!empty($object->thirdparty->id))
|
||||
{
|
||||
print $object->thirdparty->getNomUrl(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ContactNotLinkedToCompany");
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td width="15%">'.$langs->trans("UserTitle").'</td><td colspan="3">';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
// Role
|
||||
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="3">'.$object->poste.'</td>';
|
||||
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3">';
|
||||
dol_print_address($object->address,'gmap','contact',$object->id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Zip/Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">';
|
||||
print $object->zip;
|
||||
if ($object->zip) print ' ';
|
||||
print $object->town.'</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
if ($img) print $img.' ';
|
||||
print $object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">'.$object->state.'</td>';
|
||||
}
|
||||
|
||||
// Phone
|
||||
print '<tr><td>'.$langs->trans("PhonePro").'</td><td>'.dol_print_phone($object->phone_pro,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("PhonePerso").'</td><td>'.dol_print_phone($object->phone_perso,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td>'.dol_print_phone($object->phone_mobile,$object->country_code,$object->id,$object->socid,'AC_TEL').'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td><td>'.dol_print_phone($object->fax,$object->country_code,$object->id,$object->socid,'AC_FAX').'</td></tr>';
|
||||
|
||||
// Email
|
||||
print '<tr><td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($object->email,$object->id,$object->socid,'AC_EMAIL').'</td>';
|
||||
if (! empty($conf->mailing->enabled))
|
||||
{
|
||||
$langs->load("mails");
|
||||
print '<td class="nowrap">'.$langs->trans("NbOfEMailingsReceived").'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?filteremail='.urlencode($object->email).'">'.$object->getNbOfEMailings().'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2"> </td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
// Instant message and no email
|
||||
print '<tr><td>'.$langs->trans("IM").'</td><td>'.$object->jabberid.'</td>';
|
||||
if (!empty($conf->mailing->enabled))
|
||||
{
|
||||
print '<td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td colspan="2"> </td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td colspan="3">';
|
||||
print $object->LibPubPriv($object->priv);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Public
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
|
||||
print nl2br($object->note_public);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Private
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
|
||||
print nl2br($object->note_private);
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
print $object->showOptionals($extrafields);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
formCategory($db,$object,4,$socid, $user->rights->societe->creer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to output a form to add object into a category
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
* @param Object $object Object we want to see categories it can be classified into
|
||||
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||
* @param int $socid Id thirdparty
|
||||
* @param int $showclassifyform 1=Add form to 'Classify', 0=Do not show form to 'Classify'
|
||||
* @return int 0
|
||||
*/
|
||||
function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
|
||||
{
|
||||
global $user,$langs,$form,$bc;
|
||||
|
||||
$title='NotDefined';
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoriesShort");
|
||||
if ($typeid == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort");
|
||||
|
||||
$linktocreate='';
|
||||
if ($showclassifyform && $user->rights->categorie->creer)
|
||||
{
|
||||
$linktocreate='<a href="'.DOL_URL_ROOT.'/categories/card.php?action=create&origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==Categorie::TYPE_SUPPLIER||$typeid==Categorie::TYPE_CUSTOMER)?'socid':'id').'='.$object->id.'&type='.$typeid).'">';
|
||||
$linktocreate.=$langs->trans("CreateCat").' ';
|
||||
$linktocreate.=img_picto($langs->trans("Create"),'filenew');
|
||||
$linktocreate.="</a>";
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print load_fiche_titre($title,$linktocreate,'');
|
||||
|
||||
// Form to add record into a category
|
||||
if ($showclassifyform)
|
||||
{
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="40%">';
|
||||
print '<span class="hideonsmartphone">'.$langs->trans("ClassifyInCategory").' </span>';
|
||||
print $form->select_all_categories($typeid,'auto');
|
||||
print '</td>';
|
||||
print '<td><input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id,$typeid);
|
||||
|
||||
if (count($cats) > 0)
|
||||
{
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductIsInCategories");
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyIsInSuppliersCategories");
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyIsInCustomersCategories");
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberIsInCategories");
|
||||
if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactIsInCategories");
|
||||
print "\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$title.':</td></tr>';
|
||||
|
||||
$var = true;
|
||||
foreach ($cats as $cat)
|
||||
{
|
||||
$ways = $cat->print_all_ways();
|
||||
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
$var = ! $var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Categorie
|
||||
print "<td>".img_object('','category').' '.$way."</td>";
|
||||
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$permission=0;
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removecat=".$cat->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
else if ($cats < 0)
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductHasNoCategory");
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyHasNoCategory");
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyHasNoCategory");
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberHasNoCategory");
|
||||
if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactHasNoCategory");
|
||||
print $title;
|
||||
print "<br/>";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@@ -50,6 +50,7 @@ class Categorie extends CommonObject
|
||||
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
|
||||
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
|
||||
const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account'
|
||||
const TYPE_PROJECT = 6;
|
||||
|
||||
/**
|
||||
* @var array ID mapping from type string
|
||||
@@ -64,6 +65,7 @@ class Categorie extends CommonObject
|
||||
'contact' => 4,
|
||||
'user' => 4,
|
||||
'account' => 5,
|
||||
'project' => 6,
|
||||
);
|
||||
/**
|
||||
* @var array Foreign keys mapping from type string
|
||||
@@ -78,6 +80,7 @@ class Categorie extends CommonObject
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Category tables mapping from type string
|
||||
@@ -92,6 +95,7 @@ class Categorie extends CommonObject
|
||||
'contact' => 'contact',
|
||||
'user' => 'user',
|
||||
'account' => 'account',
|
||||
'project' => 'project',
|
||||
);
|
||||
/**
|
||||
* @var array Object class mapping from type string
|
||||
@@ -106,6 +110,7 @@ class Categorie extends CommonObject
|
||||
'contact' => 'Contact',
|
||||
'user' => 'User',
|
||||
'account' => 'Account',
|
||||
'project' => 'Project',
|
||||
);
|
||||
/**
|
||||
* @var array Object table mapping from type string
|
||||
@@ -120,6 +125,7 @@ class Categorie extends CommonObject
|
||||
'contact' => 'socpeople',
|
||||
'user' => 'user',
|
||||
'account' => 'bank_account',
|
||||
'project' => 'projet',
|
||||
);
|
||||
|
||||
public $element='category';
|
||||
@@ -146,6 +152,7 @@ class Categorie extends CommonObject
|
||||
* @see Categorie::TYPE_CONTACT
|
||||
* @see Categorie::TYPE_USER
|
||||
* @see Categorie::TYPE_ACCOUNT
|
||||
* @see Categorie::TYPE_PROJECT
|
||||
*/
|
||||
var $type;
|
||||
|
||||
@@ -451,7 +458,7 @@ class Categorie extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
/* FIX #1317 : Check for child cat and move up 1 level*/
|
||||
/* FIX #1317 : Check for child category and move up 1 level*/
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."categorie";
|
||||
@@ -514,6 +521,18 @@ class Categorie extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_project";
|
||||
$sql .= " WHERE fk_categorie = ".$this->id;
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang";
|
||||
@@ -1029,11 +1048,11 @@ class Categorie extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Returns all categories
|
||||
* Returns all categories
|
||||
*
|
||||
* @param int $type Type of category
|
||||
* @param boolean $parent Just parent categories if true
|
||||
* @return array Table of Object Category
|
||||
* @return array Table of Object Category
|
||||
*/
|
||||
function get_all_categories($type=null, $parent=false)
|
||||
{
|
||||
@@ -1183,7 +1202,7 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($url == '')
|
||||
{
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$cat->id.'&type='.$cat->type.'" class="'.$forced_color .'">';
|
||||
@@ -1196,7 +1215,7 @@ class Categorie extends CommonObject
|
||||
}
|
||||
}
|
||||
$newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w));
|
||||
|
||||
|
||||
$ways[] = $newcategwithpath;
|
||||
}
|
||||
|
||||
@@ -1239,8 +1258,8 @@ class Categorie extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns in a table all possible paths to get to the category
|
||||
* starting with the major categories represented by Tables of categories
|
||||
* Returns in a table all possible paths to get to the category
|
||||
* starting with the major categories represented by Tables of categories
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -1415,7 +1434,7 @@ class Categorie extends CommonObject
|
||||
$b = hexdec($hex[4].$hex[5]);
|
||||
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
|
||||
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
|
||||
}
|
||||
}
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
|
||||
$linkend='</a>';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@@ -147,7 +147,7 @@ dol_fiche_head('');
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||
print $langs->trans("Ref").'</td>';
|
||||
print '<td><input type="text" size="25" id="label" name ="label" value="'.$object->label.'" />';
|
||||
print '</tr>';
|
||||
|
||||
@@ -54,6 +54,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea");
|
||||
else $title=$langs->trans("CategoriesArea");
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
|
||||
@@ -101,6 +101,7 @@ if ($object->id)
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@@ -140,7 +141,7 @@ if ($object->id)
|
||||
print $langs->trans("Color").'</td><td>';
|
||||
print $formother->showColor($object->color);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
||||
@@ -152,6 +152,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@@ -207,7 +208,7 @@ if ($action == 'edit')
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
@@ -115,6 +115,13 @@ if ($id > 0 && $removeelem > 0)
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'account';
|
||||
}
|
||||
else if ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$tmpobject = new Project($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'project';
|
||||
}
|
||||
|
||||
$result=$object->del_type($tmpobject,$elementtype);
|
||||
if ($result < 0) dol_print_error('',$object->error);
|
||||
@@ -169,7 +176,8 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory'
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
|
||||
llxHeader("","",$langs->trans("Categories"));
|
||||
$helpurl='';
|
||||
llxHeader("",$langs->trans("Categories"),$helpurl);
|
||||
|
||||
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
|
||||
@@ -177,6 +185,7 @@ elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCateg
|
||||
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
|
||||
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
|
||||
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
|
||||
else $title=$langs->trans("Category");
|
||||
|
||||
$head = categories_prepare_head($object,$type);
|
||||
@@ -359,6 +368,7 @@ if ($object->type == Categorie::TYPE_PRODUCT)
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$prod->id."'>";
|
||||
@@ -409,6 +419,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
@@ -463,6 +474,7 @@ if($object->type == Categorie::TYPE_CUSTOMER)
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$soc->id."'>";
|
||||
@@ -518,6 +530,7 @@ if ($object->type == Categorie::TYPE_MEMBER)
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$member->id."'>";
|
||||
@@ -570,6 +583,7 @@ if($object->type == Categorie::TYPE_CONTACT)
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$contact->id."'>";
|
||||
@@ -625,6 +639,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_ACCOUNT) $permission=$user->rights->banque->configurer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$account->id."'>";
|
||||
@@ -642,6 +657,61 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
|
||||
}
|
||||
}
|
||||
|
||||
// List of Project
|
||||
if ($object->type == Categorie::TYPE_PROJECT)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$projects = $object->getObjectsInCateg("project");
|
||||
if ($projects < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<br>";
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")."</td></tr>\n";
|
||||
|
||||
if (count($projects) > 0)
|
||||
{
|
||||
$var=true;
|
||||
foreach ($projects as $key => $project)
|
||||
{
|
||||
$var=!$var;
|
||||
print "\t<tr ".$bc[$var].">\n";
|
||||
print '<td class="nowrap" valign="top">';
|
||||
print $project->getNomUrl(1,0);
|
||||
print "</td>\n";
|
||||
print '<td valign="top">'.$project->ref."</td>\n";
|
||||
print '<td valign="top">'.$project->title."</td>\n";
|
||||
// Link to delete from category
|
||||
print '<td align="right">';
|
||||
$typeid=$object->type;
|
||||
$permission=0;
|
||||
if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
|
||||
if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
|
||||
if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
|
||||
if ($typeid == Categorie::TYPE_ACCOUNT) $permission=$user->rights->banque->configurer;
|
||||
if ($typeid == Categorie::TYPE_PROJECT) $permission=$user->rights->projet->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removeelem=".$project->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
print $langs->trans("DeleteFromCat")."</a>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProject").'</td></tr>';
|
||||
}
|
||||
print "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -513,7 +513,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " a.fk_contact, a.percent as percentage,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
|
||||
$sql.= " c.id as type_id, c.code as type_code, c.libelle,";
|
||||
$sql.= " c.id as type_id, c.code as type_code, c.libelle, c.color as type_color,";
|
||||
$sql.= " s.nom as socname,";
|
||||
$sql.= " u.firstname, u.lastname as lastname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a ";
|
||||
@@ -541,6 +541,7 @@ class ActionComm extends CommonObject
|
||||
// Properties of parent table llx_c_actioncomm (will be deprecated in future)
|
||||
$this->type_id = $obj->type_id;
|
||||
$this->type_code = $obj->type_code;
|
||||
$this->type_color = $obj->type_color;
|
||||
$transcode=$langs->trans("Action".$obj->type_code);
|
||||
$type_libelle=($transcode!="Action".$obj->type_code?$transcode:$obj->libelle);
|
||||
$this->type = $type_libelle;
|
||||
@@ -1109,7 +1110,11 @@ class ActionComm extends CommonObject
|
||||
if (! empty($this->location))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
$linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
$linkclose = ' style="background-color:#'.$this->type_color.'" class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
||||
else
|
||||
$linkclose = ' class="'.$classname.' classfortooltip" title="'.dol_escape_htmltag($tooltip, 1).'">';
|
||||
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
@@ -440,7 +440,7 @@ $sql.= ' a.percent,';
|
||||
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql.= ' a.fk_soc, a.fk_contact,';
|
||||
$sql.= ' ca.code as type_code, ca.libelle as type_label';
|
||||
$sql.= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
// We must filter on resource table
|
||||
@@ -531,6 +531,8 @@ if ($resql)
|
||||
|
||||
$event->type_code=$obj->type_code;
|
||||
$event->type_label=$obj->type_label;
|
||||
$event->type_color=$obj->type_color;
|
||||
|
||||
$event->libelle=$obj->label;
|
||||
$event->percentage=$obj->percent;
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
|
||||
@@ -71,7 +71,7 @@ if (! empty($conf->supplier_proposal->enabled)) $supplierproposalstatic=new Supp
|
||||
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
|
||||
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader("",$langs->trans("CommercialArea"));
|
||||
|
||||
print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');
|
||||
|
||||
@@ -118,7 +118,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -79,6 +79,7 @@ class Mailing extends CommonObject
|
||||
$this->statuts[2] = 'MailingStatusSentPartialy';
|
||||
$this->statuts[3] = 'MailingStatusSentCompletely';
|
||||
|
||||
$this->statut_dest[0] = 'MailingStatusNotSent';
|
||||
$this->statut_dest[-1] = 'MailingStatusError';
|
||||
$this->statut_dest[1] = 'MailingStatusSent';
|
||||
$this->statut_dest[2] = 'MailingStatusRead';
|
||||
|
||||
@@ -45,6 +45,19 @@ $sall=GETPOST("sall","alpha");
|
||||
$sref=GETPOST("sref","alpha");
|
||||
$filteremail=GETPOST('filteremail','alpha');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('mailinglist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('mailing');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'm.titre'=>'Ref',
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -107,6 +120,7 @@ if ($result)
|
||||
if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -120,8 +134,11 @@ if ($result)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
if (! $filteremail) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print "</td>";
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
@@ -172,6 +189,7 @@ if ($result)
|
||||
print $email->LibStatut($obj->statut,5);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ if (empty($reshook))
|
||||
|
||||
if ($socid < 1) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||
|
||||
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
}
|
||||
@@ -345,7 +345,7 @@ if (empty($reshook))
|
||||
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
|
||||
|
||||
// Multicurrency
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
@@ -718,7 +718,7 @@ if (empty($reshook))
|
||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
|
||||
|
||||
$pu_ht = $prod->price;
|
||||
$pu_ttc = $prod->price_ttc;
|
||||
$price_min = $prod->price_min;
|
||||
@@ -932,7 +932,7 @@ if (empty($reshook))
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
@@ -1082,7 +1082,7 @@ if (empty($reshook))
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
|
||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
// bank account
|
||||
@@ -1167,12 +1167,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1266,6 +1266,8 @@ if ($action == 'create')
|
||||
if ($origin != 'project' && $originid) {
|
||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
} elseif ($origin == 'project' && !empty($projectid)) {
|
||||
print '<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
}
|
||||
|
||||
dol_fiche_head();
|
||||
@@ -1432,11 +1434,11 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
@@ -1934,7 +1936,7 @@ if ($action == 'create')
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
@@ -2053,7 +2055,7 @@ if ($action == 'create')
|
||||
print '<td class="nowrap" colspan="2">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
|
||||
// Margin Infos
|
||||
if (! empty($conf->margin->enabled))
|
||||
if (! empty($conf->margin->enabled))
|
||||
{
|
||||
$rowspan=4;
|
||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++;
|
||||
@@ -2087,25 +2089,25 @@ if ($action == 'create')
|
||||
print '<tr><td height="10">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
// Multicurrency Amount HT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Statut
|
||||
print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||
|
||||
@@ -2394,7 +2396,7 @@ if ($action == 'create')
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom = 1;
|
||||
$liste = array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||
|
||||
@@ -738,30 +738,37 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
$objectstatic->id=$obj->rowid;
|
||||
$objectstatic->ref=$obj->ref;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$objectstatic->id=$obj->rowid;
|
||||
$objectstatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $objectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
// Warning
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
$warnornote='';
|
||||
if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
|
||||
if (! empty($obj->note_private))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
$warnornote.=($warnornote?' ':'');
|
||||
$warnornote.= '<span class="note">';
|
||||
$warnornote.= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
$warnornote.= '</span>';
|
||||
}
|
||||
if ($warnornote)
|
||||
{
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
print $warnornote;
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
// Other picto tool
|
||||
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
|
||||
@@ -100,8 +100,8 @@ if ($socid > 0)
|
||||
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '<form method="POST" action="remise.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
@@ -110,9 +110,9 @@ if ($socid > 0)
|
||||
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');
|
||||
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
@@ -138,9 +138,9 @@ if ($socid > 0)
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
if (! empty($backtopage))
|
||||
@@ -161,7 +161,8 @@ if ($socid > 0)
|
||||
$sql = "SELECT rc.rowid, rc.remise_client as remise_percent, rc.note, rc.datec as dc,";
|
||||
$sql.= " u.login, u.rowid as user_id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE rc.fk_soc =". $object->id;
|
||||
$sql.= " WHERE rc.fk_soc = " . $object->id;
|
||||
$sql.= " AND rc.entity = " . $conf->entity;
|
||||
$sql.= " AND u.rowid = rc.fk_user_author";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
|
||||
@@ -248,7 +248,8 @@ if ($socid > 0)
|
||||
$remise_all=$remise_user=0;
|
||||
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql.= " WHERE rc.fk_soc =". $object->id;
|
||||
$sql.= " WHERE rc.fk_soc = " . $object->id;
|
||||
$sql.= " AND rc.entity = " . $conf->entity;
|
||||
$sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
|
||||
$sql.= " GROUP BY rc.fk_user";
|
||||
$resql=$db->query($sql);
|
||||
@@ -327,7 +328,8 @@ if ($socid > 0)
|
||||
$sql.= " fa.facnumber as ref, fa.type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
|
||||
$sql.= " WHERE rc.fk_soc =". $object->id;
|
||||
$sql.= " WHERE rc.fk_soc = " . $object->id;
|
||||
$sql.= " AND rc.entity = " . $conf->entity;
|
||||
$sql.= " AND u.rowid = rc.fk_user";
|
||||
$sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
@@ -262,14 +262,14 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
if (! $error)
|
||||
{
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if (! empty($origin) && ! empty($originid))
|
||||
{
|
||||
@@ -376,13 +376,38 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Hooks
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $object->origin;
|
||||
$originidforcontact = $object->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
$originforcontact=$srcobject->origin;
|
||||
$originidforcontact=$srcobject->origin_id;
|
||||
}
|
||||
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error++;
|
||||
|
||||
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
@@ -450,12 +475,12 @@ if (empty($reshook))
|
||||
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||
{
|
||||
$ret=$object->classifyUnBilled();
|
||||
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Positionne ref commande client
|
||||
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
||||
$object->set_ref_client($user, GETPOST('ref_client'));
|
||||
@@ -500,7 +525,7 @@ if (empty($reshook))
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Multicurrency Code
|
||||
else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
@@ -508,9 +533,9 @@ if (empty($reshook))
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
|
||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
|
||||
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||
$result = $object->availability(GETPOST('availability_id'));
|
||||
if ($result < 0)
|
||||
@@ -1309,7 +1334,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$remise_absolue = 0;
|
||||
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
|
||||
if (! empty($origin) && ! empty($originid)) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $origin;
|
||||
@@ -1380,7 +1405,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||
}
|
||||
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
|
||||
@@ -1403,7 +1428,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$remise_absolue = 0;
|
||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
|
||||
$projectid = 0;
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private');
|
||||
@@ -1671,12 +1696,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1722,7 +1747,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</form>';
|
||||
|
||||
// Show origin lines
|
||||
@@ -1993,7 +2018,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Relative and absolute discounts
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
|
||||
@@ -2178,7 +2203,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td width="25%">';
|
||||
@@ -2244,8 +2269,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print ' / ';
|
||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
// Project
|
||||
@@ -2360,16 +2385,16 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Statut
|
||||
@@ -2488,7 +2513,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Create contract
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED)) {
|
||||
if ($conf->contrat->enabled && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_ACCEPTED || $object->statut == Commande::STATUS_CLOSED)) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
|
||||
@@ -95,11 +95,11 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='c.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='orderlist';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
@@ -594,7 +594,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
|
||||
@@ -52,6 +52,7 @@ $langs->load("salaries");
|
||||
$langs->load("loan");
|
||||
$langs->load("donations");
|
||||
$langs->load("trips");
|
||||
$langs->load("members");
|
||||
|
||||
$id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
|
||||
$ref = GETPOST('ref','alpha');
|
||||
@@ -177,8 +178,9 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->m
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("FinancialAccount").'-'.$langs->trans("Transactions"));
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Transactions");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$societestatic=new Societe($db);
|
||||
$userstatic=new User($db);
|
||||
@@ -366,16 +368,11 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
|
||||
{
|
||||
if (empty($conf->accounting->enabled))
|
||||
{
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&id='.$object->id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
if ($user->rights->banque->modifier) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&id='.$object->id.'&page='.$page.($vline?'&vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
} else {
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ else
|
||||
$year_end=$year_start+2;
|
||||
}
|
||||
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -249,7 +249,9 @@ if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation(
|
||||
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount") . " - " . $langs->trans("Card");
|
||||
$helpurl = "";
|
||||
llxHeader("",$title,$helpurl);
|
||||
|
||||
|
||||
// Creation
|
||||
@@ -507,7 +509,11 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></div>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("CreateAccount") . '">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
@@ -139,8 +139,9 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes') {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Documents");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -53,7 +53,9 @@ $error=0;
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("Graph");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ if ($result)
|
||||
print '</a>';
|
||||
}
|
||||
else if ($links[$key]['type']=='sc') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowSocialContribution'),'bill').' ';
|
||||
print $langs->trans("SocialContribution").($links[$key]['label']?' - '.$links[$key]['label']:'');
|
||||
print '</a>';
|
||||
|
||||
@@ -81,7 +81,9 @@ $pagenext = $page + 1;
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
$societestatic=new Societe($db);
|
||||
@@ -469,7 +471,7 @@ else
|
||||
$newline=0;
|
||||
}
|
||||
elseif ($links[$key]['type']=='sc') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$links[$key]['url_id'].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowBill'),'bill').' ';
|
||||
print $langs->trans("SocialContribution");
|
||||
print '</a>';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Vinícius Nogueira <viniciusvgn@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-cooncept.pro>
|
||||
@@ -42,11 +42,12 @@ $langs->load("margins");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque');
|
||||
|
||||
$search_ref=GETPOST('search_ref','int');
|
||||
$description=GETPOST("description",'alpha');
|
||||
$debit=GETPOST("debit",'alpha');
|
||||
$credit=GETPOST("credit",'alpha');
|
||||
$type=GETPOST("type",'alpha');
|
||||
$account=GETPOST("account",'alpha');
|
||||
$account=GETPOST("account",'int');
|
||||
$bid=GETPOST("bid","int");
|
||||
$search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int'));
|
||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||
@@ -64,28 +65,12 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='b.dateo';
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
if (!empty($type)) $param.='&type='.$type;
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$description="";
|
||||
$type="";
|
||||
@@ -93,6 +78,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$credit="";
|
||||
$account="";
|
||||
$bid="";
|
||||
$search_ref="";
|
||||
$search_req_nb='';
|
||||
$search_thirdparty='';
|
||||
$thirdparty='';
|
||||
@@ -127,29 +113,15 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
|
||||
$sql.= " WHERE b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
if ($search_req_nb)
|
||||
{
|
||||
$sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'";
|
||||
}
|
||||
if ($search_thirdparty)
|
||||
{
|
||||
$sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'";
|
||||
}
|
||||
if ($bid)
|
||||
{
|
||||
$sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
|
||||
}
|
||||
if (! empty($type))
|
||||
{
|
||||
$sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
}
|
||||
if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
|
||||
if ($account > 0) $sql.=" AND b.fk_account = ".$account;
|
||||
if ($search_req_nb) $sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'";
|
||||
if ($search_thirdparty) $sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'";
|
||||
if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
|
||||
if (! empty($type)) $sql.= " AND b.fk_type = '".$db->escape($type)."' ";
|
||||
// Search period criteria
|
||||
if (dol_strlen($search_dt_start)>0) {
|
||||
$sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||
}
|
||||
if (dol_strlen($search_dt_end)>0) {
|
||||
$sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
|
||||
}
|
||||
if (dol_strlen($search_dt_start)>0) $sql .= " AND b.dateo >= '" . $db->idate($search_dt_start) . "'";
|
||||
if (dol_strlen($search_dt_end)>0) $sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'";
|
||||
// Search criteria amount
|
||||
$debit = price2num(str_replace('-','',$debit));
|
||||
$credit = price2num(str_replace('-','',$credit));
|
||||
@@ -174,6 +146,23 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if (!empty($search_ref)) $param.='&search_ref='.$search_ref;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (!empty($description)) $param.='&description='.$description;
|
||||
if (!empty($type)) $param.='&type='.$type;
|
||||
if (!empty($debit)) $param.='&debit='.$debit;
|
||||
if (!empty($credit)) $param.='&credit='.$credit;
|
||||
if (!empty($account)) $param.='&account='.$account;
|
||||
if (!empty($bid)) $param.='&bid='.$bid;
|
||||
if (dol_strlen($search_dt_start) > 0)
|
||||
$param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int');
|
||||
if (dol_strlen($search_dt_end) > 0)
|
||||
$param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int');
|
||||
if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb"));
|
||||
if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty"));
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="search_form">'."\n";
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -199,10 +188,11 @@ if ($resql)
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('DateStart') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('DateStart') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1);
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
if ($moreforfilter)
|
||||
@@ -221,14 +211,16 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" name="search_ref" size="4" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
@@ -246,7 +238,9 @@ if ($resql)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">';
|
||||
$form->select_comptes($account,'account',0,'',1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
|
||||
@@ -55,7 +55,9 @@ $page=isset($_GET["page"])?$_GET["page"]:0;
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("PlannedTransactions");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
|
||||
$societestatic = new Societe($db);
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
@@ -179,8 +179,8 @@ print "</td>\n";
|
||||
print "<td>";
|
||||
$form->select_date((! empty($dateo)?$dateo:''),'','','','','add');
|
||||
print "</td>\n";
|
||||
print '<td><input name="label" class="flat" type="text" size="40" value="'.$label.'"></td>';
|
||||
print '<td><input name="amount" class="flat" type="text" size="8" value="'.$amount.'"></td>';
|
||||
print '<td><input name="label" class="flat quatrevingtpercent" type="text" value="'.$label.'"></td>';
|
||||
print '<td><input name="amount" class="flat" type="text" size="6" value="'.$amount.'"></td>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
@@ -45,6 +46,8 @@ $year=GETPOST("year",'int');
|
||||
$filtre=GETPOST("filtre",'alpha');
|
||||
if (! $year && $mode != 'sconly') { $year=date("Y", time()); }
|
||||
|
||||
$search_account = GETPOST('search_account','int');
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@@ -65,6 +68,7 @@ $tva_static = new Tva($db);
|
||||
$socialcontrib=new ChargeSociales($db);
|
||||
$payment_sc_static=new PaymentSocialContribution($db);
|
||||
$sal_static = new PaymentSalary($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
llxHeader('',$langs->trans("SpecialExpensesArea"));
|
||||
|
||||
@@ -122,17 +126,21 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT c.id, c.libelle as lib,";
|
||||
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment,";
|
||||
$sql.= " pct.code as payment_code";
|
||||
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
|
||||
$sql.= " pct.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE cs.fk_type = c.id";
|
||||
$sql.= " AND cs.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
@@ -189,6 +197,20 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print '<td>';
|
||||
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
print $obj->num_payment.'</td>';
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Paid
|
||||
print '<td align="right">';
|
||||
if ($obj->totalpaye) print price($obj->totalpaye);
|
||||
@@ -205,6 +227,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
if (! empty($conf->banque->enabled)) print '<td></td>';
|
||||
print '<td align="right" class="liste_total">'.price($totalpaye)."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
@@ -280,8 +303,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
@@ -349,7 +371,6 @@ while($j<$numlt)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@@ -367,8 +388,6 @@ while($j<$numlt)
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
@@ -380,10 +399,7 @@ while($j<$numlt)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<tr class="liste_total"><td align="right" colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
@@ -431,7 +447,6 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
@@ -450,8 +465,6 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.($obj->salary?price($obj->salary):'')."</td>";
|
||||
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
@@ -463,10 +476,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right"></td>'; // A total here has no sense
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
@@ -282,9 +282,9 @@ if (empty($reshook))
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
|
||||
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@@ -312,7 +312,7 @@ if (empty($reshook))
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@@ -705,7 +705,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
|
||||
if (! $error) {
|
||||
// This is a replacement invoice
|
||||
$result = $object->fetch($_POST['fac_replacement']);
|
||||
@@ -758,7 +758,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
@@ -780,7 +780,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||
$object->type = Facture::TYPE_CREDIT_NOTE;
|
||||
@@ -867,7 +867,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->socid = GETPOST('socid','int');
|
||||
@@ -891,7 +891,7 @@ if (empty($reshook))
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
|
||||
|
||||
// Source facture
|
||||
$object->fac_rec = GETPOST('fac_rec');
|
||||
|
||||
@@ -917,7 +917,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Si facture standard
|
||||
@@ -1176,7 +1176,32 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now we create same links to contact than the ones found on origin object
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $object->origin;
|
||||
$originidforcontact = $object->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
$originforcontact=$srcobject->origin;
|
||||
$originidforcontact=$srcobject->origin_id;
|
||||
}
|
||||
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
|
||||
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
// Hooks
|
||||
$parameters = array('objFrom' => $srcobject);
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
@@ -1186,7 +1211,7 @@ if (empty($reshook))
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
@@ -1218,7 +1243,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
|
||||
|
||||
if (!($_POST['situations'] > 0)) {
|
||||
$error++;
|
||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||
@@ -1233,8 +1258,8 @@ if (empty($reshook))
|
||||
{
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $originid;
|
||||
|
||||
foreach ($object->lines as &$line)
|
||||
|
||||
foreach ($object->lines as &$line)
|
||||
{
|
||||
$line->origin = $object->origin;
|
||||
$line->origin_id = $line->id;
|
||||
@@ -1580,7 +1605,7 @@ if (empty($reshook))
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$qty = GETPOST('qty');
|
||||
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
@@ -1765,7 +1790,7 @@ if (empty($reshook))
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
|
||||
|
||||
if ($action == 'update_extras') {
|
||||
// Fill array 'array_options' with data from add form
|
||||
@@ -1855,7 +1880,9 @@ if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
llxHeader('', $langs->trans('InvoiceCustomer'), 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Card');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
|
||||
// Mode creation
|
||||
@@ -1872,7 +1899,7 @@ if ($action == 'create')
|
||||
$res = $soc->fetch($socid);
|
||||
|
||||
$currency_code = $conf->currency;
|
||||
|
||||
|
||||
// Load objectsrc
|
||||
$remise_absolue = 0;
|
||||
|
||||
@@ -1944,9 +1971,9 @@ if ($action == 'create')
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||
}
|
||||
|
||||
|
||||
// Replicate extrafields
|
||||
$objectsrc->fetch_optionals($originid);
|
||||
$object->array_options = $objectsrc->array_options;
|
||||
@@ -1960,7 +1987,7 @@ if ($action == 'create')
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||
}
|
||||
|
||||
@@ -1986,7 +2013,7 @@ if ($action == 'create')
|
||||
}
|
||||
print info_admin($text, 0, 0, 0).'<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@@ -1997,7 +2024,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
||||
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
@@ -2051,7 +2078,7 @@ if ($action == 'create')
|
||||
{
|
||||
$invoice_predefined = new FactureRec($db);
|
||||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||
|
||||
|
||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
@@ -2158,31 +2185,34 @@ if ($action == 'create')
|
||||
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||
{
|
||||
// Deposit
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#typedeposit, #valuedeposit").click(function() {
|
||||
jQuery("#radio_deposit").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
print $desc;
|
||||
print '</td>';
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div></div>';
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#typedeposit, #valuedeposit").click(function() {
|
||||
jQuery("#radio_deposit").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
print $desc;
|
||||
print '</td>';
|
||||
if (($origin == 'propal') || ($origin == 'commande'))
|
||||
{
|
||||
print '<td class="nowrap" style="padding-left: 5px">';
|
||||
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
|
||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($socid > 0)
|
||||
@@ -2212,32 +2242,36 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Replacement
|
||||
print '<!-- replacement line --><div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||
if (! $options) $tmp.=' disabled';
|
||||
$tmp.='> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#fac_replacement").change(function() {
|
||||
jQuery("#radio_replacement").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
|
||||
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||
if (! $options)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($options) {
|
||||
$text .= '<option value="-1"> </option>';
|
||||
$text .= $options;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
{
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
|
||||
if (! $options) $tmp.=' disabled';
|
||||
$tmp.='> ';
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#fac_replacement").change(function() {
|
||||
jQuery("#radio_replacement").prop("checked", true);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->trans("InvoiceReplacementAsk") . ' ';
|
||||
$text .= '<select class="flat" name="fac_replacement" id="fac_replacement"';
|
||||
if (! $options)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($options) {
|
||||
$text .= '<option value="-1"> </option>';
|
||||
$text .= $options;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoReplacableInvoice") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2254,48 +2288,51 @@ if ($action == 'create')
|
||||
{
|
||||
if ($socid > 0)
|
||||
{
|
||||
// Credit note
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
if (! $optionsav) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
// Show credit note options only if we checked credit note
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
if (! jQuery("#radio_creditnote").is(":checked"))
|
||||
{
|
||||
jQuery("#credit_note_options").hide();
|
||||
}
|
||||
jQuery("#radio_creditnote").click(function() {
|
||||
jQuery("#credit_note_options").show();
|
||||
});
|
||||
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
||||
jQuery("#credit_note_options").hide();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
|
||||
// $text.='<input type="text" value="">';
|
||||
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
|
||||
if (! $optionsav)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($optionsav) {
|
||||
$text .= '<option value="-1"></option>';
|
||||
$text .= $optionsav;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
// Credit note
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
if (! $optionsav) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
// Show credit note options only if we checked credit note
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
if (! jQuery("#radio_creditnote").is(":checked"))
|
||||
{
|
||||
jQuery("#credit_note_options").hide();
|
||||
}
|
||||
jQuery("#radio_creditnote").click(function() {
|
||||
jQuery("#credit_note_options").show();
|
||||
});
|
||||
jQuery("#radio_standard, #radio_replacement, #radio_deposit").click(function() {
|
||||
jQuery("#credit_note_options").hide();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$text = $tmp.$langs->transnoentities("InvoiceAvoirAsk") . ' ';
|
||||
// $text.='<input type="text" value="">';
|
||||
$text .= '<select class="flat" name="fac_avoir" id="fac_avoir"';
|
||||
if (! $optionsav)
|
||||
$text .= ' disabled';
|
||||
$text .= '>';
|
||||
if ($optionsav) {
|
||||
$text .= '<option value="-1"></option>';
|
||||
$text .= $optionsav;
|
||||
} else {
|
||||
$text .= '<option value="-1">' . $langs->trans("NoInvoiceToCorrect") . '</option>';
|
||||
}
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2317,7 +2354,7 @@ if ($action == 'create')
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</td></tr>';
|
||||
@@ -2343,7 +2380,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans('DateInvoice') . '</td><td colspan="2">';
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
|
||||
print '</td></tr>';
|
||||
@@ -2356,7 +2393,7 @@ if ($action == 'create')
|
||||
print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
@@ -2421,7 +2458,7 @@ if ($action == 'create')
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
@@ -2504,7 +2541,7 @@ if ($action == 'create')
|
||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||
}
|
||||
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||
@@ -3030,7 +3067,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Date invoice
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinvoicedate&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
@@ -3069,13 +3106,13 @@ else if ($id > 0 || ! empty($ref))
|
||||
$nbrows ++;
|
||||
if (! empty($conf->multicurrency->enabled)) $nbrows+=5;
|
||||
if (! empty($conf->incoterm->enabled)) $nbrows+=1;
|
||||
|
||||
|
||||
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
||||
|
||||
if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0)
|
||||
{
|
||||
//List of previous invoices
|
||||
@@ -3088,7 +3125,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$total_prev_ht = $total_prev_ttc = 0;
|
||||
$var = true;
|
||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice)
|
||||
@@ -3105,10 +3142,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">'.$prev_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td colspan="2" align="right"></td>';
|
||||
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
|
||||
@@ -3116,7 +3153,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
if (count($object->tab_next_situation_invoice) > 0)
|
||||
{
|
||||
//List of next invoices
|
||||
@@ -3129,9 +3166,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
|
||||
$var = true;
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice)
|
||||
{
|
||||
@@ -3147,10 +3184,10 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td colspan="2" align="right"></td>';
|
||||
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
|
||||
@@ -3158,7 +3195,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '</table>';
|
||||
}
|
||||
|
||||
@@ -3385,7 +3422,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print dol_print_date($object->date_pointoftax, 'daytext');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
print '<tr><td>';
|
||||
@@ -3470,7 +3507,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
@@ -3611,16 +3648,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount VAT
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Multicurrency Amount TTC
|
||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Statut
|
||||
@@ -3919,7 +3956,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
|
||||
|
||||
|
||||
if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
if ($totalpaye > 0 || $totalcreditnotes > 0)
|
||||
@@ -3931,11 +3968,11 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ( empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED))
|
||||
{
|
||||
if ($objectidnext)
|
||||
if ($objectidnext)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ClassifyCanceled') . '</span></div>';
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=canceled">' . $langs->trans('ClassifyCanceled') . '</a></div>';
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ $result = restrictedArea($user, 'facture', $id);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('',$langs->trans("Bill"),'Facture');
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Preview');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@@ -83,7 +85,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td><td colspan="5">';
|
||||
$morehtmlref = '';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
@@ -238,7 +240,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Dates
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
print '<tr><td>'.$langs->trans("DateInvoice").'</td>';
|
||||
print '<td>'.dol_print_date($object->date,"daytext").'</td>';
|
||||
|
||||
// Right part with $rowspan lines
|
||||
|
||||
@@ -1738,7 +1738,7 @@ class Facture extends CommonInvoice
|
||||
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_paid($user,$close_code='',$close_note='')
|
||||
function set_paid($user, $close_code='', $close_note='')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
@@ -114,7 +114,9 @@ else if ($action == 'deletecontact' && $user->rights->facture->creer)
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("InvoiceCustomer"));
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('ContactsAddresses');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
@@ -163,7 +165,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref customer
|
||||
print '<tr><td>';
|
||||
print '<tr><td >';
|
||||
print $langs->trans('RefCustomer');
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
|
||||
@@ -82,7 +82,9 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("InvoiceCustomer"));
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Documents');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@@ -128,6 +128,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
if (GETPOST('cancel')) $action='';
|
||||
|
||||
// Create predefined invoice
|
||||
if ($action == 'add')
|
||||
{
|
||||
@@ -266,6 +268,16 @@ elseif ($action == 'classin' && $user->rights->facture->creer)
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
// Set bank account
|
||||
elseif ($action == 'setref' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->titre = GETPOST('ref', 'alpha');
|
||||
$object->ref = $object->titre;
|
||||
}
|
||||
}
|
||||
// Set bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@@ -840,15 +852,15 @@ if ($action == 'create')
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Title
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.$_POST["titre"].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.$_POST["titre"].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note public
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
print '<textarea class="flat centpercent" name="note_public" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
@@ -950,176 +962,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
$sql = 'SELECT l.fk_product, l.product_type, l.label as custom_label, l.description, l.qty, l.rowid, l.tva_tx,';
|
||||
$sql.= ' l.fk_remise_except,';
|
||||
$sql.= ' l.remise_percent, l.subprice, l.info_bits,';
|
||||
$sql.= ' l.total_ht, l.total_tva as total_vat, l.total_ttc,';
|
||||
$sql.= ' l.date_start,';
|
||||
$sql.= ' l.date_end,';
|
||||
$sql.= ' l.product_type,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' p.ref, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
||||
$sql.= " WHERE l.fk_facture = ".$object->id;
|
||||
$sql.= " ORDER BY l.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td width="8%" align="left">'.$langs->trans("Unit").'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans("ReductionShort").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">'.$langs->trans("CurrentProductPrice").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$product = New Product($db);
|
||||
$product->fetch($objp->fk_product);
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show product and description
|
||||
$type=(isset($objp->product_type)?$objp->product_type:$objp->fk_product_type);
|
||||
$product_static->fk_unit=$objp->fk_unit;
|
||||
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// Show product and description
|
||||
$product_static->fetch($objp->fk_product); // We need all information later
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.(! empty($objp->custom_label)?$objp->custom_label:$objp->product_label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($objp->custom_label)) {
|
||||
|
||||
$text.= ' <strong>'.$objp->custom_label.'</strong>';
|
||||
print $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i);
|
||||
|
||||
} else {
|
||||
|
||||
print $text.' '.nl2br($objp->description);
|
||||
}
|
||||
|
||||
// Show range
|
||||
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
|
||||
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// Vat rate
|
||||
print '<td align="center">'.vatrate($objp->tva_tx).'%</td>';
|
||||
|
||||
// Qty
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td align="left">'.$product_static->getLabelOfUnit().'</td>';
|
||||
}
|
||||
|
||||
// Percent
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Total HT
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($objp->total_vat)."</td>\n";
|
||||
|
||||
// Total TTC
|
||||
print '<td align="right">'.price($objp->total_ttc)."</td>\n";
|
||||
|
||||
// Total Unit price
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
|
||||
// Current price of product
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$flag_price_may_change++;
|
||||
$prodprice=$product_static->price; // price HT
|
||||
print '<td align="right">'.price($prodprice)."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
*/
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if ($flag_price_may_change)
|
||||
@@ -1159,7 +1002,7 @@ else
|
||||
if ($action == 'ask_deleteline') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||
}
|
||||
|
||||
|
||||
print $formconfirm;
|
||||
|
||||
$author = new User($db);
|
||||
@@ -1178,20 +1021,13 @@ else
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/fiche-rec.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>';
|
||||
print '<td colspan="5">';
|
||||
$morehtmlref = '';
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
if ($result > 0) {
|
||||
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
|
||||
}
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $discount->error);
|
||||
}*/
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'titre', $morehtmlref);
|
||||
print '<tr><td class="titlefield">';
|
||||
//print $langs->trans('Ref');
|
||||
print $form->editfieldkey($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer);
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$morehtmlref = $form->editfieldval($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer, 'string');
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@@ -1324,7 +1160,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td width="20%">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Frequency');
|
||||
print '</td>';
|
||||
@@ -1427,7 +1263,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Nb of generation already done
|
||||
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<td>';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||
print '</td>';
|
||||
@@ -1807,7 +1643,7 @@ else
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else print '<tr '.$bc[false].'><td colspan="9">'.$langs->trans("NoneF").'</td></tr>';
|
||||
else print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoneF").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
|
||||
@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
|
||||
@@ -35,7 +36,9 @@ $langs->load("bills");
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("InvoiceCustomer"));
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$fac = new Facture($db);
|
||||
$fac->fetch($_GET["facid"]);
|
||||
|
||||
@@ -60,7 +60,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("InvoiceCustomer"));
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Notes');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
@@ -106,7 +106,9 @@ if ($action == "delete")
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('', $langs->trans("InvoiceCustomer"));
|
||||
$title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('StandingOrders');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@@ -290,7 +292,7 @@ if ($object->id > 0)
|
||||
// Date invoice
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editinvoicedate&id='.$object->id.'">'.img_edit($langs->trans('SetDate'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
|
||||
@@ -117,7 +117,7 @@ if (count($listofsearchfields))
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
|
||||
@@ -230,7 +230,7 @@ foreach ($tabfac as $key => $val)
|
||||
if (isset($line['nomtcheck']) || $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
print "<td>".dol_print_date($val["date"])."</td>";
|
||||
print "<td>".dol_print_date($db->jdate($val["date"]))."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$line['label']."</td>";
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ foreach ($tabfac as $key => $val)
|
||||
if (isset($line['nomtcheck']) || $mt)
|
||||
{
|
||||
print "<tr ".$bc[$var]." >";
|
||||
print "<td>".dol_print_date($val["date"])."</td>";
|
||||
print "<td>".dol_print_date($db->jdate($val["date"]))."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$line['label']."</td>";
|
||||
|
||||
|
||||
@@ -229,7 +229,10 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
|
||||
|
||||
@@ -260,9 +263,12 @@ if ($resql)
|
||||
print '<td align="left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
||||
print '</td>';
|
||||
@@ -309,16 +315,21 @@ if ($resql)
|
||||
|
||||
// Payment number
|
||||
print '<td>'.$objp->num_paiement.'</td>';
|
||||
|
||||
print '<td>';
|
||||
if ($objp->bid)
|
||||
{
|
||||
$accountstatic->id=$objp->bid;
|
||||
$accountstatic->label=$objp->label;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($objp->bid)
|
||||
{
|
||||
$accountstatic->id=$objp->bid;
|
||||
$accountstatic->label=$objp->label;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
print '<td align="right">'.price($objp->amount).'</td>';
|
||||
|
||||
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
||||
|
||||
@@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$chid=GETPOST("id");
|
||||
$action=GETPOST('action');
|
||||
$chid=GETPOST("id", 'int');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$amounts = array();
|
||||
|
||||
// Security check
|
||||
@@ -45,13 +45,13 @@ if ($user->societe_id > 0)
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'add_payment')
|
||||
if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
|
||||
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
|
||||
header("Location: ".$loc);
|
||||
exit;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ if ($action == 'add_payment')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paymentid = $paiement->create($user);
|
||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
||||
if ($paymentid < 0)
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
@@ -130,7 +130,7 @@ if ($action == 'add_payment')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
|
||||
$loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ $form=new Form($db);
|
||||
|
||||
|
||||
// Formulaire de creation d'un paiement de charge
|
||||
if ($_GET["action"] == 'create')
|
||||
if ($action == 'create')
|
||||
{
|
||||
|
||||
$charge = new ChargeSociales($db);
|
||||
@@ -185,7 +185,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("SocialContribution")."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
||||
@@ -317,8 +317,9 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
// Bouton Save payment
|
||||
print '<br><div class="center"><input type="checkbox" checked name="closepaidcontrib"> '.$langs->trans("ClosePaidContributionsAutomatically");
|
||||
print '<br><input type="submit" class="button" name="save" value="'.$langs->trans('ToMakePayment').'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
@@ -65,7 +65,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header("Location: ".DOL_URL_ROOT."/compta/charges/index.php?mode=sconly");
|
||||
header("Location: ".DOL_URL_ROOT."/compta/sociales/payments.php?mode=sconly");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@@ -162,25 +162,25 @@ if ($action == 'valide')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($paiement,'id','',1,'rowid','id');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td valign="top" width="120">'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'.dol_print_date($paiement->datep,'day').'</td></tr>';
|
||||
|
||||
// Mode
|
||||
print '<tr><td valign="top">'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$paiement->type_code).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Mode').'</td><td colspan="3">'.$langs->trans("PaymentType".$paiement->type_code).'</td></tr>';
|
||||
|
||||
// Numero
|
||||
print '<tr><td valign="top">'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td colspan="3">'.$paiement->num_paiement.'</td></tr>';
|
||||
|
||||
// Montant
|
||||
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3">'.nl2br($paiement->note).'</td></tr>';
|
||||
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
@@ -278,7 +278,7 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/class/bonprelevement.class.php
|
||||
* \ingroup prelevement
|
||||
* \brief Fichier de la classe des bons de prelevements
|
||||
* \brief File of withdrawal receipts class
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
@@ -103,11 +104,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Add facture to withdrawal
|
||||
* Add invoice to withdrawal
|
||||
*
|
||||
* @param int $facture_id id invoice to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom name of cliente
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
* @param string $code_banque code of bank withdrawal
|
||||
* @param string $code_guichet code of bank's office
|
||||
@@ -165,7 +166,7 @@ class BonPrelevement extends CommonObject
|
||||
*
|
||||
* @param int $line_id id line to add
|
||||
* @param int $client_id id invoice customer
|
||||
* @param string $client_nom name of cliente
|
||||
* @param string $client_nom customer name
|
||||
* @param int $amount amount of invoice
|
||||
* @param string $code_banque code of bank withdrawal
|
||||
* @param string $code_guichet code of bank's office
|
||||
@@ -181,7 +182,7 @@ class BonPrelevement extends CommonObject
|
||||
if ($concat == 1)
|
||||
{
|
||||
/*
|
||||
* On aggrege les lignes
|
||||
* We aggregate the lines
|
||||
*/
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
@@ -204,7 +205,7 @@ class BonPrelevement extends CommonObject
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Pas de d'agregation
|
||||
* No aggregate
|
||||
*/
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
|
||||
$sql.= "fk_prelevement_bons";
|
||||
@@ -375,7 +376,7 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* Fin de la procedure
|
||||
* End of procedure
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
@@ -477,7 +478,7 @@ class BonPrelevement extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Update prelevement line
|
||||
// Update withdrawal line
|
||||
// TODO: Translate to ligneprelevement.class.php
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
|
||||
$sql.= " SET statut = 2";
|
||||
@@ -604,8 +605,8 @@ class BonPrelevement extends CommonObject
|
||||
$arr = array();
|
||||
|
||||
/*
|
||||
* Renvoie toutes les factures presente
|
||||
* dans un bon de prelevement
|
||||
* Returns all invoices presented
|
||||
* within a withdrawal receipt
|
||||
*/
|
||||
$sql = "SELECT fk_facture";
|
||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||
@@ -1015,15 +1016,21 @@ class BonPrelevement extends CommonObject
|
||||
$this->date_echeance = $datetimeprev;
|
||||
$this->reference_remise = $ref;
|
||||
|
||||
$this->raison_sociale = $conf->global->PRELEVEMENT_RAISON_SOCIALE;
|
||||
$id=$conf->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||
$account = new Account($this->db);
|
||||
if ($account->fetch($id)>0)
|
||||
{
|
||||
$this->emetteur_code_banque = $account->code_banque;
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
$this->emetteur_code_banque = $conf->global->PRELEVEMENT_CODE_BANQUE;
|
||||
$this->emetteur_code_guichet = $conf->global->PRELEVEMENT_CODE_GUICHET;
|
||||
$this->emetteur_numero_compte = $conf->global->PRELEVEMENT_NUMERO_COMPTE;
|
||||
$this->emetteur_number_key = $conf->global->PRELEVEMENT_NUMBER_KEY;
|
||||
$this->emetteur_iban = $conf->global->PRELEVEMENT_IBAN;
|
||||
$this->emetteur_bic = $conf->global->PRELEVEMENT_BIC;
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
$this->factures = $factures_prev_id;
|
||||
|
||||
@@ -1673,13 +1680,31 @@ class BonPrelevement extends CommonObject
|
||||
* @return string String with SEPA Sender
|
||||
*/
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||
{ // SEPA INITIALISATION
|
||||
global $confs;
|
||||
{
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
|
||||
$dateTime_YMD = dol_print_date($ladate, '%Y%m%d');
|
||||
$dateTime_ETAD = dol_print_date($ladate, '%Y-%m-%d');
|
||||
$dateTime_YMDHMS = dol_print_date($ladate, '%Y-%m-%dT%H:%M:%S');
|
||||
|
||||
// Get data of bank account
|
||||
$id=$configuration->global->PRELEVEMENT_ID_BANKACCOUNT;
|
||||
$account = new Account($this->db);
|
||||
if ($account->fetch($id)>0)
|
||||
{
|
||||
$this->emetteur_code_banque = $account->code_banque;
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
// Récupération info demandeur
|
||||
$sql = "SELECT rowid, ref";
|
||||
$sql.= " FROM";
|
||||
@@ -1714,7 +1739,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.strtoupper(dol_string_unaccent($configuration->global->PRELEVEMENT_RAISON_SOCIALE)).'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.strtoupper(dol_string_unaccent($this->raison_sociale)).'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.strtoupper(dol_string_unaccent($configuration->global->MAIN_INFO_SOCIETE_ADDRESS)).'</AdrLine>'.$CrLf;
|
||||
@@ -1723,16 +1748,16 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </Cdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CdtrAcct>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $configuration->global->PRELEVEMENT_IBAN).'</IBAN>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrAcct>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CdtrAgt>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <FinInstnId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <BIC>'.$configuration->global->PRELEVEMENT_BIC.'</BIC>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf;
|
||||
/* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.$configuration->global->PRELEVEMENT_RAISON_SOCIALE.'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.$this->raison_sociale.'</Nm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.'</AdrLine>'.$CrLf;
|
||||
@@ -1744,7 +1769,7 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Othr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$configuration->global->PRELEVEMENT_ICS.'</Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf;
|
||||
|
||||
@@ -415,7 +415,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
/* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("salaries");
|
||||
@@ -40,6 +41,8 @@ $search_ref = GETPOST('search_ref','int');
|
||||
$search_user = GETPOST('search_user','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','int');
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
@@ -68,11 +71,12 @@ else
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
$search_amount="";
|
||||
$search_account='';
|
||||
$typeid="";
|
||||
}
|
||||
|
||||
@@ -85,12 +89,16 @@ llxHeader();
|
||||
$form = new Form($db);
|
||||
$salstatic = new PaymentSalary($db);
|
||||
$userstatic = new User($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc,";
|
||||
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment,";
|
||||
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.datev as datev, s.fk_typepayment as type, s.num_payment, s.fk_bank,";
|
||||
$sql.= " ba.rowid as bid, ba.label as blabel,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid = s.fk_user";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
@@ -100,6 +108,7 @@ if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
|
||||
if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email', 'u.note'), $search_user);
|
||||
if ($search_label) $sql.=natural_search(array('s.label'), $search_label);
|
||||
if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1);
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":","=",$filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
@@ -145,11 +154,11 @@ if ($result)
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.salary","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@@ -159,12 +168,10 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
// People
|
||||
// Employee
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="6" name="search_user" value="'.$search_user.'">';
|
||||
print '</td>';
|
||||
// Current salary
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Label
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
|
||||
// Date
|
||||
@@ -173,6 +180,13 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
||||
print '</td>';
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||
|
||||
@@ -200,17 +214,29 @@ if ($result)
|
||||
$salstatic->ref=$obj->rowid;
|
||||
// Ref
|
||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||
// User name
|
||||
// Employee
|
||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||
// Current salary
|
||||
print "<td>".($obj->salary?price($obj->salary):'')."</td>\n";
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
// Date payment
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
// Amount
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
print "<td></td>";
|
||||
print "</tr>\n";
|
||||
@@ -219,8 +245,10 @@ if ($result)
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td colspan="6" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
|
||||
$colspan=5;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total)."</td>";
|
||||
print "<td></td></tr>";
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/sociales/charges.php
|
||||
* \file htdocs/compta/sociales/card.php
|
||||
* \ingroup tax
|
||||
* \brief Social contribution card page
|
||||
*/
|
||||
@@ -382,7 +382,7 @@ if ($id > 0)
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print "<form name=\"charge\" action=\"charges.php?id=$object->id&action=update\" method=\"post\">";
|
||||
print "<form name=\"charge\" action=\"".$_SERVER["PHP_SELF"]."?id=$object->id&action=update\" method=\"post\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
}
|
||||
|
||||
@@ -585,13 +585,13 @@ if ($id > 0)
|
||||
// Reopen
|
||||
if ($object->paye && $user->rights->tax->charges->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/charges.php",1). "?id=$object->id&action=reopen\">".$langs->trans("ReOpen")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php",1). "?id=$object->id&action=reopen\">".$langs->trans("ReOpen")."</a>";
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($object->paye == 0 && $user->rights->tax->charges->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&action=edit\">".$langs->trans("Modify")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&action=edit\">".$langs->trans("Modify")."</a>";
|
||||
}
|
||||
|
||||
// Emit payment
|
||||
@@ -603,19 +603,19 @@ if ($id > 0)
|
||||
// Classify 'paid'
|
||||
if ($object->paye == 0 && round($resteapayer) <=0 && $user->rights->tax->charges->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&action=paid\">".$langs->trans("ClassifyPaid")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&action=paid\">".$langs->trans("ClassifyPaid")."</a>";
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->tax->charges->creer)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/charges.php",1). "?id=$object->id&action=clone\">".$langs->trans("ToClone")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".dol_buildpath("/compta/sociales/card.php",1). "?id=$object->id&action=clone\">".$langs->trans("ToClone")."</a>";
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->tax->charges->supprimer)
|
||||
{
|
||||
print "<a class=\"butActionDelete\" href=\"".DOL_URL_ROOT."/compta/sociales/charges.php?id=$object->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
print "<a class=\"butActionDelete\" href=\"".DOL_URL_ROOT."/compta/sociales/card.php?id=$object->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
@@ -449,7 +449,7 @@ class ChargeSociales extends CommonObject
|
||||
if (empty($this->ref)) $this->ref=$this->lib;
|
||||
$label = $langs->trans("ShowSocialContribution").': '.$this->ref;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' ');
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,10 +65,11 @@ class PaymentSocialContribution extends CommonObject
|
||||
* Create payment of social contribution into database.
|
||||
* Use this->amounts to have list of lines for the payment
|
||||
*
|
||||
* @param User $user User making payment
|
||||
* @return int <0 if KO, id of payment if OK
|
||||
* @param User $user User making payment
|
||||
* @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more
|
||||
* @return int <0 if KO, id of payment if OK
|
||||
*/
|
||||
function create($user)
|
||||
function create($user, $closepaidcontrib=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -75,7 +77,9 @@ class PaymentSocialContribution extends CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Validate parametres
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
|
||||
// Validate parametres
|
||||
if (! $this->datepaye)
|
||||
{
|
||||
$this->error='ErrorBadValueForParameterCreatePaymentSocialContrib';
|
||||
@@ -117,11 +121,40 @@ class PaymentSocialContribution extends CommonObject
|
||||
$sql.= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.",";
|
||||
$sql.= " 0)";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."paiementcharge");
|
||||
|
||||
// Insere tableau des montants / factures
|
||||
foreach ($this->amounts as $key => $amount)
|
||||
{
|
||||
$contribid = $key;
|
||||
if (is_numeric($amount) && $amount <> 0)
|
||||
{
|
||||
$amount = price2num($amount);
|
||||
|
||||
// If we want to closed payed invoices
|
||||
if ($closepaidcontrib)
|
||||
{
|
||||
|
||||
$contrib=new ChargeSociales($this->db);
|
||||
$contrib->fetch($contribid);
|
||||
$paiement = $contrib->getSommePaiement();
|
||||
//$creditnotes=$contrib->getSumCreditNotesUsed();
|
||||
$creditnotes=0;
|
||||
//$deposits=$contrib->getSumDepositsUsed();
|
||||
$deposits=0;
|
||||
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
|
||||
$remaintopay=price2num($contrib->amount - $paiement - $creditnotes - $deposits,'MT');
|
||||
if ($remaintopay == 0)
|
||||
{
|
||||
$result=$contrib->set_paid($user, '', '');
|
||||
}
|
||||
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
@@ -233,7 +233,7 @@ if ($resql)
|
||||
print '<td>'.dol_trunc($obj->libelle,42).'</td>';
|
||||
|
||||
// Type
|
||||
print '<td>'.dol_trunc($obj->type_lib,16).'</td>';
|
||||
print '<td>'.$obj->type_lib.'</td>';
|
||||
|
||||
// Date end period
|
||||
print '<td align="center">';
|
||||
|
||||
490
htdocs/compta/sociales/payments.php
Normal file
490
htdocs/compta/sociales/payments.php
Normal file
@@ -0,0 +1,490 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/sociales/payments.php
|
||||
* \ingroup compta
|
||||
* \brief Page to list payments of special expenses
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
|
||||
|
||||
$mode=GETPOST("mode",'alpha');
|
||||
$year=GETPOST("year",'int');
|
||||
$filtre=GETPOST("filtre",'alpha');
|
||||
if (! $year && $mode != 'sconly') { $year=date("Y", time()); }
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="pc.datep";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$tva_static = new Tva($db);
|
||||
$socialcontrib=new ChargeSociales($db);
|
||||
$payment_sc_static=new PaymentSocialContribution($db);
|
||||
$sal_static = new PaymentSalary($db);
|
||||
|
||||
llxHeader('',$langs->trans("SpecialExpensesArea"));
|
||||
|
||||
$title=$langs->trans("SpecialExpensesArea");
|
||||
if ($mode == 'sconly') $title=$langs->trans("SocialContributionsPayments");
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($mode == 'sconly') $param='&mode=sconly';
|
||||
if ($sortfield) $param.='&sortfield='.$sortfield;
|
||||
if ($sortorder) $param.='&sortorder='.$sortorder;
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
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="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
if ($mode != 'sconly')
|
||||
{
|
||||
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$center,$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$center,$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit);
|
||||
}
|
||||
|
||||
if ($year) $param.='&year='.$year;
|
||||
|
||||
if ($mode != 'sconly')
|
||||
{
|
||||
print $langs->trans("DescTaxAndDividendsArea").'<br>';
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
{
|
||||
// Social contributions only
|
||||
if ($mode != 'sconly')
|
||||
{
|
||||
print load_fiche_titre($langs->trans("SocialContributionsPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("LabelContrib"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("TypeContrib"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT c.id, c.libelle as lib,";
|
||||
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment,";
|
||||
$sql.= " pct.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id";
|
||||
$sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid";
|
||||
$sql.= " AND cs.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
{
|
||||
$sql .= " AND (";
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql .= " (cs.periode IS NOT NULL AND cs.periode between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= " OR (cs.periode IS NULL AND cs.date_ech between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
|
||||
$sql .= ")";
|
||||
}
|
||||
if (preg_match('/^cs\./',$sortfield) || preg_match('/^c\./',$sortfield) || preg_match('/^pc\./',$sortfield) || preg_match('/^pct\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
//$sql.= $db->plimit($limit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("compta/sociales/payments.php: select payment", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$total = 0;
|
||||
$totalnb = 0;
|
||||
$totalpaye = 0;
|
||||
$var=true;
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
// Ref payment
|
||||
$payment_sc_static->id=$obj->pid;
|
||||
$payment_sc_static->ref=$obj->pid;
|
||||
print '<td>'.$payment_sc_static->getNomUrl(1)."</td>\n";
|
||||
// Date payment
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day').'</td>';
|
||||
// Type payment
|
||||
print '<td>';
|
||||
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
print $obj->num_payment.'</td>';
|
||||
// Label
|
||||
print '<td>';
|
||||
$socialcontrib->id=$obj->rowid;
|
||||
$socialcontrib->ref=$obj->libelle;
|
||||
$socialcontrib->lib=$obj->libelle;
|
||||
print $socialcontrib->getNomUrl(1,'20');
|
||||
print '</td>';
|
||||
// Type
|
||||
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||
// Date
|
||||
$date=$obj->periode;
|
||||
if (empty($date)) $date=$obj->date_ech;
|
||||
print '<td>'.dol_print_date($date,'day').'</td>';
|
||||
// Expected to pay
|
||||
print '<td align="right">'.price($obj->total).'</td>';
|
||||
// Paid
|
||||
print '<td align="right">';
|
||||
if ($obj->totalpaye) print price($obj->totalpaye);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total = $total + $obj->total;
|
||||
$totalnb = $totalnb + $obj->nb;
|
||||
$totalpaye = $totalpaye + $obj->totalpaye;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right" class="liste_total"></td>'; // A total here has no sense
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="center" class="liste_total"> </td>';
|
||||
print '<td align="right" class="liste_total">'.price($totalpaye)."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
// VAT
|
||||
if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
{
|
||||
if (! $mode || $mode != 'sconly')
|
||||
{
|
||||
print "<br>";
|
||||
|
||||
$tva = new Tva($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||
$sql.= " WHERE pv.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if (preg_match('/^pv\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Localtax
|
||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
$j=1;
|
||||
$numlt=3;
|
||||
}
|
||||
elseif($mysoc->localtax1_assuj=="1")
|
||||
{
|
||||
$j=1;
|
||||
$numlt=2;
|
||||
}
|
||||
elseif($mysoc->localtax2_assuj=="1")
|
||||
{
|
||||
$j=2;
|
||||
$numlt=3;
|
||||
}
|
||||
else
|
||||
{
|
||||
$j=0;
|
||||
$numlt=0;
|
||||
}
|
||||
|
||||
while($j<$numlt)
|
||||
{
|
||||
if (! $mode || $mode != 'sconly')
|
||||
{
|
||||
print "<br>";
|
||||
|
||||
$tva = new Tva($db);
|
||||
|
||||
print load_fiche_titre($langs->transcountry(($j==1?"LT1Payments":"LT2Payments"),$mysoc->country_code).($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as pv";
|
||||
$sql.= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j ;
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
|
||||
$sql.= " AND pv.datev between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if (preg_match('/^pv/',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Ref payment
|
||||
$tva_static->id=$obj->rowid;
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
|
||||
// Payment Salary
|
||||
if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
{
|
||||
if (! $mode || $mode != 'sconly')
|
||||
{
|
||||
$sal = new PaymentSalary($db);
|
||||
|
||||
print "<br>";
|
||||
|
||||
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('user',1).")";
|
||||
$sql.= " AND u.rowid = s.fk_user";
|
||||
if ($year > 0)
|
||||
{
|
||||
$sql.= " AND (s.datesp between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " OR s.dateep between '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."')";
|
||||
}
|
||||
if (preg_match('/^s\./',$sortfield)) $sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$total = 0 ;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.($obj->salary?price($obj->salary):'')."</td>";
|
||||
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right"></td>'; // A total here has no sense
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
|
||||
print "<br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@@ -34,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
*
|
||||
@@ -266,19 +266,19 @@ if ($action == 'create')
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Account").'</td><td>';
|
||||
$form->select_comptes($_POST["accountid"],"accountid",0,"courant=1",1); // Affiche liste des comptes courant
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
}
|
||||
|
||||
// Type payment
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentMode").'</td><td>';
|
||||
$form->select_types_paiements(GETPOST("type_payment"), "type_payment");
|
||||
print "</td>\n";
|
||||
print "</tr>";
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '<td><input name="num_payment" type="text" value="'.GETPOST("num_payment").'"></td></tr>'."\n";
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@@ -365,8 +365,8 @@ if ($id)
|
||||
|
||||
|
||||
/*
|
||||
* Boutons d'actions
|
||||
*/
|
||||
* Action buttons
|
||||
*/
|
||||
print "<div class=\"tabsAction\">\n";
|
||||
if ($object->rappro == 0)
|
||||
{
|
||||
@@ -381,7 +381,7 @@ if ($id)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -123,17 +123,9 @@ print $langs->trans("VATReportBuildWithOptionDefinedInModule").'<br>';
|
||||
print '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td class="notopnoleft" width="50%">';
|
||||
print load_fiche_titre($langs->trans("VATSummary"), '', '');
|
||||
// The report mode is the one defined by defaut in tax module setup
|
||||
//print $modetax;
|
||||
//print '('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
|
||||
print '</td><td>';
|
||||
print load_fiche_titre($langs->trans("VATPaid"), '', '');
|
||||
print '</td></tr>';
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
print '<tr><td class="notopnoleft" width="50%" valign="top">';
|
||||
print load_fiche_titre($langs->trans("VATSummary"), '', '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -223,18 +215,12 @@ print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("To
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
/*}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureIsSupportedInInOutModeOnly").'</td></tr>';
|
||||
}*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</td>';
|
||||
print '<td class="notopnoleftnoright" valign="top" width="50%">';
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
print load_fiche_titre($langs->trans("VATPaid"), '', '');
|
||||
|
||||
/*
|
||||
* Payed
|
||||
@@ -250,10 +236,7 @@ $sql.= " GROUP BY dm ORDER BY dm ASC";
|
||||
pt($db, $sql,$langs->trans("Year")." $y");
|
||||
|
||||
|
||||
print "</td></tr></table>";
|
||||
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
@@ -40,6 +41,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
$search_ref = GETPOST('search_ref','int');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','int');
|
||||
$month = GETPOST("month","int");
|
||||
$year = GETPOST("year","int");
|
||||
|
||||
@@ -71,16 +73,18 @@ else
|
||||
$typeid=$_REQUEST['typeid'];
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref="";
|
||||
$search_label="";
|
||||
$search_amount="";
|
||||
$search_account='';
|
||||
$year="";
|
||||
$month="";
|
||||
$typeid="";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -90,14 +94,19 @@ llxHeader();
|
||||
$form = new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$tva_static = new Tva($db);
|
||||
$accountstatic = new Account($db);
|
||||
|
||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, pst.code as payment_code";
|
||||
$sql = "SELECT t.rowid, t.amount, t.label, t.datev as dv, t.datep as dp, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " WHERE t.entity = ".$conf->entity;
|
||||
if ($search_ref) $sql.=" AND t.rowid=".$search_ref;
|
||||
if ($search_label) $sql.=" AND t.label LIKE '%".$db->escape($search_label)."%'";
|
||||
if ($search_amount) $sql.=" AND t.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0)
|
||||
@@ -155,8 +164,9 @@ if ($result)
|
||||
print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -172,8 +182,14 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
|
||||
print '</td>';
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
|
||||
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
@@ -204,15 +220,32 @@ if ($result)
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'day')."</td>\n";
|
||||
// Type
|
||||
print $type;
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
// Amount
|
||||
$total = $total + $obj->amount;
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
print "<td> </td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("Total").'</td>';
|
||||
|
||||
$colspan=5;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
||||
print "<td> </td></tr>";
|
||||
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2006 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/compta/ventilation/card.php
|
||||
* \ingroup compta
|
||||
* \brief Page fiche ventilation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'ventil' && $user->rights->compta->ventilation->creer)
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql .= " SET fk_code_ventilation = ".$_POST["codeventil"];
|
||||
$sql .= " WHERE rowid = ".$_GET["id"];
|
||||
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
llxHeader("","","Fiche ventilation");
|
||||
|
||||
if ($cancel == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT rowid, numero, intitule";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux";
|
||||
$sql .= " ORDER BY numero ASC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($result);
|
||||
$cgs[$row[0]] = $row[1] . ' ' . $row[2];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Cr<43>ation
|
||||
*
|
||||
*/
|
||||
$form = new Form($db);
|
||||
$facture_static=new Facture($db);
|
||||
|
||||
if($_GET["id"])
|
||||
{
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,";
|
||||
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,";
|
||||
$sql .= " l.date_start as date_start, l.date_end as date_end,";
|
||||
$sql .= " l.fk_code_ventilation ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.rowid = ".$_GET["id"];
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
if ($num_lignes)
|
||||
{
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<form action="card.php?id='.$_GET["id"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre("Ventilation");
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref facture
|
||||
print '<tr><td>'.$langs->trans("Invoice").'</td>';
|
||||
$facture_static->ref=$objp->facnumber;
|
||||
$facture_static->id=$objp->facid;
|
||||
print '<td>'.$facture_static->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td width="20%">Ligne</td>';
|
||||
print '<td>'.nl2br($objp->description).'</td></tr>';
|
||||
print '<tr><td width="20%">Ventiler dans le compte :</td><td>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print $form->selectarray("codeventil",$cgs, $objp->fk_code_ventilation);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $cgs[$objp->fk_code_ventilation];
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<tr><td> </td><td><input type="submit" class="button" value="'.$langs->trans("Ventiler").'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error ID incorrect";
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,148 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.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/compta/ventilation/fournisseur/card.php
|
||||
* \ingroup compta
|
||||
* \brief Page fiche ventilation
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
|
||||
$mesg = '';
|
||||
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
|
||||
if ($_POST["action"] == 'ventil' && $user->rights->compta->ventilation->creer)
|
||||
{
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql .= " SET fk_code_ventilation = ".$_POST["codeventil"];
|
||||
$sql .= " WHERE rowid = ".$_GET["id"];
|
||||
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
llxHeader("","","Fiche ventilation");
|
||||
|
||||
if ($cancel == $langs->trans("Cancel"))
|
||||
{
|
||||
$action = '';
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT rowid, numero, intitule";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux";
|
||||
$sql .= " ORDER BY numero ASC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($result);
|
||||
$cgs[$row[0]] = $row[1] . ' ' . $row[2];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Creation
|
||||
*
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
if($_GET["id"])
|
||||
{
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ttc, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.rowid = ".$_GET["id"];
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
if ($num_lignes)
|
||||
{
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<form action="card.php?id='.$_GET["id"].'" method="post">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre("Ventilation");
|
||||
|
||||
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr><td>Facture</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td></tr>';
|
||||
|
||||
print '<tr><td width="20%">Ligne</td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td></tr>';
|
||||
print '<tr><td width="20%">Ventiler dans le compte :</td><td>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print $form->selectarray("codeventil",$cgs, $objp->fk_code_ventilation);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $cgs[$objp->fk_code_ventilation];
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if($objp->fk_code_ventilation == 0)
|
||||
{
|
||||
print '<tr><td> </td><td><input type="submit" value="'.$langs->trans("Ventiler").'"></td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Error ID incorrect";
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,105 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004 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/compta/ventilation/list.php
|
||||
* \ingroup compta
|
||||
* \brief Page de ventilation des lignes de facture
|
||||
*/
|
||||
|
||||
require '../../../main.inc.php';
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
if (!$user->rights->facture->lire) accessforbidden();
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
/*
|
||||
* Securite acces client
|
||||
*/
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
llxHeader('','Ventilation');
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
*
|
||||
*/
|
||||
$page = $_GET["page"];
|
||||
if ($page < 0) $page = 0;
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ttc as price, l.rowid, l.fk_code_ventilation ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND fk_code_ventilation = 0";
|
||||
$sql .= " ORDER BY l.rowid DESC ".$db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste("Lignes de facture à ventiler",$page,"list.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>Facture</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber.'</a></td>';
|
||||
print '<td>'.stripslashes(nl2br($objp->description)).'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right"><a href="card.php?id='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,129 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2006 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/compta/ventilation/list.php
|
||||
* \ingroup compta
|
||||
* \brief Page de ventilation des lignes de facture
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
|
||||
if (!$user->rights->facture->lire) accessforbidden();
|
||||
if (!$user->rights->compta->ventilation->creer) accessforbidden();
|
||||
|
||||
// Securite acces client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
llxHeader('','Ventilation');
|
||||
|
||||
/*
|
||||
* Lignes de factures
|
||||
*/
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND fk_code_ventilation = 0";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY l.rowid DESC ".$db->plimit($limit+1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num_lignes = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLinesToDispatch"),$page,"list.php","",$sortfield,$sortorder,'',$num_lignes);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Invoice").'</td>';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Montant").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$facture_static=new Facture($db);
|
||||
$product_static=new Product($db);
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num_lignes, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Ref facture
|
||||
$facture_static->ref=$objp->facnumber;
|
||||
$facture_static->id=$objp->facid;
|
||||
print '<td>'.$facture_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Ref produit
|
||||
$product_static->ref=$objp->product_ref;
|
||||
$product_static->id=$objp->product_id;
|
||||
$product_static->type=$objp->type;
|
||||
print '<td>';
|
||||
if ($product_static->id) print $product_static->getNomUrl(1);
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.dol_trunc($objp->product_label,24).'</td>';
|
||||
print '<td>'.nl2br(dol_trunc($objp->description,32)).'</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right"><a href="card.php?id='.$objp->rowid.'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@@ -529,10 +529,10 @@ else
|
||||
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%" class="fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
|
||||
print '<td width="30%"><input name="lastname" id="lastname" type="text" size="30" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname")?GETPOST("lastname"):$object->lastname).'" autofocus="autofocus"></td>';
|
||||
print '<td width="20%"><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
|
||||
print '<td width="30%"><input name="firstname" id="firstname"type="text" size="30" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname")?GETPOST("firstname"):$object->firstname).'"></td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
|
||||
print '<td><input name="lastname" id="lastname" type="text" size="30" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname")?GETPOST("lastname"):$object->lastname).'" autofocus="autofocus"></td>';
|
||||
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
|
||||
print '<td><input name="firstname" id="firstname"type="text" size="30" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname")?GETPOST("firstname"):$object->firstname).'"></td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
@@ -554,7 +554,7 @@ else
|
||||
}
|
||||
|
||||
// Civility
|
||||
print '<tr><td width="15%"><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOST("civility_id",'alpha')?GETPOST("civility_id",'alpha'):$object->civility_id);
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -783,10 +783,10 @@ else
|
||||
}
|
||||
|
||||
// Lastname
|
||||
print '<tr><td width="20%" class="fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
|
||||
print '<td width="30%"><input name="lastname" id="lastname" type="text" size="20" maxlength="80" value="'.(isset($_POST["lastname"])?$_POST["lastname"]:$object->lastname).'" autofocus="autofocus"></td>';
|
||||
print '<td width="20%"><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
|
||||
print '<td width="30%"><input name="firstname" id="firstname" type="text" size="20" maxlength="80" value="'.(isset($_POST["firstname"])?$_POST["firstname"]:$object->firstname).'"></td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
|
||||
print '<td><input name="lastname" id="lastname" type="text" size="20" maxlength="80" value="'.(isset($_POST["lastname"])?$_POST["lastname"]:$object->lastname).'" autofocus="autofocus"></td>';
|
||||
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
|
||||
print '<td><input name="firstname" id="firstname" type="text" size="20" maxlength="80" value="'.(isset($_POST["firstname"])?$_POST["firstname"]:$object->firstname).'"></td></tr>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
@@ -890,7 +890,7 @@ else
|
||||
print $form->selectarray('priv',$selectarray,$object->priv,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note Public
|
||||
// Note Public
|
||||
print '<tr><td class="tdtop"><label for="note_public">'.$langs->trans("NotePublic").'</label></td><td colspan="3">';
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
@@ -902,7 +902,7 @@ else
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $object->getLibStatut(4);
|
||||
@@ -1058,7 +1058,7 @@ else
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($object->socid > 0)
|
||||
{
|
||||
$objsoc->fetch($object->socid);
|
||||
@@ -1074,7 +1074,7 @@ else
|
||||
print '</tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td>';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
@@ -1122,7 +1122,7 @@ else
|
||||
|
||||
// Categories
|
||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans("Categories") . '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showCategories( $object->id, 'contact', 1 );
|
||||
print '</td></tr>';
|
||||
@@ -1141,7 +1141,7 @@ else
|
||||
|
||||
if (! empty($conf->propal->enabled))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("ContactForProposals").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ContactForProposals").'</td><td colspan="3">';
|
||||
print $object->ref_propal?$object->ref_propal:$langs->trans("NoContactForAnyProposal");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -554,8 +554,6 @@ class Contact extends CommonObject
|
||||
$this->db->rollback();
|
||||
return -$error;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -151,12 +151,12 @@ if ($action == 'edit')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $object->id;
|
||||
print '</td>';
|
||||
|
||||
// Photo
|
||||
print '<td align="center" class="hideonsmartphone" valign="middle" width="25%" rowspan="5">';
|
||||
print '<td align="center" class="hideonsmartphone" valign="middle" rowspan="6">';
|
||||
print $form->showphoto('contact',$object)."\n";
|
||||
if ($object->photo) print "<br>\n";
|
||||
|
||||
@@ -170,8 +170,8 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
|
||||
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td colspan="3">'.$object->lastname.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td colspan="3">'.$object->firstname.'</td>';
|
||||
|
||||
// Company
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
|
||||
@@ -1950,6 +1950,13 @@ else
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
$langs->load("bills");
|
||||
if ($user->rights->facture->creer) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id.'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->nbofservicesclosed < $nbofservices)
|
||||
{
|
||||
//if (! $numactive)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
@@ -2179,6 +2179,7 @@ class Contrat extends CommonObject
|
||||
$this->ref_supplier = 'SPECIMENSUPP';
|
||||
$this->socid = 1;
|
||||
$this->statut= 0;
|
||||
$this->date_creation = (dol_now() - 3600 * 24 * 7);
|
||||
$this->date_contrat = dol_now();
|
||||
$this->commercial_signature_id = 1;
|
||||
$this->commercial_suivi_id = 1;
|
||||
@@ -2458,7 +2459,6 @@ class ContratLigne extends CommonObjectLine
|
||||
*/
|
||||
function fetch($id, $ref='')
|
||||
{
|
||||
global $langs,$user;
|
||||
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref)) return -1;
|
||||
|
||||
@@ -344,7 +344,7 @@ if ($result)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td align="center">'.dol_print_date($obj->tms,'dayhour').'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->tms),'dayhour').'</td>';
|
||||
//print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4,3,0):'').'</td>';
|
||||
|
||||
@@ -30,13 +30,26 @@
|
||||
require ("../main.inc.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("contracts");
|
||||
$langs->load("products");
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$search_name=GETPOST('search_name');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_state=trim(GETPOST("search_state"));
|
||||
$search_country=GETPOST("search_country",'int');
|
||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||
$search_contract=GETPOST('search_contract');
|
||||
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
|
||||
$sall=GETPOST('sall');
|
||||
@@ -45,6 +58,9 @@ $socid=GETPOST('socid');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$day=GETPOST("day","int");
|
||||
$year=GETPOST("year","int");
|
||||
$month=GETPOST("month","int");
|
||||
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
@@ -69,6 +85,7 @@ $staticcontratligne=new ContratLigne($db);
|
||||
|
||||
if ($search_status == '') $search_status=1;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='contractlist';
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@@ -76,9 +93,8 @@ $hookmanager->initHooks(array($contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('contract');
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('contrat');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
@@ -90,25 +106,56 @@ $fieldstosearchall = array(
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
$arrayfields=array(
|
||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'c.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
'c.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'sale_representative'=>array('label'=>$langs->trans("SalesRepresentative"), 'checked'=>1),
|
||||
'c.date_contrat'=>array('label'=>$langs->trans("DateContract"), 'checked'=>1),
|
||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $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
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (empty($reshook))
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_name="";
|
||||
$day='';
|
||||
$month='';
|
||||
$year='';
|
||||
$search_name="";
|
||||
$search_town='';
|
||||
$search_zip="";
|
||||
$search_state="";
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_contract="";
|
||||
$search_ref_supplier="";
|
||||
$search_user='';
|
||||
@@ -116,9 +163,20 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_product_category='';
|
||||
$sall="";
|
||||
$search_status="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
$objectclass='Contrat';
|
||||
$objectlabel='Contracts';
|
||||
$permtoread = $user->rights->contrat->lire;
|
||||
$permtodelete = $user->rights->contrat->supprimer;
|
||||
$uploaddir = $conf->contrat->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -132,16 +190,28 @@ $socstatic = new Societe($db);
|
||||
llxHeader();
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
|
||||
$sql.= " s.nom as name, s.rowid as socid,";
|
||||
$sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now)."')",1,0).') as nb_expired,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')",1,0).') as nb_late,';
|
||||
$sql.= ' SUM('.$db->ifsql("cd.statut=5",1,0).') as nb_closed';
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contrat_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||
if ($search_user > 0)
|
||||
@@ -154,32 +224,68 @@ $sql.= ' AND c.entity IN ('.getEntity('contract', 1).')';
|
||||
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$db->escape($socid);
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
if ($search_name) {
|
||||
$sql .= natural_search('s.nom', $search_name);
|
||||
if ($month > 0)
|
||||
{
|
||||
if ($year > 0 && empty($day))
|
||||
$sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||
else if ($year > 0 && ! empty($day))
|
||||
$sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||
else
|
||||
$sql.= " AND date_format(c.date_contrat, '%m') = '".$month."'";
|
||||
}
|
||||
if ($search_contract) {
|
||||
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
}
|
||||
if (!empty($search_ref_supplier)) {
|
||||
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
else if ($year > 0)
|
||||
{
|
||||
$sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
if ($search_name) $sql .= natural_search('s.nom', $search_name);
|
||||
if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
|
||||
if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
|
||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql.= " typent.code,";
|
||||
$sql.= " state.code_departement, state.nom";
|
||||
// Add where from extra fields
|
||||
foreach ($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
$sql .= ', ef.'.$val;
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$totalnboflines=0;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalnboflines = $db->num_rows($result);
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@@ -196,23 +302,46 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&search_contract='.$search_contract;
|
||||
$param.='&search_name='.$search_name;
|
||||
$param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
$param.='&search_sale=' .$search_sale;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_contract) $param.='&search_contract='.$search_contract;
|
||||
if ($search_name) $param.='&search_name='.$search_name;
|
||||
if ($search_ref_supplier) $param.='&search_ref_supplier='.$search_ref_supplier;
|
||||
if ($search_sale) $param.='&search_sale=' .$search_sale;
|
||||
if ($show_files) $param.='&show_files=' .$show_files;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
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_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
@@ -220,8 +349,9 @@ if ($resql)
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
$moreforfilter='';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
@@ -253,6 +383,7 @@ if ($resql)
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@@ -260,43 +391,164 @@ if ($resql)
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("SalesRepresentative"), $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(0,3), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4,3,0), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4,3,1), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(5,3), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(0,3), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4,3,0), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(4,3,1), '', '', '', '', 'width="16"');
|
||||
print_liste_field_titre($staticcontratligne->LibStatut(5,3), '', '', '', '', 'width="16"');
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" colspan="5" align="right"></td>';
|
||||
print '<td>';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_customer).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Company type
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
// Date contract
|
||||
print '<td class="liste_titre center">';
|
||||
//print $langs->trans('Month').': ';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
//print ' '.$langs->trans('Year').': ';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear,'year',1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" colspan="4" align="right"></td>';
|
||||
}
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -306,65 +558,166 @@ if ($resql)
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap"><a href="card.php?id='.$obj->cid.'">';
|
||||
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>'.$obj->ref_customer.'</td>';
|
||||
print '<td>'.$obj->ref_supplier.'</td>';
|
||||
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
||||
//print '<td align="center">'.dol_print_date($obj->datec).'</td>';
|
||||
|
||||
// Sales Rapresentatives
|
||||
print '<td>';
|
||||
if($obj->socid)
|
||||
if (! empty($arrayfields['c.ref']['checked']))
|
||||
{
|
||||
$result=$socstatic->fetch($obj->socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
else if ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$j=0;
|
||||
foreach($listsalesrepresentatives as $val)
|
||||
{
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->lastname=$val['lastname'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
print '<div class="float">'.$userstatic->getNomUrl(1);
|
||||
$j++;
|
||||
if ($j < $nbofsalesrepresentative) print ', ';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
//else print $langs->trans("NoSalesRepresentativeAffected");
|
||||
print '<td class="nowrap"><a href="card.php?id='.$obj->rowid.'">';
|
||||
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->rowid) .'</a>';
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
if (! empty($arrayfields['c.ref_customer']['checked']))
|
||||
{
|
||||
print ' ';
|
||||
print '<td>'.$obj->ref_customer.'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['c.ref_supplier']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->ref_supplier.'</td>';
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
|
||||
}
|
||||
// Town
|
||||
if (! empty($arrayfields['s.town']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->town;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['s.zip']['checked']))
|
||||
{
|
||||
print '<td class="nocellnopadd">';
|
||||
print $obj->zip;
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// State
|
||||
if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Type ent
|
||||
if (! empty($arrayfields['typent.code']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
|
||||
print $typenArray[$obj->typent_code];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
// Sales representatives
|
||||
print '<td>';
|
||||
if ($obj->socid > 0)
|
||||
{
|
||||
$result=$socstatic->fetch($obj->socid);
|
||||
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
else if ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$j=0;
|
||||
foreach($listsalesrepresentatives as $val)
|
||||
{
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->lastname=$val['lastname'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
print '<div class="float">'.$userstatic->getNomUrl(1);
|
||||
$j++;
|
||||
if ($j < $nbofsalesrepresentative) print ', ';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
//else print $langs->trans("NoSalesRepresentativeAffected");
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
// Date
|
||||
if (! empty($arrayfields['c.date_contrat']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day').'</td>';
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['c.datec']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['c.tms']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_expired>0?$obj->nb_expired:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_closed>0 ?$obj->nb_closed:'').'</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat)).'</td>';
|
||||
//print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>';
|
||||
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_expired>0?$obj->nb_expired:'').'</td>';
|
||||
print '<td align="center">'.($obj->nb_closed>0 ?$obj->nb_closed:'').'</td>';
|
||||
print '<td></td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2016 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
|
||||
@@ -71,7 +72,8 @@ class box_contracts extends ModeleBoxes
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
|
||||
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_contrat DESC, c.ref DESC ";
|
||||
else $sql.= " ORDER BY c.tms DESC, c.ref DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user